activex javascript gdpicturepdf on browser web

Discussions about image processing and document imaging.
Post Reply
AndreaCant
Posts: 5
Joined: Wed Mar 02, 2016 11:18 am

activex javascript gdpicturepdf on browser web

Post by AndreaCant » Fri Mar 04, 2016 12:49 pm

Hi!

I've got a webapp already developed in PHP and I'm tring to integrate the gdpicture functionalities following the example https://www.gdpicture.com/demo/html-acti ... ation.html

The requirement are:
- Load a pdf document throught a ftp in a GdViewer and ThumbnailEx in the client browser. No problem with that.
- Apply rotation to a page, then save it on the server. With the GdViewer object i can use Rotate(), but when saving the rotation doesn't apply (I tried also in the original example and the behavior is the same)
- Remove selected page, then save it on the server. The GdViewer obj doesn't have a method for this.

For doing those operation I thought to use GdPicturePDF obj, and I tried to do this in Javascript:

Code: Select all

m_GdPicturePDF = new ActiveXObject("GdPicture12.GdPicturePDF");
The problems I found are two:
  • the activex object "GdPicture12.GdPicturePDF" doesn't exist apparentely (because m_GdPicturePDF is valorized to an empty object)
  • the GdPicturePDF doesn't have a method for load from ftp, nor from the GdViewer object.
A solution is to make those tasks server-side with an aspx, thought, but I prefer not to load that much the server.
So can I accomplish this only with javascript?

Thank you

Cedric
Posts: 269
Joined: Sun Sep 02, 2012 7:30 pm

Re: activex javascript gdpicturepdf on browser web

Post by Cedric » Fri Mar 04, 2016 5:10 pm

Hello,
AndreaCant wrote: - Apply rotation to a page, then save it on the server. With the GdViewer object i can use Rotate(), but when saving the rotation doesn't apply (I tried also in the original example and the behavior is the same)
- Remove selected page, then save it on the server. The GdViewer obj doesn't have a method for this.
GdViewer being just that, a viewer, it won't alter the source document but only the view, so the Rotate method from the GdViewer class only rotates the view of the page and not the page itself.
Of course the same applies for page selection, GdViewer does not contain methods to alter the viewed document.

So your idea is correct, you need to use the GdPicturePDF class to do that, and yes, you should be able do it all using JavaScript.

I confirm that the class exists and the syntax you are using seems correct, I also confirm that GdViewer does have a method to load a document from FTP (and also HTTP and many other sources) but GdPicturePDF doesn't indeed.
The reason why it does not work is to be determined, but one reason could be that the COM registration is not correct or not properly done, you should check that first.

Depending on what your requirements are (document type and location, etc) the ASPX solution would be definitely more practical and flexible.

AndreaCant
Posts: 5
Joined: Wed Mar 02, 2016 11:18 am

Re: activex javascript gdpicturepdf on browser web

Post by AndreaCant » Mon Mar 07, 2016 10:29 am

Thank you very much for you answer, cedric! :D

Now I've another issue (and know another spec): the webapp will be accessable only throught a vpn, so the server files can be loaded throught lan paths like "\\NAS\folder\test.pdf", so I can use the LoadFromFile (and SaveToFile) of GdPicturePDF object and than pass it to the GdViewer, thought.

But I tried to access to lan path (eg. "\\nas\folder\test.pdf") than local path ("D:\folder\test.pdf") and both gave me in the console the SCRIPT5: Invalid procedure call or argument on the LoadFromFile function.
I've searched on google, but I don't found anything that seems to help, could you? :cry:

Thanks

EDIT:
I've got Windows 7 Pro with gdpicture12 (demo version), a colleague tried on windows 10 with the gdpicture11 and gave him no errors.

AndreaCant
Posts: 5
Joined: Wed Mar 02, 2016 11:18 am

Re: activex javascript gdpicturepdf on browser web

Post by AndreaCant » Mon Mar 07, 2016 10:42 am

Found the solution!

I use the method like this:

Code: Select all

m_GdPicturePDF.LoadFromFile('\\\\NAS01\\folder\\subfolder\\test.pdf');
but the right use is to pass the second argument to true (load in memory):

Code: Select all

m_GdPicturePDF.LoadFromFile('\\\\NAS01\\folder\\subfolder\\test.pdf', true);

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests