Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

Adding Javascript to existing Pdf

$
0
0
Hi,
I'm trying to add Javascript to an existing Pdf document in a servlet.  It doesn't fail or give me any errors, but the returned Pdf doesn't open the print dialog on open.  It does have the watermark, "Evaluation Only.  Created with Aspose.Pdf...".  I'm using a trial version to see if it will meet my project requirements.  Is this functionality disabled in the trial version, or is something wrong with my code?

  response.setContentType("application/pdf");
  Part filePart = request.getPart("file");
  InputStream fileContent = filePart.getInputStream();
  Document doc = new Document(fileContent);
  JavascriptAction javaScript=new JavascriptAction("this.print({bUI:true,bSilent:false});");
  doc.setOpenAction(javaScript);
  doc.save(response.getOutputStream());

Thanks in advance :)
Jeff

Viewing all articles
Browse latest Browse all 3131