GetPDFAConformance

Discussions about PDF management.
Post Reply
lbleicher
Posts: 16
Joined: Fri Nov 04, 2011 4:51 am

GetPDFAConformance

Post by lbleicher » Tue Nov 08, 2011 9:32 pm

Hi-

I am trying to test for PDF/A compliance. With the following code:

Code: Select all

        If InputPDF.LoadFromFile(pdfPath, False) = GdPicture.GdPictureStatus.OK Then
            pgCnt = InputPDF.GetPageCount()
            InputPDF.SetTitle("testTitle")
            titleString = InputPDF.GetTitle()
            conformCode = InputPDF.GetPDFAConformance()
This runs fine until the GetPDFAConformance call. Then I get an error:
Length cannot be less than zero.
Parameter name: length at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
at ឋ.᜜() at DDD_ClassLib.PDF_A.OnProcess(IContext context, IDataRecord data) in C:\Users\lbleicher\Documents\Visual Studio 2010\Projects\DDD_ClassLib\DDD_ClassLib\Class1.vb:line 588 at ComponentProxy.OnProcessProxy(Int64 contextRaw, Int64 dataRecordRaw)

Anyone know what is causing this?

The PDF being used is created by GdPicture in an earlier step:

Code: Select all

   executedGdPCmd = OutputPDF.NewPDF(True)

        'get some info about the document
        If InputPDF.LoadFromFile(pdfPath, False) = GdPicture.GdPictureStatus.OK Then
            For i As Integer = 1 To InputPDF.GetPageCount()
                InputPDF.SelectPage(i)
                pageImages = InputPDF.GetPageImageCount()
                If pageImages = 1 Then
                    curPageName = InputPDF.GetPageImageResName(1)
                    curPageImage = InputPDF.ExtractPageImage(1)
                    inPgPD = myPage.GetBitDepth(curPageImage)
                    inPgHP = myPage.GetHeight(curPageImage)
                    inPgHI = myPage.GetHeightInches(curPageImage)
                    inPgWP = myPage.GetWidth(curPageImage)
                    inPgWI = myPage.GetWidthInches(curPageImage)
                    myPage.ReleaseGdPictureImage(curPageImage)

                    hDPI = inPgHP / inPgHI
                    wDPI = inPgWP / inPgWI
                    curDPI = System.Math.Max(hDPI, wDPI)

                    newDPI = System.Math.Min(curDPI, 150)
                Else
                    newDPI = 150
                End If
                rastPage = InputPDF.RenderPageToGdPictureImage(newDPI, False)
                executedGdPCmd = myPage.ConvertTo1Bpp(rastPage)

                Dim image_res_name As String = OutputPDF.AddImageFromGdPictureImage(rastPage, False, False)
                myPage.ReleaseGdPictureImage(rastPage)
                'InputPDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
                OutputPDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitInch)
                OutputPDF.NewPage(inPgWI, inPgHI)
                OutputPDF.SelectPage(i)
                OutputPDF.DrawImage(image_res_name, 0, 0, inPgWI, inPgHI)
            Next i
            OutputPDF.SaveToFile(OutputFilePath)
        Else
            'report out reason for problem.
            Dim errCode As Integer = InputPDF.GetStat()
        End If
        InputPDF.CloseDocument()
        OutputPDF.CloseDocument()
And the GetPDFAConformance call can be successfully executed on the PDF used as input in that earlier step; so it seems something I am doing (or not doing) to the new PDF generated (OutputPDF) causes the error in the GetPDFAConformance call.

Help?

Thanks,
Leo

lbleicher
Posts: 16
Joined: Fri Nov 04, 2011 4:51 am

Re: GetPDFAConformance

Post by lbleicher » Tue Nov 08, 2011 10:23 pm

I see Loic just posted the answer...

viewtopic.php?t=3409

Thanks.
Leo

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

Re: GetPDFAConformance

Post by Loïc » Thu Nov 10, 2011 11:26 am

Hi Leo,

GdPicture.NET 8.4.3 has been released with a fix for this problem.

Kind regards,

Loïc

Post Reply

Who is online

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