Page 1 of 1

PXCV_DrawPageToDC and Printer driver

Posted: Mon Sep 10, 2012 6:11 am
by glima
We have clients with malformed PDF files that they need to stamp with our software. We convert their original files, by printing the documents to a PDF-XChange Driver Printer so they can be stamped.

Steps
1. Create a PDF Driver
2. Create a Printer DC
3. Open malformed document.
4. Loop through each page
4a. Get Document page dimensions
4b. Set PDF driver page dimensions
4c. Use PCXV_DrawPageToDc to Printer DC (WholePage and DrawRect are the same as the page)
5. Close Document
6. Close Printer

The output is fine if the input file pages are 8.5 x 11. if the input file pages are 11 x 8.5 (Landscape) the output page size is correct but the information is shrunk in the middle of the page.

I have attached an Original and the Converted documents.

This may be an issue with the PCXV Viewer SDK but i don't know what forum would be best for this question.

Re: PXCV_DrawPageToDC and Printer driver

Posted: Mon Sep 10, 2012 7:44 am
by Tracker Supp-Stefan
Hello glima,

Please take a look at this post by one of my colleagues:
https://forum.pdf-xchange.com/ ... 723#p49723
Which shows how you can change the paper orientation to landscape when needed.

You will then need to detect the orientation of the page in 4a - and use that to set the paper orientation in 4b.

Best,
Stefan

Re: PXCV_DrawPageToDC and Printer driver

Posted: Mon Sep 10, 2012 2:17 pm
by glima
This did not help. The output was landscape but it was shrunk to fit into portrait. Please review the PDF's attached in the original post.

This is what is performed for each page in the Original document

'Paper.SheetSizeIndex' = -2
'Paper.SheetWidth' = Pagewidth
'Paper.SheetHeight' = Pageheight
'DevMode.Orientation = 1
if Pagewidth > Pageheight
'DevMode.Orientation' = 2

ApplyOptions(0)

Re: PXCV_DrawPageToDC and Printer driver

Posted: Mon Sep 10, 2012 4:26 pm
by Tracker Supp-Stefan
Hello glima,

Could you please send us a sample project showing the implementation of your algorithm, and a screenshot with the "paper" page of your printer's preferences?

Best,
Stefan