I have been exchanging emails with a colleague today on how a customer might attach documents to a Publisher PDF output. If I leave aside the EB aspect of the attachments framework and try and keep things generic there are options for everyone.
Im also going to assume we are talking about attaching documents - images can be pulled into a template pretty easily, either via base64 encoded XML or via a URL. The following are all API approaches, we do not expose these through the user interface.
Concatenation
If you attachments are all PDF documents you can use the PDFDocMerger API to bind together the attachments with the main PDF document. Its supported from 5.6.2 onwards. those of you in the standalone release - its supported in any of your versions.
Heres some sample code:
import oracle.apps.xdo.common.pdf.util.PDFDocMerger;
...
try {
File[] inpFiles = {new File("c:\\temp\\inp.pdf"),
new File("c:\\temp\\1.pdf"), new File("c:\\temp\\2.pdf")};
File outFile = new File("c:\\temp\\out2.pdf");
PDFDocMerger pdfDoc = new PDFDocMerger(inpFiles,outFile);
pdfDoc.process();
}
catch (XDOException e) {
e.printStackTrace();
}
Embedding
You can attach pretty much any file to a PDF document using this method. The PDF contains the attachments but they are embedded into the document, not inline but as a set of links. Now this is somewhat of a hidden API, yep, its not in the documentation. I think Leslie has me on the hook to re-write the API docs anyway. So Im making a start.

You can see the main document above the attached file list. As I mentioned you can attach any file type and as many as you like too. Its supported from 10.1.3.2 onwards.
Here's the code snippet:
import oracle.apps.xdo.common.pdf.util.PDFFileAttacher;
...
try {
PDFFileAttacher pdfA = new PDFFileAttacher("c:\\temp\\inp.pdf","c:\\temp\\out.pdf");
pdfA.addFile("PDF1","c:\\temp\\1.pdf");
pdfA.addFile("PDF2","c:\\temp\\2.pdf");
pdfA.process();
}
catch (XDOException e) {
e.printStackTrace();
}
Book Binding
I covered the rolls royce of binding in a couple of articles a while back:
this is supported in version 5.6.3 and higher.
Attachments Done!
Comments (2)
Hi Tim,
This is regarding this question on forum:
http://forums.oracle.com/forums/thread.jspa?threadID=642276&tstart=60.
Say we attach a PDF file to a PO as an attachment. Now when we print this PO with output as a PDF file, we would like to print this attached PDF file content at the end as inline text or as an attachment along with PO information.
Can we use this technique to do that?
Create a wrapper program say PO Document printer that prints the PO and generates a PDF file.
We grab this PDF file as you have mentioned in this thread ..http://blogsmt01.oracle.com/xmlpublisher/2008/06/getting_ebs_output.html.
And use this technique to print or attache the PDF file?
Thanks
Nagamohan
Posted by Nagamohan Uppara | July 28, 2008 3:06 PM
Posted on July 28, 2008 15:06
Hi Nagamohan
I think this would be a good solution - custom and requiring code but a good solution.
Tim
Posted by Tim | August 4, 2008 8:26 AM
Posted on August 4, 2008 08:26