|
|
Comments and Discussions
|
|
 |

|
Is it possible to choose the printer in the code. My default is an A4 printer but I need to print specific data to a docket printer without having to select it every time.
|
|
|
|

|
...and I remember first reading in 2002. Time goes fast.
Umer Mansoor
|
|
|
|

|
Hi, i have just found mistake in function GfxFontToCharformat:
_tcsncpy(cf.szFaceName, lf.lfFaceName, sizeof(cf.szFaceName));
When using UNICODE sizeof(cf.szFaceName) is 64 bytes, but string is only 32 characters long. Third param means number of characters NOT memory size!!!
BOOL GfxFontToCharformat(CFont *pFont, CHARFORMAT& cf, CDC *pDC)
{
BOOL bConvert = FALSE;
if(pFont)
{
LOGFONT lf;
if(pFont->GetLogFont(&lf))
{
bConvert = TRUE;
GMAKESTNUL(cf);
cf.cbSize = sizeof(cf);
cf.dwMask = CFM_FACE | CFM_SIZE | CFM_CHARSET;
cf.bCharSet = DEFAULT_CHARSET;
cf.bPitchAndFamily = lf.lfPitchAndFamily;
int nPointSize = GfxHeightToPointSize(lf.lfHeight, pDC);
//multiply by 20 to convert to twips
cf.yHeight = nPointSize * 20;
_tcsncpy(cf.szFaceName, lf.lfFaceName, sizeof(cf.szFaceName));
memcpy(&cf.szFaceName,&lf.lfFaceName,sizeof(cf.szFaceName));
if(lf.lfItalic)
{
cf.dwEffects |= CFE_ITALIC;
cf.dwMask |= CFM_ITALIC;
}
if(lf.lfWeight == FW_BOLD)
{
cf.dwEffects |= CFE_BOLD;
cf.dwMask |= CFM_BOLD;
}
if(lf.lfUnderline)
{
cf.dwEffects |= CFE_UNDERLINE;
cf.dwMask |= CFM_UNDERLINE;
}
if(lf.lfStrikeOut)
{
cf.dwEffects |= CFE_STRIKEOUT;
cf.dwMask |= CFM_STRIKEOUT;
}
}
}
return bConvert;
}
|
|
|
|

|
Hi,
Thanks for your nice job.
I want to know how I can set the default page style to A4 (landscape)?
Thanks
|
|
|
|

|
e.g., for land-scape,
in the function InitPrintInfo(),
void GPrintJob::InitPrintInfo()
{
if(m_pInfo && m_pDC)
{
////////////////////////////////////////////////////////////////
LPDEVMODE pDevMode = m_pInfo->m_pPD->GetDevMode();
pDevMode->dmFields |= DM_ORIENTATION;
pDevMode->dmOrientation = DMORIENT_LANDSCAPE;
ResetDC(m_pInfo->m_pPD->m_pd.hDC, pDevMode);
////////////////////////////////////////////////////////////////
......
|
|
|
|
|

|
hi,
Thankyou for ur article, i'm using that code in my project for a customized printing. I have a problem with in stopping the print when the text to be printing is over. I'm not using the header and footer part of ur code. So how can i stop printing when the text is over.
Kindly reply as soon as possible,
|
|
|
|

|
Hi,
Would you be interested in beta testing ReportMax. ReportMax is a reporting tool for Visual C++ developers. For more information and registration for the coming beta:
www.cppmax.com
|
|
|
|

|
Added the 4 files to my project - fine, compiles
started copying and pasting your example usage, but it won't work.
I get a compile error about the "MyPrintUnit unit(this);" it says its expecting no parameters. I guess its looking for GPrintUnit ctor????? if I remove the this, then unit.Print(); complains about not being a class or union type.
I've only used your sample code as is, so am i doing something wrong?
|
|
|
|

|
hi
i want to print a graph in my report doc
can this class do it for me? how?
any help would be appreciated.
|
|
|
|

|
Hello all,
I have implemented this and it is working fine ... but a new printer was added and now all I get from the printer is printed in Arial 12pt even though I specified Times New Roman 10pt. I have tried using Arial 10pt but the results from this printer remain the same.
I can use different printers and have no problems but from this one printer it seems only to use the default font. (A guess, but one that fits the facts)
Thanks for your help
John
|
|
|
|

|
Hi John,
perhaps the printer doesn't support Arial (which is the Microsoft version of Helvetica). Try Helvetica instead.
Sven
|
|
|
|

|
I have continued investigating this, and the printer that is causing the issues is one that uses the LIDIL. I have come across some references on the internet, but am still not sute this is the issue.
Thanks,
John
|
|
|
|

|
hello
i cant use this class even with a single line PRINT
could you help me
|
|
|
|

|
What is problem you are having? You will have to modify the code a little to fit your paticular environment (compiler and so on), but other than that, the examples seem to work exactly as stated. If you could give me a little more information, perhaps I could be of some assistance.
John
|
|
|
|

|
Using your classes it works great printing through the network or by USB connection. However, if connected by parallel port the application will hang right after OK is pressed on the windows printer dialog.
The printer is a HP Inkjet and the OS is Windows 2003.
Any ideas?
Mike
-- modified at 10:46 Monday 13th March, 2006
|
|
|
|

|
Hi I used your sample and I change the output to a lots of characters and it is not shifted at all. I don't know why. I complimed your example and printed then it was no overflow. Then I added more caracters to see if it will be shifted and it is not. I don't know why?. Thanks.
|
|
|
|

|
How to print using the CScrollView
any idea ,
Want to provide also PrintPrivew
for the user .
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|

|
Thanks
|
|
|
|

|
I am drawing some lines while printing using page size A4.if I change the page size at runtime the lines are not printed correctly. how can I reflect the change of pagesize to print correctly.
gdfgdf
|
|
|
|
|

|
Good sample to start a printing project
|
|
|
|

|
Hi!
Wat if I have got a single word, without spaces, which is too long to be accomodated in the width of rect provided to DrawText of DC? It gets truncated. How to wrap that single word? Does DrawText provide any flag to do this, as it provides for Word Wrapping?
Can your GPrintUnit::PrintCol() can be used for this purpose?
Regards,
Shuaib.
|
|
|
|

|
Helo
try passing DT_WOWRDBREAK flag to the drawtext function.
i gues it put ellipses for a single long word.
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
|
Two classes to add advanced print functionality to your MFC application
| Type | Article |
| Licence | |
| First Posted | 1 Dec 1999 |
| Views | 278,624 |
| Bookmarked | 100 times |
|
|