perform "save" javaScript

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

tamih
User
Posts: 15
Joined: Wed Apr 03, 2013 12:43 pm

perform "save" javaScript

Post by tamih »

Hi

I need 2 things to happen when javaScript function happens:

1. check if 'save' option is on/off.

2. perform "save" to the file . (just like 'Ctrl+s' )

what are the javaScript commands for those things ?

please give me a code example.

Thanks

Tami
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19868
Joined: Mon Jan 12, 2009 8:07 am

Re: perform "save" javaScript

Post by Stefan - PDF-XChange »

Hello Tami,

Are you executing JS inside the Viewer AX, or JS inside a web page?
If it's JS inside the AX - then take a look at the "saveAs" method in:
http://www.adobe.com/content/dam/Adobe/ ... erence.pdf
And if you want to call the save method from HTML - then use the SaveDocument method provided by our own AX (described in section 2.1.1.2.14 of the AX manual).

Best,
Stefan
tamih
User
Posts: 15
Joined: Wed Apr 03, 2013 12:43 pm

Re: perform "save" javaScript

Post by tamih »

Hi I am using JS inside a web page to perform the "save" .

It works o.k. , but it add printing of a demo watermark/stamp to the file.

1. Is it suppose to work this way ?

2. Can I prevent the demo watermark ? how ?

Thanks

Tami
User avatar
Paul - PDF-XChange
Site Admin
Posts: 7361
Joined: Wed Mar 25, 2009 10:37 pm

Re: perform "save" javaScript

Post by Paul - PDF-XChange »

Hi tamih,

are you only getting the water marks when the JS is used or on all documents? Typically water marks when using the SDK are a result of not passing the Dev Code and Serial key properly. As I understand it using JS itself should not cause this.

Can you let us know if this is specific to using JS and I'll ask one of the developers to comment?
Best regards

Paul O'Rorke
PDF-XChange Support
http://www.pdf-xchange.com
tamih
User
Posts: 15
Joined: Wed Apr 03, 2013 12:43 pm

Re: perform "save" javaScript

Post by tamih »

This only happens when JS is used.

When I use the pdfXChangeViewer localliy on my computer (not on my web project ) it doesn't add the demo watermark/stamp.

please ask one of the JS developers to help us.

Thanks

Tami
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19868
Joined: Mon Jan 12, 2009 8:07 am

Re: perform "save" javaScript

Post by Stefan - PDF-XChange »

Hello Tami,

The saving process itself will not add the "DEMO" stamps, it's probably another pro feature that you've used before (e.g. delete pages from the file) that when saved results in the "DEMO" stamps.

Please make sure that you've correctly passed your license to the AX and these issues should disappear.

Best,
Stefan
tamih
User
Posts: 15
Joined: Wed Apr 03, 2013 12:43 pm

Re: perform "save" javaScript

Post by tamih »

Hi

I realy don't understand what kind of license I need ?
how can I get it ?
how to pass it ? to where should I pass it ?

I am adding the JS code that I inserted into my web-project so you can see it and evaluate what I need .

Code: Select all

function open_file_allow_edit()  
{
	try {
     		
		       var PDFView1 = document.getElementById("PDFView");
		       if(PDFView1==null)
		       {
			  			PDFView1 = document.getElementById("documentAction:PDFView");
		       }
		       var pdf = document.getElementById("documentAction:pdfPath");
		       var val = pdf.value;
		       PDFView1.OpenDocument(val, 0, 0, 0); // open the file
 
		      docID = PDFView1.Property("Documents.Active", 0);
		      
			  PDFView1.SetDocumentProperty(docID, "ReadOnly", "false", 0); // disables editing for specified document
			  
			  var allowEdit = document.getElementById("documentAction:AllowEditPdfFlag");
			  if(allowEdit.value == "true" )
		      {
				 PDFView1.DoVerb("", "ExecuteCommand", "ToggleAllBars", 0, 0);
		  	  }
			 
			  
		}
		catch (err) {
		    	 
		}

}
function SaveChanges()
{
	try {
			var PDFView1 = document.getElementById("PDFView");
		    docID = PDFView1.Property("Documents.Active", 0);
	        PDFView1.SaveDocument(docID, "", 0, 0);
	       
	        alert("this file had been saved !!");
	       //PDFView1.SetProperty("Documents.SaveMethod", "Full", 0);
		  }
	      catch (err) {
	    	  alert('err1 '+err.message);
	    	  
	     }
}
please explain everything

thanks

Tami
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19868
Joined: Mon Jan 12, 2009 8:07 am

Re: perform "save" javaScript

Post by Stefan - PDF-XChange »

Hi Tami,

Right before opening a file you should call another method - SetDevInfo() - with a serial key and developer code that you will receive once you purchase a valid license for our Viewer AX SDK.

Code: Select all

function btnOpen_Click()
	{
		try {
          PDFView.SetDevInfo("PVA20-xxxxx","xxxxx");
          PDFView.OpenDocument("", 0, 0, 0);
          docID = document.all.PDFView.Property("Documents.Active", 0);
          //additional code...
      }
      catch (err) {}
	}
tamih
User
Posts: 15
Joined: Wed Apr 03, 2013 12:43 pm

Re: perform "save" javaScript

Post by tamih »

Hi

Is there a trial license we can get to test this , even a license for few days will help us to test this before we buy it .

thanks

Tami
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19868
Joined: Mon Jan 12, 2009 8:07 am

Re: perform "save" javaScript

Post by Stefan - PDF-XChange »

Hi Tami,

No I am afraid that we are not even technically able to provide test licenses.
The only limitation is the addition of those "DEMO" stamps in the corners and the red text across each page if you use the AX to actually render pages on screen for your users. Other than that all the functionality of the licensed product is available for testing.

Best,
Stefan