I'm using PDF Creator's API to generate PDF files of SolidWorks drawings. Since the drawings can be of various sizes, I'm trying to set the output paper size, but have not had much success.
Can anyone tell me the format of the values for the .Papersize property? No matter what I set, it seems to stay at A4.
Specifically, I would like to set the paper size to Letter, Tabloid, ANSI C, ANSI D or ANSI E.
I see from the following link that the default value of this property is 'a4', and in fact the papersize always defaults back to a4 after running PDF Creator (via the API) even if I set .Papersize to, say, "Letter".
I think there is an issue with PDFCreator and paper sizes.
Nota bene - From Excelguru.ca, there are a few points on using PDF Creator.
http://www.excelguru.ca/node/33
I've tried setting the paper size as done via Excelguru, but also looked into setting the papersize via the Printer object (code below). Unfortunately, when I run this code, the paper size on the printer (according to the debug.print statements) *does* change from A4 to Letter (9 to 1), but the paper size does not when looking at PDFCreator from the Printers And Faxes - PDFCreator - Printer - Properties - Printing Preferences - Advanced button. The 'Paper/Output' paper size still remains at A4. Grrrr.
This was written for VB6, BTW...
Dim p As Printer
Dim OldPrinter As String
For Each p In Printers If p.DeviceName = "PDFCreator" Then 'or whatever the printer name is... 'Save the old printer reference and create a new one. OldPrinter = Printer.DeviceName Set Printer = p End If Next p
debug.print Printer.PaperSize
' Add to ensure paper size is correct Printer.PaperSize = vbPRPSLetter
debug.print Printer.PaperSize
Dim pdfjob As PDFCreator.clsPDFCreator
'Check if PDFCreator is already running and attempt to kill the process if so Do bRestart = False Set pdfjob = New PDFCreator.clsPDFCreator If pdfjob.cStart("/NoProcessingAtStartup") = False Then 'PDF Creator is already running. Kill the existing process Shell "taskkill /f /im PDFCreator.exe", vbHide DoEvents Set pdfjob = Nothing bRestart = True End If Loop Until bRestart = False
With pdfjob .cVisible = False .cOption("PaperSize") = "Letter" End With