PXCV_DrawPageToDC and Printer driver

PDF-XChange Drivers API (only) V4/V5
This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-XChange Printer Drivers SDK (only) - VERSION 4 & 5 - Please use the PDF-Tools SDK Forum for Library DLL assistance.

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Stefan - PDF-XChange

glima
User
Posts: 28
Joined: Mon Sep 20, 2004 4:27 pm

PXCV_DrawPageToDC and Printer driver

Post 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.
You do not have the required permissions to view the files attached to this post.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19868
Joined: Mon Jan 12, 2009 8:07 am

Re: PXCV_DrawPageToDC and Printer driver

Post by Stefan - PDF-XChange »

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
glima
User
Posts: 28
Joined: Mon Sep 20, 2004 4:27 pm

Re: PXCV_DrawPageToDC and Printer driver

Post 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)
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19868
Joined: Mon Jan 12, 2009 8:07 am

Re: PXCV_DrawPageToDC and Printer driver

Post by Stefan - PDF-XChange »

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