How to force landscape printing in MS Access code

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

myouth
User
Posts: 8
Joined: Sat Jan 01, 2005 8:25 pm

How to force landscape printing in MS Access code

Post by myouth »

I looked throught the help file many times and can't find out how to switch between portrait and landscape. I would think there would be an Options.Paper.Orientation setting but I can't find it documented anywhere. Is this an undocumented feature?
User avatar
Chris - Tracker Supp
Site Admin
Posts: 797
Joined: Tue Apr 14, 2009 11:33 pm

Re: How to force landscape printing in MS Access code

Post by Chris - Tracker Supp »

Hi myouth,

On pg.10 of the API Help PDF you'll find the properties required to force landscape:

SheetSizeIndex, SheetWidth, and SheetHeight.

Since sheet index standard settings (pg.13) are all in portrait you'll need to use -2 value to invoke custom sheet size and then pass the landscape dimensions of the page

m_pPrinter->Option["Paper.SheetSizeIndex"] = -2;
m_pPrinter->Option["Paper.SheetWidth"] = PaperWidth;
m_pPrinter->Option["Paper.SheetHeight"] = PaperHeight;

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
myouth
User
Posts: 8
Joined: Sat Jan 01, 2005 8:25 pm

Re: How to force landscape printing in MS Access code

Post by myouth »

Thanks for the reply. I tried what you suggested and the page still has the default width (2100) and height (2970). Here is the code I am using to set the options. I've tried many thing, just not the correct one.

With PDFPrinter
.Option("Save.SaveType") = 2
.Option("Save.ShowSaveDialog") = False
.Option("Save.Path") = GetReportPath()
.Option("Save.File") = cFileName
.Option("Save.WhenExists") = 1
.Option("Save.RunApp") = False
.Option("DocInfo.Enabled") = True
.Option("DocInfo.Title") = "Test Doc"
.Option("DocInfo.Subject") = "Test Subject"
.Option("DocInfo.Author") = "Author Here"
.Option("DocInfo.Creator") = "Access Database"
.Option("Paper.LayoutType") = 0
'.Option("Paper.Center") = True
.Option("Paper.Fit") = True
.Option("Paper.SheetSizeIndex") = (-2)
.Option("Paper.SheetWidth") = 2159
.Option("Paper.SheetHeight") = 3556

End With
PDFPrinter.ApplyOptions (0)
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3556
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada

Re: How to force landscape printing in MS Access code

Post by Ivan - Tracker Software »

Please try this:

Code: Select all

    With Printer
        .Option("DevMode.Orientation") = 1 ' 1 - portrait; 2 - landscape
        ' all the rest options here
        ' call ApplyOptions, otherwise DevMode info will not be stored
        .ApplyOptions 0
    End With
HTH
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
myouth
User
Posts: 8
Joined: Sat Jan 01, 2005 8:25 pm

Re: How to force landscape printing in MS Access code

Post by myouth »

Thanks for the quick response. Here's what I found.
If the report is set to Letter paper the above command for orientation was able to switch from portrait to landscape but the paper size was still the default size.
If the report is set to Legal paper the above command for orientation wasn't able to switch.
If the report is set to Legal paper and the report was changed from portrait to landscape the report would switch but the paper size is still the default size in the pdf.
Why can't I switch the paper size and orientation in code? What other fancy settings are in the "DevMode"?
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3556
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada

Re: How to force landscape printing in MS Access code

Post by Ivan - Tracker Software »

There is also "DevMode.PapSize" which defines paper size. It is value is a one of "standard index" from table "List of standard paper sizes" (see documentation).
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.