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.0. I thought about getting a SDK software, 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 (and of course assign it to print to a specific location) or will it require a the use of another library to print to PDF? Is there any software on VeryPDF which can do this job?
Answer: According to my understanding, you need to print PDF programmatically from Visual Basic. VeryPDF has software VeryPDF PDFPrint SDK, which can help you print an existing file to PDF programmatically in Visual Basic 2008. And this software is quite easy to use. If you would not like to use the SDK version, there is also command line version available. By this software, during the printing, you need not open the PDF documents to print them and you can easily specify printing options like specify printing page range, specify a printer, call the advanced options dialog of printer, set the printing copies, rescale page size, add watermarks, etc., Please check more detail information of this software on homepage, in the following part, let us check how to use this software.
Step 1. Free download PDFPrint SDK
- This SDK is Window application, now it can not work under Mac and Linux system. When downloading finishes, there will be a zip file. Please extract it to some folder then you can check related elements.
- When you use this software, please refer to the usage and help documents.
Step 2. Print PDF programmatically in Visual Basic.
- The SDK version covers all the functions of command line, so for showing easily now let us check some functions of this software from the parameters. Those parameters are just a slice of this software, please check more on help documents.
- Now let us check how to call this software from ASP code:
-printer <string>: specify printer with printer name
-copies <int>: set printing copies
-paper <string>: set paper size,
-duplex <int>: select duplex or double-sided printing,
-shell2: Alternative way to call default PDF viewer to print PDF
-shelltime <int>: set timeout for shell printing
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"""
nRet = VeryPDF_PDFPrint(strCmd)
Please check more related code templates and parameter on homepage. During the using, if you have any question, please contact us as soon as possible.