Can a PDF be converted to a raster image format that can be printed from .VB?

Question:We want to be able to print embed those PDF files directly into the print stream so they don't need pre-printed paper, so we need to convert PDF to raster image first. However, there aren't really any good options for rendering a PDF to a raster image. Is there a raster format the PDF could be converted to by some external program without being degraded considering the embedded fonts problem? Is there any solution on VeryPDF?

Answer: According to your needs, you need to print PDF to raster image first and then run the printing process from VB process. If I understand you right, maybe you can have a free trial of this software:VeryPDF PDFPrint Command Line, by which you can print PDF to raster image before printing. And this SDK version software allows you to call it together with other applications include VB like C#, .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, I will show you how to use this software.

Step 1. Free download PDFPrint SDK

  • By the SDK version, you can integrate the corresponding SOFTWARE into your developed software and redistribute it with royalty-free.
  • When downloading finishes, you will find it is a zip file. You need to extract it to some folder then you can call it normally from VB.

Step 2.  Convert PDF with embedded fonts to raster image and then print PDF.

  • When converting  PDF to raster image first and then print it, you may need to use the following parameters:
  • -raster                      : render PDF page to image before printing
    -raster2                     : render PDF page to image before printing
    -raster2center          : center the printout when use -raster2
    -rasterbitcount <int>: set bitcount for raster image, e.g., 1, 8, 24
    -rasterbwtext           : disable halftone for color text, for -raster2 only
    -preproc                     : process PDF file before printing, useful for some damaged PDF files
    Here are some command line templates:
    pdfprint.exe -raster C:\input.pdf
    pdfprint.exe -raster2 -rasterbitcount 1 C:\input.pdf
    pdfprint.exe -raster2 -rasterbwtext -rasterbitcount 1 -xres 600 -yres 600 C:\input.pdf

  • When you need to convert PDF to raster and then print it from VB, please refer to the following code template:
  • Private Sub Command1_Click()
       Dim nRet As Long
       Dim strCmd As String

       strCmd = "pdfprint -$ XXXXXXXXXXXXXXXXXXXX"
       strCmd = strCmd & " -raster2 -rasterbwtext -rasterbitcount 1 """
       strCmd = strCmd & " """ & C:\input.pdf"""

        MsgBox (strCmd)
        nRet = VeryPDF_PDFPrint(strCmd)
        MsgBox (Str(nRet))

    End Sub

By this method, you can convert PDF files which can not be printed normally. During the using, if you have any question, please contact us as soon as possible.

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Verify Code   If you cannot see the CheckCode image,please refresh the page again!