Launch works just fine on embedded attachments as well. Leonard
On Jun 4, 2008, at 5:21 AM, Paulo Soares wrote: > You need a launch action where the file is embedded. I don't think it > will work in Acrobat, only external files can be launched. > > Paulo > >> -----Original Message----- >> From: [EMAIL PROTECTED] >> [mailto:[EMAIL PROTECTED] On >> Behalf Of Sumeet Gupta >> Sent: Wednesday, June 04, 2008 4:52 AM >> To: itext-questions@lists.sourceforge.net >> Subject: Re: [iText-questions] click on image and open the attachment >> >> >> hi Paulo, >> >> Let me be clearer on this. I need to create a PDF file, which >> could contain >> word documents as attachments. I can embed both an image and make it >> clickable AND attach a word document in the pdf file. However, the >> requirement is that when i click on the embedded image, the >> corresponding >> attachment opens up, so that the user does not have to go to >> the attachments >> icon to see what all attachments are associated with the pdf >> (it might be >> confusing for them). So, my query is that is it possible to >> have some sort >> of link between the embedded image and the attachment in the >> PDF file, so >> that clicking image 1 opens up attachment 1, clicking image 2 >> opens up >> attachment 2 and so on? >> There can be more than 1 attachments in the pdf and hence >> more than 1 images >> embedded. >> >> Here's what i did earlier:- >> I associated the word document not as an attachment to the >> pdf but as a byte >> array to the image embedded. Now, when the user clicks on the >> image, the >> byte array associated with the image actually was saved as a >> file in the >> temporary folder of the machine. I was then using the MS Word >> to open it. >> The problem with this approach was that since the byte array >> was getting >> associated with my temporary folder (or my C:/ folder), when >> i was sending >> this PDF file in an email, it was not opening the word >> document, as it was >> expecting the temporary folder of my machine. In nutshell, >> the embedded >> image became as good as a hyperlink (pointing to my temporary >> folder), which >> was not the requirement, as the pdf then became system dependent. >> The following is my code snippet, if that may help:- >> >> ------------------------------------- start of code >> --------------------------------------------------- >> // get the byte array >> for the word >> document to be attached >> byte[] b = getBytesFromFile("C:/Test.doc"); >> >> docWriter.addFileAttachment("This is >> Test.doc", b, null, "Test.doc"); >> >> Paragraph imageParagraph = new >> Paragraph("Testing this image"); >> doc.add(imageParagraph); >> String name = "MyWordFile"; >> Image testImage = >> Image.getInstance("C:/word.jpg"); >> testImage.scaleToFit(50, 50); >> testImage.setAlignment(1); >> >> testImage.setAdditional(PdfFileSpecification.fileEmbedded(docW >> riter, "", >> "This is test", b, true, "application/msword", null)); >> File tempFile = getPathInLocalMachine(b, name); >> testImage.setAnnotation(new >> Annotation(0, 0, 0, 0, "", >> "application/msword", "", "")); >> testImage.setOriginalData(b); >> doc.add(testImage); >> >> -------------------------------------- end of code >> --------------------------------------------------- >> >> >> >> No problem with that, just make the activation area the size of the >> image. See >> http://article.gmane.org/gmane.comp.java.lib.itext.general/19141. >> >> Paulo >> >>> -----Original Message----- >>> From: [EMAIL PROTECTED] >>> [mailto:[EMAIL PROTECTED] On >>> Behalf Of [EMAIL PROTECTED] >>> Sent: Tuesday, June 03, 2008 12:44 PM >>> To: itext-questions@lists.sourceforge.net >>> Subject: [iText-questions] click on image and open the attachment >>> >>> Hi, >>> >>> I have a requirement where i need to embed a word document >>> image file in a PDF document generated by iText. So far so >>> good. However, i need to ensure that when i click on the >>> image, the attached word document actually opens up. >>> In nutshell, the image in the PDF file should actually link >>> to the attachment in the pdf document. >>> >>> Any pointers will be greatly appreciated. >>> >>> Thanks. > > > Aviso Legal: > Esta mensagem é destinada exclusivamente ao destinatário. Pode > conter informação confidencial ou legalmente protegida. A > incorrecta transmissão desta mensagem não significa a perca de > confidencialidade. Se esta mensagem for recebida por engano, por > favor envie-a de volta para o remetente e apague-a do seu sistema > de imediato. É proibido a qualquer pessoa que não o destinatário de > usar, revelar ou distribuir qualquer parte desta mensagem. > > Disclaimer: > This message is destined exclusively to the intended receiver. It > may contain confidential or legally protected information. The > incorrect transmission of this message does not mean the loss of > its confidentiality. If this message is received by mistake, please > send it back to the sender and delete it from your system > immediately. It is forbidden to any person who is not the intended > receiver to use, distribute or copy any part of this message. > > > ---------------------------------------------------------------------- > --- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/ > index.php_______________________________________________ > iText-questions mailing list > iText-questions@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/itext-questions > > Do you like iText? > Buy the iText book: http://www.1t3xt.com/docs/book.php > Or leave a tip: https://tipit.to/itexttipjar ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Do you like iText? Buy the iText book: http://www.1t3xt.com/docs/book.php Or leave a tip: https://tipit.to/itexttipjar