Loading...

Convert PDF to Multipage CCITT4 TIFF image

Example requests & Code samples for GdPicture.NET Toolkits.

Convert PDF to Multipage CCITT4 TIFF image

Postby 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
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4430
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: Convert PDF to Multipage CCITT4 TIFF image

Postby kketterman » Mon Apr 27, 2009 4:50 pm

Thank you, this works wonderfully.
User avatar
kketterman
 
Posts: 33
Joined: Tue Apr 21, 2009 6:55 pm

Re: Convert PDF to Multipage CCITT4 TIFF image

Postby 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?
PatNalen
 
Posts: 1
Joined: Mon Oct 12, 2009 5:39 pm

Re: Convert PDF to Multipage CCITT4 TIFF image

Postby 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: gdpicture-activex-code-samples/convert-from-pdf-multipage-tiff-jpeg-t314.html

Kind regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4430
Joined: Tue Oct 17, 2006 10:48 pm
Location: France


Return to Example requests & Code samples For GdPicture.NET

Who is online

Users browsing this forum: No registered users and 0 guests