pdf to multipage tiff and jpeg compression

Discussions about PDF management.
sbarlow
Posts: 33
Joined: Fri Jun 19, 2009 3:13 pm

pdf to multipage tiff and jpeg compression

Post by sbarlow » Tue Jun 30, 2009 4:16 pm

I'm getting a generic GDI+ exception when trying to create a multipage tiff file from PDFs . It happens on

oGdPictureImaging.TiffAddToMultiPageFile(TiffImageID, imageid). I'm using the latest build from the site (6.3.0.1) for framework 2

Code: Select all

Public Function pdftomultipagetiff2() As Boolean
        Dim imageid As Long
        Dim TiffImageID As Long
        oGdViewer.DisplayFromFile(sInFilename)

        If oGdViewer.GetDocumentType = GdPicture.DocumentType.DocumentTypePDF Then
            For I As Integer = 1 To oGdViewer.PageCount
                imageid = oGdViewer.PdfRenderPageToGdPictureImage(200, I)

                If I = 1 Then

                    TiffImageID = imageid
                    oGdPictureImaging.TiffSaveAsMultiPageFile(TiffImageID, "c:\output.tif", GdPicture.TiffCompression.TiffCompressionJPEG)
                Else

                    oGdPictureImaging.TiffAddToMultiPageFile(TiffImageID, imageid)
                    oGdPictureImaging.ReleaseGdPictureImage(imageid)
                End If

            Next I
            oGdPictureImaging.TiffCloseMultiPageFile(TiffImageID)
        End If


    End Function

End Class

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

Re: pdf to multipage tiff and jpeg compression

Post by Loïc » Tue Jun 30, 2009 4:49 pm

Hi,

The JPEG compression is currently unsupported by this method. You need to use another compression scheme to fix your error.

With best regards,

Loïc

sbarlow
Posts: 33
Joined: Fri Jun 19, 2009 3:13 pm

Re: pdf to multipage tiff and jpeg compression

Post by sbarlow » Tue Jun 30, 2009 5:00 pm

Ok no problem... So i thought I would just ouptut them with no compression to single page files, but they are now comming out with LZW instead of none

