How to force landscape printing in MS Access code
Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan
-
- User
- Posts: 8
- Joined: Sat Jan 01, 2005 8:25 pm
How to force landscape printing in MS Access code
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?
-
- Site Admin
- Posts: 797
- Joined: Tue Apr 14, 2009 11:33 pm
Re: How to force landscape printing in MS Access code
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
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
Chris Attrell
Tracker Sales & Support North America
http://www.tracker-software.com
-
- User
- Posts: 8
- Joined: Sat Jan 01, 2005 8:25 pm
Re: How to force landscape printing in MS Access code
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)
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)
-
- 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
Please try this:
HTH
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
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.
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.
-
- User
- Posts: 8
- Joined: Sat Jan 01, 2005 8:25 pm
Re: How to force landscape printing in MS Access code
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"?
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"?
-
- 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
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.
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.