× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I have a small PDF created with an annotation (a quarter of an inch), using PDFBOX. I want to take page one of an existing PDF and place the small PDF on the top, to give the appearance that the small annotation PDF is part of the existing PDF. I need to do this because there are times that there is a stamp in the upper right corner of the existing PDF and the annotation must be in upper right corner.
I cannot create a cover page with just the annotation, I am under state regulations that prohibits this. Too bad, because I knew how to do that.
I am new to both PDFBOX and JAVA. Please include as much detail as possible.

Soliciting help from stack overflow, I created this code below, which just puts the small annotation page as a new page at the end of the PDF.
Parameter 0 is the small pdf with the annotation, Parameter 1 is the existing pdf that I want to overlay with the annotation.
I also tried to extract the text from doc1 (code not shown) to try to determine if a stamp exists in the upper right corner, but the existing PDF is created from a TIFF image so it did not give me any text back.
TIA.
// Small annotated PDF DOC
File file = new File(args[0]);
PDDocument doc = PDDocument.load(file);
// Existing PDF to place annotation page on DOC1
File file1 = new File(args[1]);
PDDocument doc1 = PDDocument.load(file1);
// Get first page from small annotated PDF and do addpage
// to existing PDF.
PDPage page = doc.getPage(0);
doc1.addPage(page);
doc1.save(args[1]);
System.out.println("Documents overlayed");
doc1.close();
doc.close();

}
}


Tom Deskevich


Harriscomputer

Tom Deskevich
Programmer/Analyst

P: 814-472-6066 x134
F: 814-472-5019
E: TDeskevich@xxxxxxxxxxxxxxxxxx


[cid:HLG_logo_eccde356-f9d5-496b-9e38-e7802fb467a8.jpg]


172 Gateway Road PO Box 568
Ebensburg, Pennsylvania
15931
www.harrislocalgov.com<file:///C:/Users/jk80512-admin/AppData/Local/Temp/3/b4357967-469d-46e6-96e1-8cc4b2032841/www.harrislocalgov.com>


This message has been sent on behalf of a company that is part of the Harris Operating Group of Constellation Software Inc. These companies are listed at the following link:http://subscribe.harriscomputer.com

Unsubscribe Option: If you do not wish to receive any future email, please unsubscribe by clicking on the following link:http://subscribe.harriscomputer.com



This message is intended exclusively for the individual or entity to which it is addressed. This communication may contain information that is proprietary, privileged or confidential or otherwise legally exempt from disclosure. If you are not the named addressee, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this message in error, please notify the sender immediately by e-mail and delete all copies of the message.





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.