Without seeing a final PDF page of what you are intending, my personal recommendation is to look at the new Portfolio features of Acrobat 9 (PDF 1.7-ADBE-3) for incorporating non-PDF content into your documents.
If you want to put the content directly inline (vs. the portfolio model), then you want to be using Launch actions for your link annotations. Leonard -----Original Message----- From: vickatvuuch [mailto:[email protected]] Sent: Sunday, September 13, 2009 12:23 PM To: [email protected] Subject: [iText-questions] How-to embed Word document and make a clickable thumnail image to launch MS Word Hi All! Has anybody figured out how to embed an attachment data and make an Image thumbnail to launch an appropriate viewer application? For example embed Word file and make it open Word on a click on the image thumbnail thing? Same for Excel or plain text file as well as images. For now I have resorted to using a Url based anchor on the Chunk object, but that is not what I need since I need to make all the data be contained inside the pdf rather than refer clicks to the server. I tried several things, but nothing worked, please see a sample code below: Any help is greatly appreciated. -Vick private Chunk createAttachmentChunk(PdfWriter docWriter, MediaBase att, String type) { URL url = new URL("${grailsApplication.config.baseUrl}" + type + "/downloadByName/${att.id}_${att.fileName}"); byte[] b = loadBytesFromURL(url); //PdfFileSpecification pdfSpec = // PdfFileSpecification.fileEmbedded(docWriter, att.fileName, att.title, b, true); //docWriter.addFileAttachment(pdfSpec); Image imageAttachment = Image.getInstance(new URL("${grailsApplication.config.baseUrl}images/icons/attachment.png")); imageAttachment.scaleToFit(40, 40); imageAttachment.setAlignment(1); //PdfAction action = PdfAction.gotoEmbedded(att.fileName, pdfSpec, "", true); //imageAttachment.setAdditional(pdfSpec); //imageAttachment.setOriginalData(b); //PdfAnnotation annot = PdfAnnotation.createFileAttachment(docWriter, new Rectangle(0,0,0,0), // att.fileName, b, "", att.title); //imageAttachment.setAnnotation(annot); Chunk ck = new Chunk(imageAttachment, 0, -5); //chunk.setAction(action); ck.setAnchor(url); return ck; } -- View this message in context: http://www.nabble.com/How-to-embed-Word-document-and-make-a-clickable-thumnail-image-to-launch-MS-Word-tp25424592p25424592.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/ ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
