GenericError result when attempting to SwapPages()

Discussions about PDF management.
Post Reply
Fletch
Posts: 2
Joined: Thu Nov 18, 2021 11:42 pm

GenericError result when attempting to SwapPages()

Post by Fletch » Thu Nov 18, 2021 11:50 pm

I'm trying to call SwapPages, and keep getting a GenericError result.

The document, a PDF, is four pages long, although I've tried other, larger ones and the issue is the same.

I'm calling it like this:

Code: Select all

result = gdPicturePdf.SwapPages(1,4);
Every time, no matter the document, nothing happens and I get "GenericError" as the response.

I've verified that the document pagecount is 4; and it is being displayed properly in the viewer.

Any help is greatly appreciated!

Fletch

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

Re: GenericError result when attempting to SwapPages()

Post by Fabio » Fri Nov 19, 2021 5:30 pm

Hello Fletch,

I just tested the method and everything went fine.
I used the code snippet in our documentation here: https://www.gdpicture.com/guides/gdpict ... Pages.html

If you got an issue with the code snippet, could you try to install the new version of GdPicture and test it again, please?

With best,
Fabio

Fletch
Posts: 2
Joined: Thu Nov 18, 2021 11:42 pm

Re: GenericError result when attempting to SwapPages()

Post by Fletch » Fri Nov 19, 2021 8:44 pm

Hello Fabio,

I think I found the issue. In this app I'm working on (inherited from someone else, so I have a learning curve!), they are using gdPicture.DisplayFromFile(), which apparently doesn't load the file in such a way that you can do things like SwapPages(). It appears that I need to use LoadFromFile() instead.

Is there a place I can read about the proper usage of these methods?

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

Re: GenericError result when attempting to SwapPages()

Post by Fabio » Wed Nov 24, 2021 4:22 pm

Hello,

I'm not sure to understand, are we talking about the GdPicturePDF or GdViewer class here?
The best practice is to load your file within a GdPicturePDF object and use it for the SwapPages method or PDF manipulations.
Once the swap has been done, you can use the DisplayFromFile method with the GdViewer object to display the modified document.

With best,
fabio

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest