How to save Selected PDF in serverside event?

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

muralidhar
User
Posts: 46
Joined: Tue Nov 30, 2010 9:07 am

How to save Selected PDF in serverside event?

Post by muralidhar »

Hi,

i want to save pdf on serverside event to a specific location on the server.

what exactly i want to do is, when user selects a pdf file it will be displayed in xchange pdf viewer. we are loading the image from javascript. after doing that, user enters some value related to that pdf. then user clicks on a button to save all these details along with the file loaded in viewer.

and while loading the file into viewer i want to display the whole page in viewer without any scroll bars. i mean when we set zoom to fitwidth then page width is set to the viewer width. in the same i want to set both width and height.

how to do these.

please help me. its an urgent requirment.

Regards,
Muralidhar.
Regards,
Muralidhar.
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: How to save Selected PDF in serverside event?

Post by Corwin - Tracker Sup »

Hi Muralidhar,

I'm afraid, that I do not fully understood how exactly you want to use Viewer ActiveX. Should it be opened in web page on client side, or only on server side?
muralidhar
User
Posts: 46
Joined: Tue Nov 30, 2010 9:07 am

Re: How to save Selected PDF in serverside event?

Post by muralidhar »

Hi,

thanks for the reply.

what we are doing is, we provided a button called "import". when user clicks on this button, file browse window of viewer control is called from javascript. after user selects a file it will be loade d in viewer. and there will be some textboxes where user will key in some data related to selected file(for eg., if invoice copy is selected, then invoice details are entered). upto know there is no serverside interaction.
fianlly when user clicks on save button we want to save all the entered details in to db and also to save pdf selected by the user in server (to specific location in website virtual directory).

i think this is clear.
please help me in this regard.

Regards,
Muralidhar.
Regards,
Muralidhar.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19885
Joined: Mon Jan 12, 2009 8:07 am

Re: How to save Selected PDF in serverside event?

Post by Stefan - PDF-XChange »

Hello muralidhar,

It is still not clear whether you are providing this button in a stand alone application that the user has on his machine, or in a browser control, but in any case you can get all comments and form fields data (provided there are any form fields in that particular PDF) and store the resulting files in your database, and then you just need to use the Viewer Save command to store the file with the changes to either a destination location with a name that you specify or to a Stream Object which you can then control further.

Also you need to set ShowScrollBars to 0 (default 1) to hide the scrollbars for the given document.

Code: Select all

SetProperty(Documents[#4567].View.ShowScrollBars, "0", 0)
Best,
Stefan
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: How to save Selected PDF in serverside event?

Post by Corwin - Tracker Sup »

Hello Muralidhar,

Viewer SDK doesn't provide any methods for uploading PDF to server, so this should be done with your own code or if you also use our PDF-Tools SDK as well there are methods there 'post' externally etc in the 'netlib' library options.
muralidhar
User
Posts: 46
Joined: Tue Nov 30, 2010 9:07 am

Re: How to save Selected PDF in serverside event?

Post by muralidhar »

Hi,

can you please provide any sample code to post file using pdf tools sdk.

thanks in advance
Regards,
Muralidhar.
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: How to save Selected PDF in serverside event?

Post by Corwin - Tracker Sup »

Hello,

It will be better if you ask this question in PDF-Tools SDK forum:
https://forum.pdf-xchange.com/ ... m.php?f=44
muralidhar
User
Posts: 46
Joined: Tue Nov 30, 2010 9:07 am

Re: How to save Selected PDF in serverside event?

Post by muralidhar »

Hi,

could somebody tell me what are the different syntaxes to save document from javascript code.

currently i am using
document.all.PDFView.SaveDocument(activeDocId, "", 0, 0);

file is saving successfully. but when i try to open with another viewer(not with PDFXchange Viewer) then i am getting following error
This PDF format is not supported. 1 0 R not found!.

this is very urgent for me. please help me in this regard.

Thanks in Advance
Regards,
Muralidhar.
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: How to save Selected PDF in serverside event?

Post by Vasyl - PDF-XChange »

Hi,

We cannot reproduce this strange problem. So:

1. What pdf-viewer have you used? Please try to open this problem document in our standalone PDF-X Viewer or in Adobe's Acrobat/Reader, perhaps your default PDF Viewer/Reader does not support fully the PDF-format ...
2. Can you send us the example document for investigation?
3. What is the version of the Viewer ActiveX SDK being used exactly?

Thanks.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
muralidhar
User
Posts: 46
Joined: Tue Nov 30, 2010 9:07 am

Re: How to save Selected PDF in serverside event?

Post by muralidhar »

Hi,
thanks for the speedy reply. i am using pxfxchange viewer activex control in my web application. i am able to load file from server, and the user can add notes or stamps etc to the document. my requirement is to save the modified pdf file and to upload that file to server. but the problem is we can upload file using pdfxchange viewer. so, i am using another control to to upload the document. and that control is eZTwain. it will be installed like activex and it has upload functionality. in order to upload any file that should be loaded in eZTwain control first. i am saving the file with modifications using pdfxchange viewer save method in javascript.
document.all.PDFView.SaveDocument(activeDocId, "", 0, 0);
above mentioned is the command i am using for save. after saving the file i am trying to load the same file into eZTwain control. then i am getting error which i posted earlier. normal pdf before saving with pdfxchange viewer is loading successfully. problem comes only after the save.
is there any thing i am missing while save.
please advise.
Regards,
Muralidhar.
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: How to save Selected PDF in serverside event?

Post by Vasyl - PDF-XChange »

Hi, muralidhar.

I cannot say exactly what is problem here (too short info about the problem) but I have one suspicion: maybe eZTwain does not support the PDF Specification v1.5 fully. Please check. In this case you can try...

1. Update your eZTwain to the latest version
2. You may use special option for saving documents:

Code: Select all

ctrl.SetProperty("Documents.SaveMethod", "Incremental", 0);
- but it will some increase the file after each(!) saving.
3. Also try to use synchronous saving of document:

Code: Select all

ctrl.SaveDocument(docId, "", .., PXCVA_Sync); // it will lock your working thread during saving of the document.
HTH
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
muralidhar
User
Posts: 46
Joined: Tue Nov 30, 2010 9:07 am

Re: How to save Selected PDF in serverside event?

Post by muralidhar »

Hi,

Thanks for the reply.

could you plz tell me does pdfxchangeviewer or any other product have file upload functionality??

or can you suggest me best way to upload file to server. because if user do any modifications (adding notes/stamps etc) i want to upload modified file to server. i want to upload the file without user interaction. means user will not select the modified file to upload.

how can i upload from javascript or can we upload from server side code?? i am using ASP.NET. using pdfviewer as object. can we get stream/base64string from viewer control??

please advise.

thanks in advance.
Regards,
Muralidhar.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19885
Joined: Mon Jan 12, 2009 8:07 am

Re: How to save Selected PDF in serverside event?

Post by Stefan - PDF-XChange »

Hello Muralidhar,

Nope our Viewer does not have upload functionality, but you can get the modified document, save it to stream, and then upload from this stream to wherever you like with any tool that you have.

After 5 second search online for "uploading file to server .net" I managed to find this: Beginner's Guide to Asp.Net Programming for Delphi developers. and this article in particular on how to Upload files to a web server with ASP.Net

Regards,
Stefan
muralidhar
User
Posts: 46
Joined: Tue Nov 30, 2010 9:07 am

Re: How to save Selected PDF in serverside event?

Post by muralidhar »

Hi Stefan,

thanks much for the reply.

i know how to upload file using convertional techniques like upload using html input or asp.net file upload controls. to do like that user has to pick the file from saved location and he has to upload the same file manually. what is want is to upload modified file withoput user interaction.

in our web application, we are having a viewer page. in which a user will select and loads pdf file into viewer. after loading a pdf into viewer he/she can do small modifications like adding notes, stamps, bookmarks etc. so the original file is changed. by default viewer saving the file in my documents folder of client machine. once it is saved file getting updated in my documents. now i want to upload the same modified to my web application server. that too without user selection.
what i exactly need is, is there any way to get stream or base64string from the viewer?? i think once modification done and after saving viewer holds the updated file content.

if i can achive this, i can use either stream or base64string to save the file my server location in asp.net server side code(not javascript).

its very urgent for me.

please advise.
Regards,
Muralidhar.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19885
Joined: Mon Jan 12, 2009 8:07 am

Re: How to save Selected PDF in serverside event?

Post by Stefan - PDF-XChange »

Hello muralidhar,

Please ensure you have the latest build of our Viewer SDK, and then please have a look at e.g.
<<installation folder>>\Tracker Software\PDF-XChange Viewer SDK\Examples\<<your used language here>>\SaveDocumentToStream
To see that it is possible both to open and make changes to a document opened from stream, and as it should be your main application that is creating the stream, you will have access to it for upload to a file server with your usual means.

Best,
Stefan
muralidhar
User
Posts: 46
Joined: Tue Nov 30, 2010 9:07 am

Re: How to save Selected PDF in serverside event?

Post by muralidhar »

Hi Stefan,

Thanks alot for the reply.

i have checked with the folder path as you suggested. but i am unable to find javascript there. if it is C#/VB.NET/VB/Delphi its ok. but i am working in asp.net and c# as my server side coding language. if you have to use pdfxchange viewer in asp.net it should be used as object in the page and i think this is not accessible from serverside code.

thats why i want to know the way to get file as stream from viewer in javascript. even base64string.

is it possible??

Please advice.

Thanks in advance.
Regards,
Muralidhar.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19885
Joined: Mon Jan 12, 2009 8:07 am

Re: How to save Selected PDF in serverside event?

Post by Stefan - PDF-XChange »

Hello muralidhar,

I am afraid that we do not have any samples on how to save document to stream in JavaScript and after discussing this case with one of our developers he advised that it should be much easier to save to a file and then upload that file to the server.

Best,
Stefan
muralidhar
User
Posts: 46
Joined: Tue Nov 30, 2010 9:07 am

Re: How to save Selected PDF in serverside event?

Post by muralidhar »

Hi Stefan,

As i mentioned in earlier post, once the file is loaded into the viewer that will be downloaded into "My Documents" folder in user machine. after doing modifications i am saving the file and it is successfully updating the file in my documents. then i am trying to upload the modified file from my documents to server path.

in order to do that i need either file stream or base64string. that should be from javascript. why because we cannot access viewer control from server side code, because it is embedded like an object in asp.net page.

please ask development guys and let me know how can i upload the modified file.
please help me.
thanks in advance.

PS: we cannot ask end user to select and upload the modified file. that should be uploaded without user interaction.
Regards,
Muralidhar.
User avatar
Paul - PDF-XChange
Site Admin
Posts: 7362
Joined: Wed Mar 25, 2009 10:37 pm

Re: How to save Selected PDF in serverside event?

Post by Paul - PDF-XChange »

Hi muralidhar,

can you not save the file to a temp location then code in the upload directly removing the temp file after a successful upload?
Best regards

Paul O'Rorke
PDF-XChange Support
http://www.pdf-xchange.com
muralidhar
User
Posts: 46
Joined: Tue Nov 30, 2010 9:07 am

Re: How to save Selected PDF in serverside event?

Post by muralidhar »

Hi Paul,

in windows application we can do that. we will be having access to resources in client machine. but i am working in asp.net and its a web application. there wil be a lot of security issues to access client machine contents.

anyways, i am saving to file client machine "My Documents" folder. its saving perfectly. whats the main problem is to pick the modified file in my documents folder and to push it my server. that means upload without user interaction.

any suggestions?
Regards,
Muralidhar.
User avatar
Paul - PDF-XChange
Site Admin
Posts: 7362
Joined: Wed Mar 25, 2009 10:37 pm

Re: How to save Selected PDF in serverside event?

Post by Paul - PDF-XChange »

the main problem is to pick the modified file in my documents folder and to push it my server.
Viewer DOESN"T give such functions. You really will need to find an outside utility/function for doing this. I think we've pointed this out before, we seem to be in a loop here...
Best regards

Paul O'Rorke
PDF-XChange Support
http://www.pdf-xchange.com