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: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Post Reply
glima
User
Posts: 28
Joined: Mon Sep 20, 2004 4:27 pm
Location: Phoenix, AZ

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.
Attachments
Converted.pdf
(60.33 KiB) Downloaded 333 times
Original.pdf
(30.66 KiB) Downloaded 272 times
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17765
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: PXCV_DrawPageToDC and Printer driver

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

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
Tracker Supp-Stefan
Site Admin
Posts: 17765
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: PXCV_DrawPageToDC and Printer driver

Post 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
Post Reply