Cannot print brochure to correct page size

 I wrote the script below, but no matter what I do, I can't seem to get the output in anything except A4 paper size. The brochure command is through the pdfforge.dll, which I don't see source code for anywhere.

The papersize issues within PDF Creator have been a pain the in the butt for as long as I've been using it (5 years at least). 

A work around may be to print to A4 (two places to change it in printer preferences in the control panel) and then print again, scaling to Letter size.

 

 


 

` ' This always prints to paper size A4, even if PDFCreator is set up to print to`

`' a different size, and even if printing to the alternate size works for`

`' non-brochure printing.`

`
`

`' Apparently, the PDFCreator user interface needs to be open before printing`

`' Otherwise, the action is not performed during printing and it is missing the`

`' next time the UI is opened.`

`Option Explicit`

`
`

`' added to the end of the filename when outputting the brochure`

`Const suffix = "_brochure"`

`
`

`' filenames and other strings`

`Dim ifname, ofname`

`' settings to remember`

`Dim DefaultPrinter, closed`

`' objects`

`Dim objArgs, fso, PDFCreator`

`' script stuff`

`Dim i, AppTitle, Scriptname, ScriptBasename`

` `

`Set fso = CreateObject("Scripting.FileSystemObject")`

`
`

`Scriptname = fso.GetFileName(Wscript.ScriptFullname)`

`ScriptBasename = fso.GetFileName(Wscript.ScriptFullname)`

`
`

`AppTitle = "PDFCreator - " & ScriptBaseName`

`
`

`If CDbl(Replace(WScript.Version,".",",")) < 5.1 then`

` MsgBox "You need the ""Windows Scripting Host version 5.1"" or greater!", _`

` vbCritical + vbSystemModal, AppTitle`

` Wscript.Quit 1`

`End if`

`
`

`Set objArgs = WScript.Arguments`

`If objArgs.Count = 0 Then`

` MsgBox "Syntax: " & vbtab & Scriptname & " " & vbcrlf & _`

` vbtab & "or use ""Drag and Drop""!", _`

` vbExclamation + vbSystemModal, AppTitle`

` WScript.Quit 1`

`End If`

`
`

`' initialize and save some settings`

`Set PDFCreator = Wscript.CreateObject("PDFCreator.clsPDFCreator", "PDFCreator_")`

`PDFCreator.cStart '"/NoProcessingAtStartup"`

`With PDFCreator`

` DefaultPrinter = .cDefaultprinter`

` closed = .cIsClosed`

` `

` .cDefaultprinter = "PDFCreator"`

` `

` ' some attempts at getting the papersize to work... failed`

` .cOption("UseAutosave") = 1`

` .cOption("UseAutosaveDirectory") = 1`

` .cOption("AutosaveFormat") = 0 ' 0 = PDF`

` .cOption("UseFixPapersize") = 1`

` `

` ' The paper size reported changes according to the setting, `

` ' but the brocure function still ignores the setting`

` MsgBox "PaperSize: " & .cOption("Papersize")`

` .cOption("PaperSize") = "letter"`

` MsgBox "PaperSize: " & .cOption("Papersize")`

`
`

` .cSaveOptions `

` .cClearcache`

` .cPrinterStop = false`

`End With`

`
`

`' create the brochures for each input file given`

`For i = 0 to objArgs.Count - 1`

` ifname = objArgs(i)`

` If Not CheckInputFile(ifname) Then Exit For`

` `

` ofname = fso.GetParentFolderName(ifname) & "\\" & _`

` fso.GetBaseName(ifname) & suffix & ".pdf"`

` If Not CheckOutputFile(ofname) Then Exit For`

` `

`MsgBox "Processing brochure... " & vbCrLf & _`

` "  Input: " & vbTab & ifname & vbCrLf & _`

` "  Output:" & vbTab & ofname & vbCrLf`

` CreateBrochure ifname, ofname`

`MsgBox "Processing " & ifname & " done."`

`Next`

`
`

`' clean up PDFCreator and set settings back to their original settings`

`With PDFCreator`

` .cDefaultprinter = DefaultPrinter`

` .cClearCache`

