Question: I am trying to print an existing file to PDF programmatically in Visual Basic 2008.Our current relevant assets are: Visual Studio 2008 Professional Adobe Acrobat Professional 8.0I thought about getting a SDK like ITextSharp, but it seem like overkill for what I am trying to do especially since we have the full version of Adobe.Is there a relatively simple bit of code to print to a PDF printer or will it require a the use of another library to print to PDF? Is there any solution I can resort to on VeryPDF to solve this matter?
Answer: According to your needs, maybe you can have a free trial of this software:VeryPDF PDFPrint SDK, by which you can print any printable files to PDF printer programmatically. Meanwhile this SDK software allows you to call the executable file from C#, VB .NET, MS Visual Basic, Borland Delphi, VBA (MS Office products such as Access) and C++ via COM, C and C++ via native C. Please check more information of this software on homepage, in the following part, let us check how to use this software.
Step 1. Free download PDFPrint SDK
- When downloading finishes, there will be an zip file, please extract it to some folder then you can call the executable file in other computer language.
- Please check all the supported input file formats and updated information here.
Step 2. Print files to PDF Printer programmatically.
- When you use this software, please refer to the usage, code templates and examples.
- Here is one example for your reference, this code is an example of calling this software from Visual Basic
Private Sub Command1_Click()
Dim nRet As Long
Dim strCmd As String
strCmd = "pdfprint -$ XXXXXXXXXXXXXXXXXXXX"
strCmd = strCmd & " -printer ""docPrint"""
strCmd = strCmd & " """ & App.Path & "\readme.pdf"""
MsgBox (strCmd)
nRet = VeryPDF_PDFPrint(strCmd)
MsgBox (Str(nRet))
End Sub
Now let us check some parameters which important to print PDF to a printer:
printer settings and/or select pages manually
-printer <string> : printer name to print
-savedevmode <string> : prompt the user with print dialog and save the printer settings into a disk file
-loaddevmode <string> : restore printer settings which saved by -savedevmode parameter
-promptdevmode : prompt the user with print dialog and print the printer settings to screen
-devmode <string> : restore printer settings which outputed by -promptdevmode parameter
-copies <int> : set number of copies to print
-setcopyto : set '-copies' value to printer instead of print it several times
-paper <string> : paper size to printer
pdf : retrieve paper size from PDF file
number : standard paper size
others : user defined paper size
There are too many functions and parameters of this software, I can not list all of them here. During the using, if you have any question, please contact us as soon as possible.