on 06-12-2007 3:08 PM
I'm trying to create a PDF attachment to an email using a custom module with the following codes. The attachment was created and sent, but when I tried to open it, I got the following error message: the file cannot be read either because a invalid encoding or the file is damaged.
Anybody knew if I did anything wrong in the way I'm opening and creating the PDF attachment below?
// add a new pdf attachment to the message
FileInputStream fi = new FileInputStream("c:/ftmailxi.pdf");
byte[] attachmentContent = new byte[fi.available()];
Payload attachmentPDF = msg.createPayload();
attachmentPDF.setName("ftmailxi.pdf");
attachmentPDF.setContentType("application/pdf");
attachmentPDF.setContent(attachmentContent);
//adding our this pdf as an attachment
msg.addAttachment(attachmentPDF);
//provide the XI message for returning
inputModuleData.setPrincipalData(msg);
......
Anyway, I resolved the issue. Special PDF handling is needed. I used iTEXT library to read and write out the PDF stream.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.