No announcement yet.

Apply dynamic stamps with JavaScript; get internal stamp name

  • Time
  • Show
Clear All
new posts

  • Apply dynamic stamps with JavaScript; get internal stamp name


    After much struggling, I recently created a dynamic PDF stamp, and I am desperately trying to find a way to apply it with JavaScript. I am using Foxit PhantomPDF ver.

    The main way I am attempting to go about this is by using this.addAnnot. So far, I was able to use the function to add a square, but not to apply a stamp. The tutorials I have seen tell me that I need to find the internal stamp name, but THIS is where I am having absolutely no luck:

    - First, I try to apply the stamp to a PDF and use this.getAnnots to retrieve information about it, but it always returns null. I should note that most examples I have seen using this method begin by calling this.syncAnnotScan(), which appears to NOT be supported by Foxit.

    - The next thing I tried was to select the stamp on a page, and use this.selectedAnnots[0].AP but apparently this function is also NOT supported by Foxit

    - Another pretty straight-forward way I have seen of getting the internal stamp name is by locating information on the Page Template. In Adobe Acrobat, this is done by navigating through menus: Tools > Document Processing > Page Templates. Unfortunately, I can't find any similar functionality in Foxit.

    - I have also tried using event.source.stampName, which seems to return undefined

    - I also tried applying the stamp as a watermark, using this.addWatermarkFromFile, but it looks like this method is also NOT supported by Foxit.

    I am able to apply the stamp manually just fine, and I am also able to add it as a watermark using the buttons on the "organize" tab. I need a way to automate this process though, since my goal is to process hundreds of PDFs at a time by executing an Excel VBA script I created. Please let me know if there is any possible solution to this. I don't want to have to turn to some other third party software to get this done, but I am running out of ideas.

    Thanks for your time.

  • #2

    Please try to make a screenshot/ a small video that shows the JS scripts you used so we could take a closer look at this and further check with Dev team. Thank you. You may email to [email protected].