Printing Portrait and Landscape Pages

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

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

kfoerst
User
Posts: 3
Joined: Wed Dec 02, 2009 9:07 pm

Printing Portrait and Landscape Pages

Post by kfoerst »

The VB example that comes with the SDK doesn't cope with PDF documents that contain both portrait and landscape pages. Portrait pages are printed correctly, but landscape pages are squeezed so that they fit horizontally on a portrait page. I rather want them to be rotated and thus printed at the same size as portrait pages.

Could anybody help me with the code? The SDK example starts nicely with the following code (frmMain.PrintPdfFile):

Code: Select all

Dim bRotated As Boolean
bRotated = (physicalSize.cx > physicalSize.cy)
But bRotated is never used to anything.

I found out that the following line rotates landscape pages the way I want:

Code: Select all

crp.flags = pxvrpf_UseVectorRenderer Or pxvrpf_Rotate_Rotate90CCW
But how do I set the four elements of WholePageRect? - Any help greatly appreciated!
User avatar
Chris - PDF-XChange
Site Admin
Posts: 798
Joined: Tue Apr 14, 2009 11:33 pm

Re: Printing Portrait and Landscape Pages

Post by Chris - PDF-XChange »

kfoerst

If you are using the ActiveX SDK?

The ActiveX SDK you can set the print simple scale object to autorotate which handles switching orientations. ActiveX Help Manual pg106.

Hope that helps

Chris
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.


Chris Attrell
Tracker Sales & Support North America
http://www.tracker-software.com
kfoerst
User
Posts: 3
Joined: Wed Dec 02, 2009 9:07 pm

Re: Printing Portrait and Landscape Pages

Post by kfoerst »

Thanks for Your help. - No, I'm not using the ActiveX because the component is integrated into a document management system that handles different types of documents (TXT, TIF, DOC, PDF, XLS ...) in precisely the same manner. Whatever document the user is displaying, printing, copying and so on, the user interface looks the same. Apart from the landscape problem, the DLL integrates seamlessly into this application.
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: Printing Portrait and Landscape Pages

Post by Corwin - Tracker Sup »

Hi kfoerst,

In your SDK example try to add this code to the PrintPdfFile function:

Code: Select all

....
For i = nStartPage To nEndPage ' existed code
   StartPage pdlg.hdc
   '
   Dim doc_page_w As Double
   Dim doc_page_h As Double
	hr = PXCV_GetPageDimensions(m_Doc, i, doc_page_w, doc_page_h)
	
	crp.flags = pxvrpf_UseVectorRenderer ' new code
	If doc_page_w > doc_page_h Then
	    Dim tmp As Long
	    tmp = doc_page_w
	    doc_page_w = doc_page_h
	    doc_page_h = tmp
	    crp.flags = crp.flags Or pxvrpf_Rotate_Rotate90CCW
	End If
HTH.
kfoerst
User
Posts: 3
Joined: Wed Dec 02, 2009 9:07 pm

Re: Printing Portrait and Landscape Pages

Post by kfoerst »

YES, that's it! Thanks a lot!

I was confused by the numerous variables in the original code.