|
Helo
try passing DT_WOWRDBREAK flag to the drawtext function.
i gues it put ellipses for a single long word.
|
|
|
|
|
I am also having the same problem where it will not print to my HP LaserJet 1200 Series, which is running thru the network I am on a XP SP1 machine and the printer is plugged into a Win2000pro w/ SP3?
|
|
|
|
|
Some printers don't like an empty docname... set a valid docname in the param docInfo just before calling StartDocPrinting(docinfo)
|
|
|
|
|
This demo does't work with HP Laser Jet 1200, i m using windows XP SP1. However its works fine with Epsone LX-300.
'¯`°²¤ zee ¤²°`¯'
|
|
|
|
|
had same problem here.
add:
docInfo.lpszDocName = _T("whatever");
to function:
void GPrintJob::InitDocInfo(DOCINFO& docInfo)
|
|
|
|
|
Saved my day having a problem with Abobe PDF! Thanks!
|
|
|
|
|
This is a great class.
Class takes care of Data Column alignment. But it allows only one type of Format for all Column Headings.
Made changes to allow to store Format along with each Column Heading. Replace existing declarations, methods with the code given below to enable Column Heading Format in your report.
File: gfx_printunit.h
typedef struct tagPrintColumnDef<br />
{<br />
CString strName;<br />
CString strOverflow;<br />
double fPct;<br />
UINT nWidth;<br />
UINT nStart;<br />
DWORD dwFlags;<br />
UINT nFormat;
<br />
} PRINTCOLUMNDEF, *LPPRINTCOLUMNDEF;<br />
<br />
typedef struct tagPrintColumn<br />
{<br />
int nPos;<br />
LPCTSTR lpszName;<br />
double fColPct;<br />
DWORD dwFlags;<br />
UINT nFormat;
<br />
} PRINTCOLUMN, *LPPRINTCOLUMN;<br />
<br />
virtual void InsertPrintCol(int nPos, LPCTSTR lpszName, double fColPct=0.0, int nHeading=0, UINT nFormat=DT_LEFT);<br />
<br />
void InsertPrintCol(int nPos, UINT nIDName, double fColPct=0.0, int nHeading=0, UINT nFormat=DT_LEFT);<br />
<br />
virtual void PrintColHeadings(UINT nEffects=0);
File: gfx_printunit.cpp
void GPrintUnit::InsertPrintCol(int nPos, LPCTSTR lpszName, double fColPct, int nHeading, UINT nFormat)<br />
{<br />
PRINTCOLUMN pc;<br />
GMAKESTNUL(pc);<br />
<br />
pc.nPos = nPos;<br />
pc.lpszName = lpszName;<br />
pc.fColPct = fColPct;<br />
pc.dwFlags |= PCF_RIGHTMARGIN;<br />
pc.nFormat = nFormat;
<br />
InsertPrintCol(&pc, nHeading);<br />
}<br />
<br />
void GPrintUnit::InsertPrintCol(int nPos, UINT nIDName, double fColPct, int nHeading, UINT nFormat)<br />
{<br />
CString strName;<br />
strName.LoadString(nIDName);<br />
<br />
InsertPrintCol(nPos, strName, fColPct, nHeading, nFormat);<br />
}<br />
<br />
void GPrintUnit::InsertPrintCol(LPPRINTCOLUMN pCol, int nHeading)<br />
{<br />
ASSERT(pCol);<br />
if(!pCol)<br />
return;<br />
<br />
LPPRINTUNITCOLDEFS lpColDefs = NULL;<br />
<br />
if(nHeading >= m_headings.GetSize())<br />
{<br />
lpColDefs = new PRINTUNITCOLDEFS;<br />
m_headings.InsertAt(nHeading, lpColDefs);<br />
}<br />
else<br />
{<br />
lpColDefs = m_headings.GetAt(nHeading);<br />
}<br />
<br />
LPPRINTCOLUMNDEF lpNewDef = new PRINTCOLUMNDEF;<br />
if(pCol->lpszName)<br />
{<br />
if(pCol->dwFlags & PCF_TEXTISID)<br />
lpNewDef->strName.LoadString((UINT)pCol->lpszName);<br />
else<br />
lpNewDef->strName = pCol->lpszName;<br />
}<br />
<br />
if(pCol->dwFlags & PCF_STRETCHY)<br />
{<br />
double fRemaining = 100.0;<br />
<br />
int nSize = lpColDefs->GetSize();<br />
for(int i = 0; i < nSize; i++)<br />
{<br />
LPPRINTCOLUMNDEF lpDef = lpColDefs->GetAt(i);<br />
if(lpDef)<br />
{<br />
fRemaining -= lpDef->fPct;<br />
}<br />
}<br />
<br />
pCol->fColPct = fRemaining;<br />
}<br />
<br />
<br />
lpNewDef->nWidth = GPERCENT(JINFO.m_rectDraw.Width(), pCol->fColPct);<br />
lpNewDef->nFormat = pCol->nFormat;
<br />
lpNewDef->fPct = pCol->fColPct;<br />
lpNewDef->dwFlags = pCol->dwFlags;<br />
lpColDefs->InsertAt(pCol->nPos, lpNewDef);<br />
}<br />
<br />
void GPrintUnit::PrintColHeadings(UINT nEffects)<br />
{<br />
if(!m_bPrintingHeading)<br />
{<br />
m_bPrintingHeading = TRUE;<br />
<br />
try<br />
{<br />
StartRow(PT_HEADING);<br />
<br />
int nSize = m_lpActiveColDefs->GetSize();<br />
for(int i = 0; i < nSize; i++)<br />
{<br />
LPPRINTCOLUMNDEF lpDef = m_lpActiveColDefs->GetAt(i);<br />
if(lpDef)<br />
{<br />
CRect r;<br />
GMAKERECT(r, lpDef->nStart, JCUR.y, lpDef->nWidth, m_pum.pumHeadingHeight);<br />
int nLen = lpDef->strName.GetLength();<br />
<br />
if(lpDef->dwFlags & PCF_RIGHTMARGIN)<br />
{<br />
int nMargin = GPERCENT(r.Width(), 0.015);<br />
r.right -= nMargin;<br />
}<br />
<br />
if(nEffects && !(nEffects & HE_DOLAST))<br />
DoHeadingEffect(i, lpDef->strName, nLen, r, lpDef->nFormat, nEffects);
<br />
PrintColHeading(i, lpDef->strName, nLen, r, lpDef->nFormat, nEffects);
<br />
if(nEffects & HE_DOLAST)<br />
DoHeadingEffect(i, lpDef->strName, nLen, r, lpDef->nFormat, nEffects);
}<br />
}<br />
<br />
m_sizeCurrentRow.cy = m_pum.pumHeadingHeight;<br />
<br />
EndRow(FALSE);<br />
}<br />
catch(...)<br />
{<br />
m_bPrintingHeading = FALSE;<br />
throw;<br />
}<br />
<br />
m_bPrintingHeading = FALSE;<br />
}<br />
}
Test Files:
File: unit_table1.cpp<br />
Method: void Table1Unit::DefineColHeadings()<br />
<br />
<br />
InsertPrintCol(0, "Part Number", 0.45, 0, DT_LEFT);<br />
InsertPrintCol(1, "Description", 0.30, 0, DT_CENTER);<br />
InsertPrintCol(2, "Qty.", 0.10, 0, DT_LEFT);<br />
InsertPrintCol(3, "Cost", 0.15, 0, DT_LEFT);<br />
<br />
<br />
Method: BOOL Table1Unit::Print()<br />
<br />
PrintColHeadings();
Vineet Bhasin
|
|
|
|
|
I downloaded the demo and source zip files and attempted to build the project with Windows 98 and Visual Studio 6. First, the rc couldn't be found during compilation. Second, when I attempted to expand the resource window, I received a load failure.
I reloaded the entire project in case of an I/O error; however, the same symptoms reoccurred.
Any ideas what is going wrong?
|
|
|
|
|
hi there,
I'm trying to dispaly some data as a graph, how is that done with this lib ?
|
|
|
|
|
Hi there
1) Im needing a table that includes another table, does anyone have a hint ?
2) Another thing is how is it posible to draw lines between fields
tanks
Kenneth
|
|
|
|
|
Someone please give me help on using GPrintJob::UseDefaults. I would be grateful if U could give me the code used to override CreatePrintDialog(), I don't want a print dialog.
Thanks....
paa_nii
|
|
|
|
|
Hi
I downloaded the demo project and tried to print from the demo application. It works fine on one printer( HP Deskjet 895C Series) but doesn't work on other two printers(HP LaserJet 8050 Series and HP LaserJet 4050 Series).It doesn't print anything.
This printing works with all the printers on other operating systems(NT & 2000) except window 98(I haven't tried on ME).
Please let me know if you have any solution for this.
Thanks
|
|
|
|
|
I have a similar problem. The class won't print anything under Win98 using Acrobat Distiller or a Kyocera Mita FS-1010 KX printer. It does work under Win2000 using those printers, though.
I was able to trace the problem to
BOOL GPrintJob::StartDocPrinting(DOCINFO& docInfo)
line
if ( (!m_pDC) || m_pDC->StartDoc(&docInfo) == SP_ERROR)
(m_pDC->StartDoc(&docInfo) == SP_ERROR) is true, therefore printing is aborted.
However, I wasn't able to find out why.
|
|
|
|
|
HI ,
I have 4 pdf files which comprise of one document. When I am trying to print it gets printed as 4 different jobs. How can I print it as a single job . By the way, the pdf files data are being populated from the FDF file .
Any help would be appreciated .
Sujay
|
|
|
|
|
Every time a text gets wrapped the font gets bolder.Has
anyone discovered this?
|
|
|
|
|
I've studied what's here (especially the Dan Pilats entry). It's all very good stuff, but unless I've missed something, it doesn't quite solve my problem.
I have to print something that is the result of traversing a hierarchy. I don't know ahead of time how many entries at each level or how deep. Any node could contribute a few lines or more than a page.
Ideally I would like to use a visitor and have it "push" the pages back at me. This doesn't seem to fit the built in MFC print framework. I realize I don't have to know the number of pages in advance, but it still wants to "pull" pages from me via OnPrint().
I've considered a smart iterator that could be asked to get a page's worth, regardless of how many nodes in my structure it spans.
Is it easy to avoid using (most of) the framework and still take advantage of the print dialog and the preview?
I'd also like a second tab of my own (where in my hierarchy to start, how deep to go, etc.). I suppose I can extend PrintDialog and intercept what I need?
Thanks,
Trevor S.
P.S. Please excuse me. I'm a Java programmer, and wrote my first C++ app this week!
|
|
|
|
|
Hi,
Does anyone know how to speed up printing on a line printer using this class? When printing to an OKI-591 printer on a Windows 2000 newtork server using this class I find the printing is extremely slow. All the data is spooled immediately to the printer server but actual printing is slow.
Thanks in advance for your help!
JST
|
|
|
|
|
If the data has been spooled, then it's no longer the domain of this code, surely ? Does it print a lot slower than other jobs ? Maybe the quality is being set higher ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Hi, this is a great class. However, I would like to know if it is possible not to make the printer scroll the paper after the last line printed (I am using a continous roll of paper). I tried disabling all EndPage() calls, but it still scrolls.
Thanks.
|
|
|
|
|
There are some #define HFC_CENTER _T('x1f')
It would be nice doing a HFC_BETWEENCENTERANDRIGHTJUSTIFY.
That way you could have 5 places for putting text
in PrintHeader or PrintFooter.
So what means 'x1f'????
|
|
|
|
|
Hello,
I am trying to understand this interesting new technology put forth in these MFC prining classes. I had a specific question in regards to the text wrapping using the embedded CRichEditCtrl done in the GPrintUnit class. I was wondering if someone can tell me why you have to set the font of the CRichEditCtrl to the fontScreen && then also set the DefaultCharFormat using a CHARFOMAT derived from the fontPrinter when you are using the CRichEdit for providing Text Wrapping capabilities? It seems like the use of the fontScreen is unnecessary since the SetDefaultCharFormat is used to "set the current default character formatting attributes in this CRichEditCtrl object".
Thanks,
Bryan Wilcox
|
|
|
|
|
How to print at exact location (x,y) on paper
or starting from a point on paper.
without having to use tab or repeating space
Is anyone can help me..!!
|
|
|
|
|
A "CReports" class is created from the CView class with a CDC*. Call PrintString with the x, y coordinates and the string to print.
void PrintString( float x,
float y,
CString Text,
int Size = 12,
BOOL Underline = FALSE,
int Weight = FW_REGULAR);
void CReports::PrintString(float x, float y, CString Text, int Size, BOOL Underline, int Weight)
{
CFont txtFont;
CSize fontSize;
int perinch_X = m_pDC->GetDeviceCaps(LOGPIXELSX);
int perinch_Y = m_pDC->GetDeviceCaps(LOGPIXELSY);
fontSize.cx = fontSize.cy = ((perinch_Y * Size) / 72);
m_pDC->DPtoLP(&fontSize);
txtFont.CreateFont(fontSize.cy, //int nHeight,
0, //int nWidth,
0, //int nEscapement,
0, //int nOrientation,
Weight, //int nWeight,
FALSE, //BYTE bItalic,
Underline, //BOOL bUnderline,
0, //BYTE cStrikeOut,
ANSI_CHARSET, //BYTE nCharSet,
OUT_DEFAULT_PRECIS, //BYTE nOutPrecision,
CLIP_DEFAULT_PRECIS, //BYTE nClipPrecision,
PROOF_QUALITY, //BYTE nQuality,
DEFAULT_PITCH | FF_SWISS, //BYTE nPitchAndFamily,
"Courier New"); //LPCTSTR lpszFacename
CFont* pOldFont = (CFont*) m_pDC->SelectObject(&txtFont);
// X-Y conversion factor to centimeters
m_pDC->TextOut( int((float(perinch_X) / 2.54) * x),
int((float(perinch_Y) / 2.54) * y),
Text
);
m_pDC->SelectObject(pOldFont);
txtFont.DeleteObject();
}
|
|
|
|
|
thank you for your reply i will try that !!
Regards
|
|
|
|
|
when printing a large number of records onto several pages, after selecting the OK on the default internal Print dialog (thats the one that specifies the properties, page range, copies etc.), is there a way of presenting an additional small dialog indicating printing is in progress until the job is complete. Otherwise the 'shadow' of the Pring dialog is just placed on my original dialog and is not removed (refreshed) until the job is finished. This can be 10 secs or more for a long print job with large number of records. Otherwise works prefect.
|
|
|
|
|