Print a PDF to printer: how to choose the paper size

The Amyuni PDF Converter is our Printer Driver that enables you to convert any documents to PDF format. If you have any questions about installing and using the Amyuni PDF Converter please post them here.
Post Reply
mauribon
Posts: 11
Joined: Mon Oct 18 2004

Print a PDF to printer: how to choose the paper size

Post by mauribon »

Can anyone send me a VB6 code to open, using Amyuni PDF Converter or PDF Creator, a PDF file and print it in the phisical printer and paper size I choose?
For example, I would like, using my VB6 application, to open a PDF file containing 2 pages in A3 landscape, choose the printer and the paper size (A3 landscape or A4 landscape) and print it.
Can anyone help me?
Thank you.
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

Please find here the VB code that opens a pdf file and print it to a physical printer using the PDF Creator.

You can print a pdf to a PDF to a physical printer using the PrintPDFDocument() function

Code: Select all

Private Sub PrintPdf_Click()

On Error GoTo report_error

With CreatorRef
    'Open a file generated by the pdf creator
    .Open App.Path & "\TestFile.pdf", ""
    .SetLicenseKey Licensee, ActivationCode
    'Print the file to the printer
    .ObjectAttribute("Pages[1]", "Landscape") = True
    .Print "HP LaserJet 6L", 0
End With
Exit Sub

report_error:
MsgBox Err.Description

End Sub
mauribon
Posts: 11
Joined: Mon Oct 18 2004

Post by mauribon »

Yes, but the page you print in that way is in A3 or in A4 paper size ?
I would like to choose the paper size before to print it.
Can you help me ?
Thank you.
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

In the above code I am printing whatever page size is the original pdf file.

To set a specific page size you can call:

.ObjectAttribute("Pages[1]", "PaperSize") = 8 '8: A3 as defined by Windows.

For more infomation please check page 116 of the PDF Creator Developers' manual version 3.0, "PDF Creator Developer Manual.pdf"
mauribon
Posts: 11
Joined: Mon Oct 18 2004

Post by mauribon »

Sorry but these commands with my version of PDFCreator (2.01-d) can't work as I want.
If I print a pdf file containing two A3 landscape pages, and set the command to print them in A4 landscape, it prints an A3 sheet with only an A4 area shows on it.
To print this file as I need using PDFCreator interactively I have to do the following steps:
(1) from Document/Document settings/Page Setup set paper size=A3, orientation Landscape, apply to whole document.
(2) from File/Print, options = Fit to paper, tray selection = Manual, in the manual options set paper format=A4, printer tray=Automatic.
Point (1) can be made also using ocx commands, but what about point (2) ? Can I set tray selection = Manual and set paper format=A4 using VB commands ?
I can't find them.
Thank you.
mauribon
Posts: 11
Joined: Mon Oct 18 2004

Post by mauribon »

Excuse me Joan,
have you find anything about my problem ?
Thank you.
Post Reply