Converting a multiple-page PDF to a single image via a .NET application

Question:I'm attempting to convert a PDF into a single image using GhostScript.Only the first page is converted, while my intention is to generate a horrendously tall PNG/JPG image with all the pages concatenated together. Is it possible to concatenate all the pages together via a .NET on VeryPDF? Or should I resort to an external method?

Answer: According to your needs, I suggest that you can convert multipage PDF file to a single image of tiff file. As PNG/JPG image property, you can not convert multipage PDF to one png file expect you stitch multipage PDF to one page and the convert big page PDF file to one page .png image file.  In this article, I will show you how to convert multipage PDF to single tiff image file. In the next article, I will show you how to convert multipage PDF to one .png image file. 

Step 1. Download PDF to Image Converter COM

  • Before downloading, you can know a little bit more about PDF to Image Converter COM on homepage.
  • When downloading finishes, there will be a zip file. You need to extract it to some folder then you can check code template and executable file. There are many code templates for C#, VB .NET, J# via .NET, C, C++ via native C and others.

Step 2. Convert PDF to image from VB.NET

  • Here is one example of converting PDF to image from VB.NET, please have a check.

Public Class PDF2ImageConverter
    Private Declare Function PDFToImageConverter Lib "pdf2image.dll" _
        (ByVal szPDFFileName As String, ByVal szOutputName As String, _
        ByVal szUserPassword As String, ByVal szOwnPassword As String, _
        ByVal xresolution As Integer, ByVal yresolution As Integer, ByVal bitcount As Integer, _
        ByVal compression As Integer, ByVal quality As Integer, ByVal grayscale As Integer, _
        ByVal multipage As Integer, ByVal firstPage As Integer, ByVal lastPage As Integer) As Integer
    Public Enum CompressionType
        COMPRESSION_NONE = 1 '/* dump mode */
        COMPRESSION_CCITTRLE = 2 '/* CCITT modified Huffman RLE */
        COMPRESSION_CCITTFAX3 = 3 '/* CCITT Group 3 fax encoding */
        COMPRESSION_CCITTFAX4 = 4 '/* CCITT Group 4 fax encoding */
        COMPRESSION_LZW = 5 '/* Lempel-Ziv & Welch */
        COMPRESSION_JPEG = 7 '/* JPEG DCT compression */
        COMPRESSION_PACKBITS = 32773 '/* Macintosh RLE */
    End Enum
    Public Sub New()
    End Sub
    Public Function ConvertPDFToImage(ByVal strInputPDF As String, ByVal strOutputImage As String, _
        ByVal strUsername As String, ByVal strPassword As String, _
        ByVal lngXDPI As Long, ByVal lngYDPI As Long, ByVal lngBitCount As Long, _
        ByVal enumCompression As CompressionType, ByVal lngQuality As Long, _
        ByVal blnGreyscale As Boolean, ByVal blnMultipage As Boolean, _
        ByVal lngFirstPage As Long, ByVal lngLastPage As Long) As Long
        ConvertPDFToImage = PDFToImageConverter(strInputPDF, strOutputImage, strUsername, strPassword, _
            lngXDPI, lngYDPI, lngBitCount, enumCompression, lngQuality, blnGreyscale, _
            blnMultipage, lngFirstPage, lngLastPage)
    End Function
End Class

The above code can not be used to convert multipage PDF to one page tiff directly, but you can use the above code for reference. 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!