Leonard,
I acheived all what I need for my project to work for now.
Three little issues:
- File Modification of the attachments is missing. How to specify it
programmatically?
- File Index Attribute is not present. How to add Index attribute? (see the
attached picture)
- PdfFileSpecification -- it does not allow creating embedded files from an
InputStream.
I have to come up with next work around.
private PdfFileSpecification fileEmbedded(PdfWriter writer, String
fileDisplay, InputStream in) throws IOException {
PdfIndirectReference ref;
try {
PdfIndirectReference refFileLength =
writer.getPdfIndirectReference();
PdfStream stream = new PdfStream(in, writer);
stream.put(PdfName.TYPE, PdfName.EMBEDDEDFILE);
stream.flateCompress();
stream.put(PdfName.PARAMS, refFileLength);
ref = writer.addToBody(stream).getIndirectReference();
stream.writeLength();
PdfDictionary params = new PdfDictionary();
params.put(PdfName.SIZE, new PdfNumber(stream.getRawLength()));
writer.addToBody(params, refFileLength);
}
finally {
if (in != null)
try {
in.close();
} catch (Exception e) {
e.printStackTrace();
}
}
PdfDictionary f = new PdfDictionary();
f.put(PdfName.F, ref);
PdfFileSpecification fs = PdfFileSpecification.url(writer, fileDisplay);
fs.remove(PdfName.FS);
fs.put(PdfName.EF, f);
return fs;
}
The rest works fine,
Thanks!
Yuriy
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/