|
I've been on the javasoft web site and searched
yahoo! but no-one seems to know how to over come this.... loads of folk want to
find a solution !-)
Very simply, I want to create a PDF and attach it
to an email using JavaMail (mail.jar, activation.jar etc).
I can create the PDF to a file then attach that
without a problem; but when trying to attach the PDF directly from a
ByteArrayOutputStream (ie. in memory - from another Class that creates the PDF
to an OutputStream) to a BodyPart using the setDataHandler(...) etc it fails
with exceptions relating to unsupported DCH. I
can convert the output to a StringBuffer the .toString(), then set the type as
text/plain and the email is sent - only the PDF is corrupt (it has bytes 0a 0d
in place of 0a for newlines?). There's a file in the activation.jar -
mimetypes.default that has some mime types listed but not application/pdf.... I
don't know why there are so few types in there.
I know this isn't really related to the iText
library, but it is useful to be able to attach a PDF and send it via
email.
Thanks for any help (especially code
snippets!).
Paul
Paul Black
B.Eng (Hons) Software Engineering Advocates Library - IT Department, Parliament
House, EDINBURGH, EH1 1RF
|
