Problem making Thumbnail of PDF

Discussions about document viewing.
Post Reply
RobertHorn
Posts: 14
Joined: Fri Jan 20, 2012 8:18 am

Problem making Thumbnail of PDF

Post by RobertHorn » Thu Feb 16, 2012 11:11 am

Hi,

I have a PDF that I am having problems with. It opens find in the Image Viewer, but when I try run the following command I get an error:

ImageID = ImageViewer.GetPageThumbnail(826, 1169, 3, Color.White)

The error is

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Looks like it has a problem where there are loads of pictures on the page.

Can you let me know how I can get around this, because it crashes the whole app.

Here is the link to the PDF:

http://www.linhorn.co.za/Downloads/ProblemPDF.pdf

Regards
Robert

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

Re: Problem making Thumbnail of PDF

Post by Loïc » Thu Feb 16, 2012 11:30 am

Hello When I click on your link I have an error:
404 Not Found

Apologies, but the page you requested could not be found. Perhaps searching will help.
You can attach the document to this thread by zipping it.

Kind regards,

Loïc

RobertHorn
Posts: 14
Joined: Fri Jan 20, 2012 8:18 am

Re: Problem making Thumbnail of PDF

Post by RobertHorn » Thu Feb 16, 2012 3:58 pm

OK. Attached is the zip of the file.
Attachments
ProblemPDF.zip
(824.74 KiB) Downloaded 353 times

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

Re: Problem making Thumbnail of PDF

Post by Loïc » Thu Feb 16, 2012 4:06 pm

Hello,

I've ran your line of code without any problem by using the latest version.

So if the problem persists please ensure to have the latest available version and provide us more information to reproduce the problem.

Kind regards,

Loïc

RobertHorn
Posts: 14
Joined: Fri Jan 20, 2012 8:18 am

Re: Problem making Thumbnail of PDF

Post by RobertHorn » Fri Feb 17, 2012 9:36 am

Hi Loic,

OK. I found the problem. The problem is with .NET Framework 4. I took your VB Document Viewer sample application and added the following code:

Code: Select all

        Dim b As Integer
        Dim NewImageID As Integer
        Dim ImageViewerPages As Integer

        ImageViewer.DisplayFromFile("C:\Temp\PDF.PDF")
        ImageViewer.DocumentPosition = GdPicture.ViewerDocumentPosition.DocumentPositionMiddleCenter
        ImageViewer.ZoomMode = GdPicture.ViewerZoomMode.ZoomModeWidthViewer
        Application.DoEvents()

        ImageViewerPages = ImageViewer.PageCount

        For b = 1 To ImageViewer.PageCount
            'Create an image of the file
            Dim oGdPictureImaging As New GdPicture.GdPictureImaging
            Try
                NewImageID = ImageViewer.GetPageThumbnail(826, 1169, b, Color.White)
            Catch ex As Exception
                NewImageID = 0
            End Try
            If NewImageID <> 0 Then
                If Not oGdPictureImaging.IsBlank(NewImageID, 99.9) Then

                End If
                oGdPictureImaging.SaveAsPNG(NewImageID, "C:Temp\" & b & ".png")
                oGdPictureImaging.ReleaseGdPictureImage(NewImageID)
            Else
                NewImageID = 0
            End If
        Next
This is exactly the code I use in my application. This works in your application, but not in mine. I then changed the compile option of the project to Microsoft.NET Version 4, and it brings up the error.

I did download the latest version of GDPicture, and it is doing this in the latest version.

Regards
Robert

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

Re: Problem making Thumbnail of PDF

Post by Loïc » Fri Feb 17, 2012 5:13 pm

Hello,

This is working fine for me with any Framework.
Could you attach the project of the demo application ? Please don't forget to remove the license key.

Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest