BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-18-2007, 08:30 AM   #1 (permalink)
New Member
 
Join Date: Jun 2007
Model: 8700g
PIN: N/A
Carrier: Bharti
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question PDF files as email attachment

Please Login to Remove!

HI

I'm thinking about building an app which would generate a PDF file & send it out as an email attachment. I know that Blackberry's can read PDF files, but I don't know the first thing about how to generate one programmatically, or if it's feasible to do on a Blackberry. Anyone have any ideas on this, and/or where I'd go for info?

Iam able to generate other file formats like .doc and .xml succesfully and send it out as attachment.....

Here is the piece of code that generates a doc file and attach it with the mail...
-----------------------------------------------------------------------
String s = "Test Data";
byte[] buf = s.getBytes(); // The attachment.
Multipart multipart = new Multipart();
SupportedAttachmentPart attach = new
SupportedAttachmentPart( multipart,"application/x-example",
"filename.doc", buf);
multipart.addBodyPart(attach);

--------------------------------------------------------------------------

But if i change the extension of filename to .pdf(instead of .doc), the mail is sent along with the pdf attachment, but the pdf is not in correct format and the string "Test Data" is also not displayed.

Thanks in advance for any info.....
Offline  
Old 07-19-2007, 01:30 AM   #2 (permalink)
New Member
 
Join Date: Jun 2007
Model: 8700g
PIN: N/A
Carrier: Bharti
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I hope d thread doesn't die without ne reply............ Has nobody tried out similar problem.....If yes plz help me out....
Offline  
Old 07-19-2007, 06:46 AM   #3 (permalink)
Knows Where the Search Button Is
 
Join Date: Apr 2007
Model: 8700
PIN: N/A
Carrier: O2
Posts: 24
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Dipta,

I've used a number of third party tools to generate pdfs as the underlying encoding is really quite complicated. There's an excellent free one available for java called iText (although I'm sure you've discovered that...) but I don't know if it will work for BlackBerry, I've never tried.

The alternative would be to have a script on a server which you could post a word doc to which would convert into pdf which you could receive and send out. Would have to be a mutlithreaded app as the time delay may prove troublesome...

Sorry I couldn't be any more help. Let us know how you get on as it might be of interest to others...

Cheers!
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.