Hello, When I attach a file (pdf/word/png) It works fine and via the
attachment pane I can open all these files by clicking on it. However when
cliking in the text on the "link" files do not open by clicking the link.
No error message is given nothing happens Please Help :public void
attachmentFileInPdf(PdfWriter writer,String fileName, Blob blob,int
counter)throws Exception{ try {
InputStream
inputStream=blob.getBinaryStream(); if(null !=
inputStream){
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
byte
buf[]=new byte[102400]; int len;
while((len=inputStream.read(buf))>0){
buffer.write(buf,0,len); }
PdfFileSpecification fs
=
PdfFileSpecification.fileEmbedded(writer, null,new
File(fileName).getAbsolutePath(), buffer.toByteArray());
writer.addFileAttachment(((new File(fileName).getName()).substring(0, (new
File(fileName).getName()).indexOf('.'))), fs);
writer.addFileAttachment(fs);
buffer.flush();
buffer.close();
inputStream.close(); }
}catch (IOException e){
e.printStackTrace(); }
}-------------------------PdfDestination dest =new
PdfDestination(PdfDestination.FIT); dest.add((new PdfNumber(1)));
*attachmentFileInPdf(writer,fileName,buffer.toByteArray(),cchtCounter);*
PdfTargetDictionary target = new
PdfTargetDictionary(true);target.setEmbeddedFileName(filename);
PdfAction
action = PdfAction.gotoEmbedded(null, target, dest, true);Chunk link = new
Chunk(voCcht.getFileName());link.setAction(action);PdfPCell= new
PdfPCell(new Paragraph(link));
--
View this message in context:
http://itext-general.2136553.n4.nabble.com/Unable-to-open-attached-files-via-link-in-the-text-tp4657189.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php