From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

ExportToPDF not A4 page size

Solved!
Go to solution

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.

0 Kudos
Message 1 of 9
(2,190 Views)

Hi Simon,

 

This is a general setting in the layout parameters:

Walter_Rick_0-1638866390902.png

 

Greetings

Walter

 

 

 

0 Kudos
Message 2 of 9
(2,156 Views)

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.

Simon_Aldworth_0-1638870212286.png

 

Simon_Aldworth_1-1638870373911.png

So the graph is reduced to fit, leaving a margin at the bottom of each page:

Simon_Aldworth_2-1638870513094.png

Regards.

0 Kudos
Message 3 of 9
(2,150 Views)

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

0 Kudos
Message 4 of 9
(2,145 Views)

Hi Walter,

 

Same problem I'm afraid.

Simon_Aldworth_0-1638881742539.png

Regards.

0 Kudos
Message 5 of 9
(2,136 Views)
Solution
Accepted by Simon_Aldworth

Hi Simon,

 

What are the settings in the printer setting dialog?

Walter_Rick_0-1638883283687.png

 

 

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

0 Kudos
Message 6 of 9
(2,133 Views)

Hi Walter,

 

I think you've found the problem.

 

Before:

 

Simon_Aldworth_0-1638885900456.png

 

After:

 

Simon_Aldworth_1-1638886210272.png

 

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.

 

0 Kudos
Message 7 of 9
(2,128 Views)

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

0 Kudos
Message 8 of 9
(2,124 Views)

Well, that's charming of Microsoft.

 

Thanks Walter.

0 Kudos
Message 9 of 9
(2,114 Views)