Two Pilots™    Home  |  Navigation  |  Site Map  |  Products  |  Download  |  Prices  |  For Partners  |  Support


All forums · Statistics · Search ·

Two Pilots forum / For software developers / PDF Resolution fails when no default printer
Author Message
Julianis
# Posted: 6 Jan 2012 08:57


Hi,

I'm evaluating PDF CreatorPilot library to generate a PDF export of a document from our application at a given resolution (600 dpi).

We have been generating very nice PDF without much troubles until we tested on a computer without a single printer (all printers have been deleted). So basically there is no default printer.

I'm able to create the PDF creator COM interface, configure the DPi and retrieve the HDC, but in this case the DC returns a resolution of 96 (screen resolution) and not the 600 value as expected (and as it does when there is a default printer available).

Below is the C++ code used with PDF creator to configure the DPI:

long nPrinterDPI = 600;

IPDFDocument4Ptr pPDF(__uuidof(PDFDocument4), NULL, CLSCTX_ALL);

pPDF->SetLicenseData("demo@demo", "demo");
pPDF->PageResolution = nPrinterDPI;
pPDF->UseScreenBasedDC = VARIANT_FALSE;

HDC hPDFDC = (HDC) pPDF->GetDC();

CDC dc;
dc.Attach(hPDFDC);

// the following assert breaks when there is no default printer
ASSERT( nPrinterDPI == dc.GetDeviceCaps(LOGPIXELSX) );

I've been testing this code on WIndows 7 and the latest PDF creator libray version.

Best regards and happy new year
Julien Van Labeke

Artem
Member
# Posted: 6 Jan 2012 22:30 · Edited by: Artem


Hello Julien,

Yes, you are right. In the GetDC() method we are using default printer DC. When there is no default printer, we are using screen DC. The below is piece of code our GetDC():

{
m_hdcPrinter = getDefaultPrinterDC();
if (!m_hdcPrinter)
m_bUseScreenDC = true;
}


Cheers and Best Wishes for 2012!

If you have any other questions, please don't hesitate to contact us.

--
Best regards,
Artem Golubnichenko

Two Pilots
http://www.colorpilot.com

Anonymous
# Posted: 9 Jan 2012 03:29


Thank you to confirm what I noticed.

Now, when there is no default printer, is there a method to generate the PDF at any given resolution ?
Or should I just fall back on generating the PDF at screen resolution ?

Regards
Julien

Artem
Member
# Posted: 9 Jan 2012 04:12


Julien,

When there is no default printer, method would generate the PDF with screen resolution.
If you have any other questions, please don't hesitate to contact us.

--
Best regards,
Artem Golubnichenko

Two Pilots
http://www.colorpilot.com

 

 

Powered by miniBB 2.0 RC7 © 2001-2004 Page creation time (sec.): 0.012

 

Page top