Convert PDF to Multipage CCITT4 TIFF image

Example requests & Code samples for GdPicture Toolkits.
Post Reply
User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Convert PDF to Multipage CCITT4 TIFF image

Post by Loïc » Mon Apr 27, 2009 3:41 pm

Here a simple way to convert a PDF to Multipage CCITT4 TIFF image (1 bpp image). To keep image color just use another compression scheme and remove the call to ConvertTo1bpp.

Code: Select all

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim GdViewer1 As New GdPicture.GdViewer
        Dim oGdPictureImaging As New GdPicture.GdPictureImaging
        Dim ImageID As Integer
        Dim TiffImageID As Integer


        oGdPictureImaging.SetLicenseNumber("XXX")
        GdViewer1.DisplayFromFile("")

        If GdViewer1.GetDocumentType = DocumentType.DocumentTypePDF Then
            For I As Integer = 1 To GdViewer1.PageCount
                ImageID = GdViewer1.PdfRenderPageToGdPictureImage(200, I)

                oGdPictureImaging.ConvertTo1Bpp(ImageID)

                If I = 1 Then
                    TiffImageID = ImageID
                    oGdPictureImaging.TiffSaveAsMultiPageFile(TiffImageID, "c:\output.tif", TiffCompression.TiffCompressionCCITT4)
                Else
                    oGdPictureImaging.TiffAddToMultiPageFile(TiffImageID, ImageID)
                    oGdPictureImaging.ReleaseGdPictureImage(ImageID)
                End If

            Next I
            oGdPictureImaging.TiffCloseMultiPageFile(TiffImageID)
        End If

        GdViewer1.CloseDocument()
    End Sub

User avatar
kketterman
Posts: 32
Joined: Tue Apr 21, 2009 6:55 pm

Re: Convert PDF to Multipage CCITT4 TIFF image

Post by kketterman » Mon Apr 27, 2009 4:50 pm

Thank you, this works wonderfully.

PatNalen
Posts: 1
Joined: Mon Oct 12, 2009 5:39 pm

Re: Convert PDF to Multipage CCITT4 TIFF image

Post by PatNalen » Tue Oct 13, 2009 12:21 am

Trying your code but can't find method of oGdViewer you are using - PdfRenderPageToGdPictureImage. I don't have that method.

Also in my version, the Tiff Save method is called "TiffSaveMultiPageToFile" - yours is slightly different "TiffSaveAsMultiPageFile" - is that a typo or are we looking at different versions?

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Convert PDF to Multipage CCITT4 TIFF image

Post by Loïc » Tue Oct 13, 2009 9:45 am

Hi,

You are in the GdPicture.NET section. I suppose you are using the ActiveX. So, Have a look on this thread: viewtopic.php?t=314

Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest