SaveDocumentToPDF Issue

Discussions about PDF management.
bmiller
Posts: 15
Joined: Wed Sep 08, 2021 8:28 pm

SaveDocumentToPDF Issue

Post by bmiller » Wed Sep 15, 2021 1:59 am

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

User avatar
Fabio
Posts: 173
Joined: Thu Aug 27, 2020 9:57 am

Re: SaveDocumentToPDF Issue

Post by Fabio » Thu Sep 16, 2021 12:05 pm

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

bmiller
Posts: 15
Joined: Wed Sep 08, 2021 8:28 pm

Re: SaveDocumentToPDF Issue

Post by bmiller » Fri Sep 17, 2021 12:59 am

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
	...

User avatar
Fabio
Posts: 173
Joined: Thu Aug 27, 2020 9:57 am

Re: SaveDocumentToPDF Issue

Post by Fabio » Tue Sep 21, 2021 11:37 am

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

bmiller
Posts: 15
Joined: Wed Sep 08, 2021 8:28 pm

Re: SaveDocumentToPDF Issue

Post by bmiller » Tue Sep 21, 2021 5:20 pm

thank you. I am out of the office this week, but will work on it next week.

bmiller
Posts: 15
Joined: Wed Sep 08, 2021 8:28 pm

Re: SaveDocumentToPDF Issue

Post by bmiller » Wed Sep 29, 2021 2:31 am

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
Attachments
testpgm.zip
(24.25 KiB) Downloaded 456 times
Annotate project.png

User avatar
Fabio
Posts: 173
Joined: Thu Aug 27, 2020 9:57 am

Re: SaveDocumentToPDF Issue

Post by Fabio » Thu Sep 30, 2021 5:25 pm

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

bmiller
Posts: 15
Joined: Wed Sep 08, 2021 8:28 pm

Re: SaveDocumentToPDF Issue

Post by bmiller » Thu Sep 30, 2021 5:41 pm

Thank you, Fabio.

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

User avatar
Fabio
Posts: 173
Joined: Thu Aug 27, 2020 9:57 am

Re: SaveDocumentToPDF Issue

Post by Fabio » Fri Oct 01, 2021 11:04 am

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

bmiller
Posts: 15
Joined: Wed Sep 08, 2021 8:28 pm

Re: SaveDocumentToPDF Issue

Post by bmiller » Fri Oct 01, 2021 3:44 pm

Great and thank you!

bmiller
Posts: 15
Joined: Wed Sep 08, 2021 8:28 pm

Re: SaveDocumentToPDF Issue

Post by bmiller » Fri Oct 01, 2021 3:51 pm

Is the build this one? 14.1.134 September 30 2021

User avatar
Fabio
Posts: 173
Joined: Thu Aug 27, 2020 9:57 am

Re: SaveDocumentToPDF Issue

Post by Fabio » Tue Oct 05, 2021 9:53 am

Hello,

Yes, it is the 14.1.134!

With best,
Fabio

bmiller
Posts: 15
Joined: Wed Sep 08, 2021 8:28 pm

Re: SaveDocumentToPDF Issue

Post by bmiller » Tue Oct 05, 2021 3:32 pm

thanks. I'll start testing it and let you know

bmiller
Posts: 15
Joined: Wed Sep 08, 2021 8:28 pm

Re: SaveDocumentToPDF Issue

Post by bmiller » Tue Oct 05, 2021 7:48 pm

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.
Attachments
DDAnnotate Project References.png
DDAnnotate Bin Folder.png

User avatar
Fabio
Posts: 173
Joined: Thu Aug 27, 2020 9:57 am

Re: SaveDocumentToPDF Issue

Post by Fabio » Wed Oct 06, 2021 2:32 pm

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

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest