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.
Print a PDF to printer: how to choose the paper size
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
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
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"
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"
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.
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.