` WScript.Sleep 200`

` If closed then .cClose`

`End With`

`WScript.Quit 0`

`
`

`'-------------------------------------------------------------------------------`

`
`

`Function CheckInputFile (filename)`

` `

` If Not fso.FileExists(filename) Then`

` MsgBox "Can't find the file: " & filename, _`

` vbExclamation + vbSystemModal, AppTitle`

` CheckInputFile = False`

` Exit Function`

` End If`

` `

` Dim ext`

` ext = fso.GetExtensionName(filename)`

` If Ucase(ext) <> "PDF" And Ucase(ext) <> "TMP" Then`

` MsgBox "This script works only with pdf files!" & vbCrLf & _`

` "Extension '" & ext & "' was given.", _`

` vbExclamation + vbSystemModal, AppTitle`

` CheckInputFile = False`

` Exit Function`

` End If`

` `

` CheckInputFile = True`

`End Function`

`
`

`Function CheckOutputFile (filename)`

` Dim vbResponse`

` `

` vbResponse = -1`

` If fso.FileExists(filename) Then`

` vbResponse = MsgBox("The file already exists. Do you want to replace it?" & vbcrlf & vbcrlf & _`

` "File: " & filename, _`

` vbOKCancel, AppTitle)`

` End If`

` `

` If vbResponse = vbCancel Then`

` CheckOutputFile = False`

` Exit Function`

` ElseIf vbResponse = vbOK Then`

` fso.DeleteFile(filename)`

` ' see if it actually got deleted`

` If fso.FileExists(filename) Then`

` MsgBox "The file could not be deleted. Skipping." & vbcrlf & vbcrlf & _`

` "File: " & filename`

` vbResponse = vbCancel`

` End If`

` Else`

` ' file doesn't exist, so we don't need to worry about it`

` End If`

` `

` CheckOutputFile = True`

`End Function`

`
`

`Function CreateBrochure(ifname, ofname)`

` Dim pdf`

` Set pdf = WScript.CreateObject("pdfforge.pdf.pdf")`

` pdf.Brochure ifname, ofname`

` Set pdf = Nothing`

` CreateBrochure = True`

`End Function`

Hi,

 

any solution for this problem? Or a tip, how I can change the page size while creating the brochure?

 

I have PDFs with a format of e.g. 160x230mm. After creating the brochure, the PDF is 297x210mm and the pages are placed on the bottom left. Please help me.

 

Regards

The brochure methode in pdfforge.dll version 2.3.0.0 has been improved. Now you have a lot of page sizes available and you can define your own brochure page size.

It doesn't matter wchich paper format I choose or client client size I set - it always prints on A4 format.

I need 80x60mm labels.

Have you tested the new brochure methods of the new pdfforge.dll?

``` public int Brochure( string sourceFilename, string destinationFilename, float width, float height, int pageAlign )

public int Brochure(
string sourceFilename,
string destinationFilename,
string pageSize,
int pageOrientation,
int pageAlign
)

<p>C# sample</p>

PDF pdf = new PDF();
pdf.CreatePDFTestDocument(“input.pdf”, 16, “This is an example.”, true);
pdf.Brochure(“input.pdf”, “output.pdf”, 297, 210, 1);
pdf = null;

 I was previously in the 1.3 version of PDF creator. Had difficulty printing Microsoft Word document in landscape format into PDF in landscape format.

I read the FAQ about Printer --> Server settings and searched out the printer icon looking for Server settings to no avail. 

Downloaded the 1.4version (initially without the expert settings) and same result. Downloaded the 1.4version again with the expert settings and server installation, thinking it would provide the Server settings. I still do not see this with the print icon.

Additionally, after control print (with print preferences set to landscape), it appears on the bottom bar of Microsoft Word that the PDF is being created and completed, however, the usual PDF Creator in the middle of the page doesn't come up. Also the window with the document name, creation date and author with the save button doesn't pop up.

I'm unsure where the newly created PDF is now to even check if it is now in landscape or still portrait.

For now, it seems that the version 1.4 is rendered not working until I can understand where the "completed" copy is going without triggering the document name, dates, author, etc.