File Attachments

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:

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 on July 28, 2008 at 09:06 AM MDT #

Hi Nagamohan I think this would be a good solution - custom and requiring code but a good solution. Tim

Posted by Tim on August 04, 2008 at 02:26 AM MDT #

onrush, it made me annotation, so you analyse to be doing someclo reasonable…

Posted by Robnxtmx on February 17, 2009 at 12:31 AM MST #

What a blog post!! Very informative and easy to understand. Looking for more such writeups!! Do you have a twitter or a facebook? I recommended it on stumbleupon. The only thing that it's missing is a bit of speed, the pictures are appearing slowly. Nevertheless thank you for this blog.

Posted by Margery Conneely on August 30, 2010 at 03:00 PM MDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Follow bipublisher on Twitter Find Us on Facebook BI Publisher Youtube ChannelDiscussion Forum

Join our BI Publisher community to get the most and keep updated with the latest news, How-to, Solutions! Share your feedback and let us hear your voice @bipublisher on Twitter, on our official Facebook page, and Youtube!

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today