Code: Select all

  Public Function pdftomultipagetiff2() As Boolean
        Dim imageid As Long
        oGdViewer.DisplayFromFile(sInFilename)

        If oGdViewer.GetDocumentType = GdPicture.DocumentType.DocumentTypePDF Then
            For I As Integer = 1 To oGdViewer.PageCount
                imageid = oGdViewer.PdfRenderPageToGdPictureImage(300, I)
                oGdPictureImaging.SaveAsTIFF(imageid, "d:\tempimages\" & I.ToString & ".tif", GdPicture.TiffCompression.TiffCompressionNONE)
                oGdPictureImaging.ReleaseGdPictureImage(imageid)
            Next I

        End If

End Function

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

Re: pdf to multipage tiff and jpeg compression

Post by Loïc » Tue Jun 30, 2009 5:12 pm

Hi,

This problem will be solved within the next release (within 24 hours).

kind regards,

Loïc

sbarlow
Posts: 33
Joined: Fri Jun 19, 2009 3:13 pm

Re: pdf to multipage tiff and jpeg compression

Post by sbarlow » Thu Jul 02, 2009 4:36 pm

With the last release(6.3.2) they are still comming out LZW.

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

Re: pdf to multipage tiff and jpeg compression

Post by Loïc » Thu Jul 02, 2009 5:32 pm

Hi,

Not for me.

Ensure yourself to link your project to the latest edition & check you are using GdPicture.TiffCompression.TiffCompressionNONE for compression.

Kind regards,

Loïc

sbarlow
Posts: 33
Joined: Fri Jun 19, 2009 3:13 pm

Re: pdf to multipage tiff and jpeg compression

Post by sbarlow » Thu Jul 02, 2009 6:27 pm

I just rechecked all my links, i'm linked to the latest, Weird.

It is still outputting LZW, these were images derived from a PDF but that should not matter right?

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

Re: pdf to multipage tiff and jpeg compression

Post by Loïc » Fri Jul 03, 2009 11:24 am

Hi,

Here what I done:

- Start a new vb.net project
- Add reference to the last GdPicture.NET edition
- Add this function:

Code: Select all

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim imageid As Integer
        Dim TiffImageID As Integer
        Dim GdViewer1 As New GdViewer
        Dim oGdPictureImaging As New GdPictureImaging

        GdViewer1.DisplayFromFile("")

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

                If I = 1 Then

                    TiffImageID = imageid
                    oGdPictureImaging.TiffSaveAsMultiPageFile(TiffImageID, "c:\output2.tif", GdPicture.TiffCompression.TiffCompressionNONE)
                Else

                    oGdPictureImaging.TiffAddToMultiPageFile(TiffImageID, imageid)
                    oGdPictureImaging.ReleaseGdPictureImage(imageid)
                End If

            Next I
            oGdPictureImaging.TiffCloseMultiPageFile(TiffImageID)
        End If

    End Sub

If your problem persists, try to reproduce it in a standalone application.

Kind regards,

Loïc

sbarlow
Posts: 33
Joined: Fri Jun 19, 2009 3:13 pm

Re: pdf to multipage tiff and jpeg compression

Post by sbarlow » Mon Jul 06, 2009 3:51 pm

I've re-downloaded the latest gdpicture.net, created a new app using your code from the last post, and I've also used the resulting executable on a different pc (windows 2000)

Both my development PC (vista) and the other still show the resulting multipage tiff as LZW compressed. Libtiff tiffinfo produces the following (all pages are the same)

TIFF Directory at offset 0xe402a
Subfile Type: (0 = 0x0)
Image Width: 1707 Image Length: 2197
Resolution: 200, 200 pixels/inch
Bits/Sample: 8
Compression Scheme: LZW
Photometric Interpretation: RGB color
Extra Samples: 1<unassoc-alpha>
Samples/Pixel: 4
Rows/Strip: 1
Planar Configuration: single image plane
Predictor: none 1 (0x1)

Could I be missing a dependency, anything ?

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

Re: pdf to multipage tiff and jpeg compression

Post by Loïc » Mon Jul 06, 2009 3:59 pm

Hi,

Please zip and attach here the application including all files (bin & obj folders).

Kind regards,

Loïc

sbarlow
Posts: 33
Joined: Fri Jun 19, 2009 3:13 pm

Re: pdf to multipage tiff and jpeg compression

Post by sbarlow » Mon Jul 06, 2009 4:12 pm

Loïc, since the attachements only allow up to 2 MB here, may I send you a zip of the entire project instead, email ~ 5MB

Thanks,

Scott

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

Re: pdf to multipage tiff and jpeg compression

Post by Loïc » Mon Jul 06, 2009 4:14 pm

Hi Scott.

I am sorry, I forgot this limitation.

Please send your file at loic.carrere (at) gmail (dot) com
Please, change the file extension to ".dummy"

Kind regards,

Loïc

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

Re: pdf to multipage tiff and jpeg compression

Post by Loïc » Mon Jul 06, 2009 4:49 pm

Hi Scott,

I got your mail I found a problem with the "no compression" scheme.

Please, wait for the next release (within 3 days) to get this problem fixed.

With best regards,

Loïc

sbarlow
Posts: 33
Joined: Fri Jun 19, 2009 3:13 pm

Re: pdf to multipage tiff and jpeg compression

Post by sbarlow » Mon Jul 06, 2009 4:52 pm

Cool, thanks Loic, I was starting to think I had a serious reference issue with my dev environment.

Scott

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

Re: pdf to multipage tiff and jpeg compression

Post by Loïc » Mon Jul 06, 2009 5:07 pm

In fact it was a reference issue...

.. But on my test computer :oops:

Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest