Page 1 of 2

SaveDocumentToPDF Issue

Posted: Wed Sep 15, 2021 1:59 am
by bmiller
Hello,

I am trying to save the contents of my GdViewer to a new file in my C:\Users\userid\AppData\... folder using SaveDocumentToPDF Method. I am loading a PDF into the GdViewer, Burning annotations, then saving the GdViewer to a new Output file that does not exist yet.

My code: Status = MyGdViewer.SaveDocumentToPDF(FileOut) is aborting with a status code = 9

I have permissions to write to this folder.

Is there a step that I am missing?

Thank you

Re: SaveDocumentToPDF Issue

Posted: Thu Sep 16, 2021 12:05 pm
by Fabio
Hello there,

This error is mostly due because of insufficient pre-conditions, so the process is aborted.
Does a file has been properly loaded within the viewer? Does the issue is reproducible with the code snippet provided in our documentation?

Here is the link to the code snippet: https://www.gdpicture.com/guides/gdpict ... ring).html

With best,
Fabio

Re: SaveDocumentToPDF Issue

Posted: Fri Sep 17, 2021 12:59 am
by bmiller
Thank you for the suggestion to review your code snippet. Unfortunately, it didn't help me too much.

When I follow my code in VS, The file looks as though it is loaded into the GdViewer. These 2 If statements:

If GdPicturePDF1.LoadFromFile(FileIn, False) = GdPicture14.GdPictureStatus.OK Then
If GdViewer1.DisplayFromGdPicturePDF(GdPicturePDF1) <> GdPicture14.GdPictureStatus.OK Then...

are both OK, so they show that a file is being loaded into the GdViewer.

Is there anything else i need to do before trying to use the GdViewer contents? Will any GdViewer information from my debugger help? I'm not sure what else there is to do or check.

I have included a code snippet below. I appreciate your help and any suggestions you may have.
----------------------------------------------

Code: Select all

Public Class clsProcessPDF

    Private GdViewer1 As GdPicture14.GdViewer
    Private GDPDocumentFormat1 As GdPicture14.DocumentFormat
    Private GdPictureImaging1 As GdPicture14.GdPictureImaging
    Private GdPicturePDF1 As GdPicture14.GdPicturePDF
    Private GDPImageID1 As Integer
    Private FileOut As String

    Public Function ProcessGdPicture(ByVal FileIn As String) As Boolean

    Dim Status As GdPicture14.GdPictureStatus

    GdPictureImaging1 = New GdPicture14.GdPictureImaging
    GDPDocumentFormat1 = GdPictureImaging1.GetDocumentFormatFromFile(FileIn)
    GdViewer1 = New GdPicture14.GdViewer

	If GDPDocumentFormat1 = GdPicture14.DocumentFormat.DocumentFormatPDF Then

        GdPicturePDF1 = New GdPicture14.GdPicturePDF

        If GdPicturePDF1.LoadFromFile(FileIn, False) = GdPicture14.GdPictureStatus.OK Then
            If GdViewer1.DisplayFromGdPicturePDF(GdPicturePDF1) <> GdPicture14.GdPictureStatus.OK Then
                MsgBox("Unable to load GdViewer1")
            End If
        End If
	...
  
    FileOut = "C:\Users\user\AppData\Roaming\Product\fileout.pdf"

    Status = GdViewer1.SaveDocumentToPDF(FileOut)
    If Status <> GdPicture14.GdPictureStatus.OK Then
        'executes abort code always with 9 status code
	...

Re: SaveDocumentToPDF Issue

Posted: Tue Sep 21, 2021 11:37 am
by Fabio
Hello,

I tested your code through a sample ad it seems to work well.
Can you try to implement it on a sample (provided in the "Sample" folder in the installation folder) and tell me if the issue remains?

If you, could you sent a minimalistic sample that reproduces the issue? (without the DLL and the bin/packages/obj/.vs folder)

With best,
Fabio

Re: SaveDocumentToPDF Issue

Posted: Tue Sep 21, 2021 5:20 pm
by bmiller
thank you. I am out of the office this week, but will work on it next week.

Re: SaveDocumentToPDF Issue

Posted: Wed Sep 29, 2021 2:31 am
by bmiller
Hello Fabio,

I have attached a small vb.net program that gets the Abort 9 status on line 46 - Status = MyGdViewer.SaveDocumentToPDF(TemporarySavedFile)

To test, I assume you will create a project in VS, copy the GDPicture files to the bin folder, then edit the attached file. The program requires that you create a PDF like the one in line 19 - FileToProcess = "C:\temp\input.pdf"

also attached is the picture of the project application tab.

If it works as expected (does not abort), can you please send me a listing of your bin folder?

I did not see a sample similar to the code I am using.

Thank you and I look forward to hearing from you.

Brian

Re: SaveDocumentToPDF Issue

Posted: Thu Sep 30, 2021 5:25 pm
by Fabio
Hello,

I reproduced the issue on my side, thanks for the code snippet.
So I created a ticket for the developers to check what it's going on and to handle this issue.

I will keep you updated through this post!

Have a nice day,
Fabio

Re: SaveDocumentToPDF Issue

Posted: Thu Sep 30, 2021 5:41 pm
by bmiller
Thank you, Fabio.

I look forward to a resolution. This is holding up our project.

Re: SaveDocumentToPDF Issue

Posted: Fri Oct 01, 2021 11:04 am
by Fabio
Hello,

The issue has been corrected and will be available on our next minor release. The provided code will work just by updating the SDK.

With best,
Fabio

Re: SaveDocumentToPDF Issue

Posted: Fri Oct 01, 2021 3:44 pm
by bmiller
Great and thank you!

Re: SaveDocumentToPDF Issue

Posted: Fri Oct 01, 2021 3:51 pm
by bmiller
Is the build this one? 14.1.134 September 30 2021

Re: SaveDocumentToPDF Issue

Posted: Tue Oct 05, 2021 9:53 am
by Fabio
Hello,

Yes, it is the 14.1.134!

With best,
Fabio

Re: SaveDocumentToPDF Issue

Posted: Tue Oct 05, 2021 3:32 pm
by bmiller
thanks. I'll start testing it and let you know

Re: SaveDocumentToPDF Issue

Posted: Tue Oct 05, 2021 7:48 pm
by bmiller
Fabio, Could you please test my code snippet against 14.1.134? I am still getting the same error.

I have included screenshots of the Bin Folder contents and my project References.

Re: SaveDocumentToPDF Issue

Posted: Wed Oct 06, 2021 2:32 pm
by Fabio
Hello,

I'm really sorry, both, the resolution and the release have been made on the same day. But the correction was right after the release of the new version!
My bad for this mistake.

The correction will be available on our next release then!

Have a nice day,
Fabio