3 Replies Latest reply on Dec 10, 2013 6:59 AM by jonwilks1

    Signed PDF w/ embedded JavaScript to make SOAP call (restrict printing)

    jonwilks1 Level 1

      The problem that I need to solve is this... "Find a way to limit printing of PDF documents"


      My current angle on a solutiuon is the following....

      1. Create PDF using Apache FOP & iText
      2. Digitally Sign the PDF with a certifacte to gain escalated privledges
      3. Embed JavaScript within the PDF to
        1. Trigger an auto print
        2. Make SOAP web service call to chat register prints with a database. Keep track of the number of prints per the document. Then restrict printing based on some threshold.


      I should preface this with... I know that this is a rediculous requirement. Why would you want to try to limit printing? Someone could just photo copy the original, they could also screen cap it! It would also only work in Adobe Reader! I am with you... but I have a technical requirement and it is my job to solve it. With that said...


      I have created the PDF and a test webservice. The PDF is digitally sigend by a self signed certifacte which is trusted on my system. I am then embedding the following javascript to trigger a test SOAP ws call.


      function getMyServices() {
       var cURL = "http://localhost:8080/TestWebService-1.0-SNAPSHOT/CalculatorService/HelloWorld";
      var service = SOAP.connect(cURL);
       // Print out the methods this service supports to the console 
      for(var i in service) console.println(i);


      Upon opening the PDF in reader (Build: the JavaScript console displays the following.


      NotAllowedError: Security settings prevent access to this property or method.


      I was under the impression that if the PDF was signed and the cert was trusted that I would be able to excucute the SOAP.connect function? Clearly I do not understand the nuances of trusted functions and embedded javascript. Any help is appreciated.