Problems with pdf's

Discussions about PDF management.
Post Reply
nick
Posts: 2
Joined: Tue Jun 23, 2009 12:34 am

Problems with pdf's

Post by nick » Tue Jun 23, 2009 12:51 am

Hi, I'm trying the 6.3.1 dll of gdpicture.net

I have 2 problems : (I tried it with 2 diferent computers)

The general sample not work fine whith my hp c4580 wifi, I see the twain source, I select it, but when I scan in hide mode the scan begin but the picture not appear, if I use the twain interface of the printer it work fine. This work fine with 6.2 dll.

The second problem is creating a pdf, I have a code and the first time, all work fine, the pdf create ok with 1 page, if I execute again the aplication and scan another page, it add to the pdf another page and all work fine, but if I scan two times without stop the execute, the pdf generated the second time have 0 bytes and I can't open it because has no data. I think that I have to download some object but I don't know witch .....

this is part of the code

Code: Select all

        Dim ltemp As String = "C:\_docs\aaa.pdf"
        Dim lnPagAct As Integer
        Dim lImgScan As Integer

        lnPagAct = Me.img.CurrentPage

        Me.img.DisplayFromFile(ltemp)

        Dim lPag As Integer
        Dim lImgUni As New GdPicture.GdPictureImaging

        If lImgUni.TwainGetState < 4 Then lImgUni.TwainOpenDefaultSource(Me.Handle)
        lImgUni.TwainSetErrorMessage((True))
        lImgUni.TwainSetHideUI((True))
        lPag = lImgUni.TwainAcquireToGdPictureImage(Me.Handle)
        lImgUni.TwainCloseSource()
        lImgScan = 1

        Dim lPagTod As Integer
        Dim lPdfTod As Integer
        Dim lImgTod As New GdPicture.GdPictureImaging

        If lPag <> 0 Then

            Dim lI As Integer
            Dim lJ As Integer
            Dim lIimg As Integer = 1

            lPdfTod = lImgTod.PdfNewPdf(ltemp)

            For lI = 1 To Me.img.PageCount + lImgScan

                If lI > lnPagAct And lI <= lImgScan + lnPagAct Then

                    For lJ = 1 To lImgScan

                        lImgTod.PdfAddImageFromGdPictureImage(lPdfTod, lPag)
                        lImgTod.ReleaseGdPictureImage(lPag)

                    Next lJ

                Else

                    lPagTod = Me.img.PdfRenderPageToGdPictureImage(200, lIimg)

                    lImgTod.PdfAddImageFromGdPictureImage(lPdfTod, lPagTod)
                    lImgTod.ReleaseGdPictureImage(lPagTod)
                    lIimg += 1

                End If

            Next lI

            Dim lTotPag As Integer = Me.img.PageCount

            Me.img.CloseDocument()

            For lI = 1 To lTotPag + lImgScan

                lImgTod.PdfNewPage(lPdfTod, lImgTod.PdfGetImageWidth(lPdfTod, lI), lImgTod.PdfGetImageHeight(lPdfTod, lI))
                Call lImgTod.PdfDrawImage(lPdfTod, lI, 0, 0, lImgTod.PdfGetImageWidth(lPdfTod, lI), lImgTod.PdfGetImageHeight(lPdfTod, lI))

            Next lI

            lImgTod.PdfEndPdf(lPdfTod)

        End If

        lPag = Nothing
        lPdfTod = Nothing
        lPagTod = Nothing
        lImgTod = Nothing
        lImgUni = Nothing

        Me.img.DisplayFromFile(ltemp)
Thanks for all and sorry my English

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

Re: Problems with pdf's

Post by Loïc » Thu Jun 25, 2009 10:39 am

Hi,

For your first problem please create a new thread into the TWAIN forum & follow these steps: viewtopic.php?t=1486


For your second one, could you tell me what you are trying to do ? I can't understand your code because there is too many references to undeclared variables & no comments.

With best regards,

Loïc

nick
Posts: 2
Joined: Tue Jun 23, 2009 12:34 am

Re: Problems with pdf's

Post by nick » Sat Jun 27, 2009 11:44 am

Thanks for the answer,

I will try to use another scanner to try if the problem is this hp printer, and I will follow the steps, download the last drivers and more. (I think this is ok with the last driver, sorry I think that a new printer like that has the las driver in the cd)

What I want to do in the code is to add a page to an existing pdf.

I do this: load the pdf to a gdview control, I scan a page, and I save the first pdf adding the page scanned into a pdf temp file.

I think there are simple mode but I'm begining with it.

I use the sample of join 2 pdf's into one.

Another problem I have is that if I read a pdf with 250kb and I create another saving it with gdpicture it has 1300kb, if I decrease dpi it ocuppied less, but never what the original. I read a post that say to use PdfDpiRendering but this not exist in 6 versión?

Thanks for all

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest