Copy link to clipboard
Copied
Hello, I have 200+ pages PDF file and i want to overlay all pages on a single page. Is this possible through Acrobat JavaScript? I have tried overlaying pages by converting it to images using VBA on Microsoft PPT but for some reason its getting stuck. I am not a JavaScript programmer, so, Any help would be greatly appreciated. I am currently using Adobe Acrobat Professional 9 pro. Thanks in Advance.
TSN's approach can actually be done in JavaScript - as long as you know the location and size of the green box. The trick is to figure out of any part of a word is outside of that green box.
Take a look at the "word finder": Acrobat DC SDK Documentation - Doc.getPageNthWordQuads() The documentation for Doc.getPageNthWord() has a reference to an example ("Example 2") that demonstrates how to iterate over all words.
What you want to do with overlaying page content is not easily possible in Acrobat.
...Copy link to clipboard
Copied
It depends on what exactly you want to accomplish, but there are various approaches.
Probably the most common one would be using OCGs (Optional Content Groups, sometimes also called "layers"). You would import the document page by page, and turn them into a (named) OCG. Then you can show/hide them, either script-controlled or manually.
A similar approach would be creating button fields of the size of a page, import the page as the icon, and then show/hide those fields
Finally, you may also look at the Template functionality (which has some limitations with Reader).
In any case, don't fiddle around with pseudo-images, if you can use PDF (which you can do in the methods mentioned above).
Hope this can help.
Copy link to clipboard
Copied
Thank you so much Max,
I am actually trying to find out if there is any text outside the set margin in the PDF. This PDF was generated using some third party tool. Dose OCGs or template functionality helps me find out text outside margin?
Copy link to clipboard
Copied
I would like to share a PDF that i am currently working on. PDF has a green box around the content on every page and on some page text is running outside the green box. I am not sure how to attach PDF in the forum. Please let me know if we can attach PDF in forum.
Copy link to clipboard
Copied
You can't upload it here directly. You can share a link to it via a file-sharing site like Dropbox, Google Drive, Adobe Cloud, etc.
Copy link to clipboard
Copied
Thank you.
Copy link to clipboard
Copied
Hello try67, Any idea on how to overlay PDF pages one on the other? I was looking for a solution since so many days and finally decided to overlay PDF pages but don't know how to do it using Acrobat JavaScript.
Copy link to clipboard
Copied
You can overlay one PDF on top of another by using the addWatermarkFromFile method of the Document object.
Copy link to clipboard
Copied
Thanks try67, but that is not what i am looking for.
Copy link to clipboard
Copied
Then you'll need to elaborate a bit about what you want to achieve...
Copy link to clipboard
Copied
I want to find the instances of "text running outside the green box". Here is the sample file 3 pages.pdf - Google Drive which has one instance on the second page. What i think is, when we overlay 3 pages on a single page we will get to see if there is any text running outside the green box. Suggest me the ways to solve this issue.
Copy link to clipboard
Copied
This seems a very convoluted path. Why not get the location of each word in the PDF and see if any words sit outside the box?
Copy link to clipboard
Copied
TSN's approach can actually be done in JavaScript - as long as you know the location and size of the green box. The trick is to figure out of any part of a word is outside of that green box.
Take a look at the "word finder": Acrobat DC SDK Documentation - Doc.getPageNthWordQuads() The documentation for Doc.getPageNthWord() has a reference to an example ("Example 2") that demonstrates how to iterate over all words.
What you want to do with overlaying page content is not easily possible in Acrobat. Two potential solutions were already mentioned (layers, which would require you to split the document into individual pages and then import them as payers), and watermarks (which would require you to apply every page in your document as a watermark). This approach does have limitations however: When a page has a white background, it will obscure everything else that was placed on the "page layer stack" so far, and you will not be able to see what was put on that stack before.
If you really want to use this overlay approach. I actually have a tool that I wrote for myself while analyzing customer files a while ago that takes every page of a document and creates such a composite page. It's a Java program that would require you to have Java installed (this is different from JavaScript). You can download it from here: MergePages.jar​
There is no warranty associated with that download, it works well for the kind of file it was designed for, but it may not work for you. If you choose to download the file, you are doing this at your own risk.
If you do download it, you would run it from the command line as follows:
java -jar MergePages.jar input.pdf output.pdf
Copy link to clipboard
Copied
Hi Karl,
Thank you so much!!. This is exactly what am looking for. Its working fine and i don't think any changes required.
I will try to convert this JAR file to EXE file which will run without JDK on windows system.
Once again Thank you so much!
Copy link to clipboard
Copied
You're welcome Bachu.
Acrobat JavaScript's capability is only very limited to find contents, and it would have to be within the cropbox anyway. So, if the page is cropped, contents outside of the cropbox is ignored. However, if you want to get rid of it before importing, you could set the mediabox of the page to the cropbox. That should get rid of such contents.
Copy link to clipboard
Copied
3 pages.pdf - Google Drive Here is the link to the PDF. Please let me know the best approach to find text outside the green box. Also, as Acrobat JavaScript has limited capability to deal with the issue, suggest me any other coding language which helps me solve this issue.
Thought of overlaying PDF pages one on the other of a complete PDF when i saw below youtube video about "PIXEDIT" stack image functionality. Please have a look at it @ 24 Page Stacking Images in PixEdit Document Scanning and Editing Software. - YouTube
where they even fixed the issue. However, i just want to identify which PDF page has this issue. Fixing the issue would be done in XML document.
Copy link to clipboard
Copied
Second page of attached 3 pages PDF has text outside the green box. Missed to add this point in the above comment.