12-01-2021 10:13 AM
Hi,
The ExportToPDF function creates a PDF file using the US Letter page size. My graphs are A4 so they end up being fitted to Letter size and leaving a large margin at the bottom. I can't find a setting within DIAdem or a reference to PDF page size in the help files, so does anyone have any idea if it can be controlled?
Thanks,
Simon.
Solved! Go to Solution.
12-07-2021 02:40 AM
Hi Simon,
This is a general setting in the layout parameters:
Greetings
Walter
12-07-2021 03:48 AM
Hi Walter,
Perhaps I wasn't clear enough in my original post. The page size is set to A4 in DIAdem but PDFExport produces a document using Letter page size.
So the graph is reduced to fit, leaving a margin at the bottom of each page:
Regards.
12-07-2021 05:39 AM
Hi Simon,
Please can you check the PDF output with this script:
call data.Root.Clear
call DataFileLoad(ProgramDrv & "\Examples\Data\Example_data.tdm")
call Report.LoadLayout(ProgramDrv & "\Libr\Documents\Example.tdr")
call Report.Refresh
Report.Settings.Page.Dimensions.UseScaledOutput = false
Report.Settings.Page.Dimensions.Ratio = 0.7
call Report.Sheets.ExportToPDF("D:\Test\Test", false)
Greetings
Walter
12-07-2021 06:55 AM
Hi Walter,
Same problem I'm afraid.
Regards.
12-07-2021 07:23 AM
Hi Simon,
What are the settings in the printer setting dialog?
Here are some script commands regarding the format of a Printer:
'returns the possible supported formats
msgbox PrinterPaperSizeListGet("winspool,DIAdem PDF Export,nul:")
'returns the selected format
msgbox PrinterPaperSizeGet("winspool,DIAdem PDF Export,nul:")
' sets the format (persistent)
call PrinterPaperSizeSet("A4", "winspool,DIAdem PDF Export,nul:")
Greetings
Walter
12-07-2021 08:13 AM
Hi Walter,
I think you've found the problem.
Before:
After:
Do you happen to know why it was set to letter in the first place? Is this a DIAdem thing or a Windows thing or an Adobe thing? I ask this last questions because the settings on all my colleagues machines will probably be the same as mine.
Finally, I assume I can add the last function you gave (PrinterPaperSizeSet) to my code to force the paper size each time a script is run?
Many thanks.
12-07-2021 08:32 AM
Hi Simon,
This setting depends on the OS language. If the language is English, then the size is set to “Letter” otherwise it is “A4”.
Greetings
Walter
12-07-2021 08:59 AM
Well, that's charming of Microsoft.
Thanks Walter.