How to download a .pdf file from a JavaMail application?

hi to all,
iam unable to download a .pdf file from a mailserver using
my javamail application.i have downloaded all kind of files except .pdf.
my code snipnet:
public static void dumpPart(Part p) throws Exception {
//     if (p instanceof Message)          dumpEnvelope((Message)p);
          System.out.println("CONTENT-TYPE: " + p.getContentType());
          Object o = p.getContent();
          if (o instanceof String) {
               System.out.println("This is a String");
               System.out.println((String)o);
               } else if (o instanceof Multipart) {
                    System.out.println("This is a Multipart");
                    Multipart mp = (Multipart)o;
                    int count = mp.getCount();
System.out.println("****************************************");
System.out.println("count" + count);
System.out.println("****************************************");
                    for (int i = 0; i < count; i++){
                         System.out.println("CONTENT-TYPE: " + p.getContentType());
                         dumpPart(mp.getBodyPart(i));
                    } else if (o instanceof InputStream) {
                         System.out.println("This is just an input stream");
                         InputStream is = (InputStream)o;
                         String filename=System.currentTimeMillis()+".exe     ";
                         FileOutputStream fos=new FileOutputStream(filename);
                         int c;
                         while ((c = is.read()) != -1)
                              //System.out.write(c);
                              fos.write((char)c);
}//dumpPart
what's wrong with this code?
Nagaraju.G

fos.write((char)c);Converting the byte to a char is unnecessary and probably harmful. Just do this: fos.write(c);

Similar Messages

  • How to download a pdf file from the server from an strut application?

    Hi,
    I wan to download a pdf file from the server side to local system. Please help me how i use the down load option.

    Read up on the Struts download action [1].
    And next time, please post in the relevant forum, one of the web-tier ones [2].
    [1] http://wiki.apache.org/struts/StrutsFileDownload
    [2] http://forum.java.sun.com/category.jspa?categoryID=20
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    ----------------------------------------------------------------

  • How to Download a PDF file from Webdynpro ABAP Screen

    Hi,
    I have developed a input form in webdynpro - ABAP(Not Adobe),
    As I am not using above services here, but would like to download the information I am capturing into a PDF file.
    can I do it without using adobe interactive forms ?
    thanks
    Siddharth

    Hi siddharth,
    My suggestion would be to create your output as a Smartform and call your Smartform in your View.
    For more Click this link.
    [HOW TO DISPLAY A SMARTFORM AS PDF DOCUMENT IN WEB DYNPRO FOR ABAP|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0de1eb8-0b98-2910-7996-8a3c2fcf6785]
    Regards
    Bulent

  • How do i download a pdf file from an e-mail? save to computer did not work.

    How do i download a pdf file from an email? Save to computer did not work.

    What is your operating system?  What is your email client?  What exactly means "did not work"?
    Most email clients I know have a 'Save Attachments' functionality; did you try that?

  • How may I transfere PDF files from my MacBook Pro to my IPAD

    How may I transfer PDF files from my MacBook Pro to my IPAD

    There are a number of methods, including via synch to iTunes on a computer and emailing them to yourself.
    I prefer using DropBox, which allows me to store them in the cloud and download only when needed, and send them to the app I choose (plus I do not synch my iPad to itunes). I typically use GoodReader or Adobe Reader, but any app that can read PDFs is typically available in the menu. You would need to install DropBox on the Mac as well as download the app on the iPad. Both are free.

  • How to download a pdf file in external storage(sd-card) not use a isolated storage wp8

    i have a url for download pdf file return by webservices 
    and i have attach this link in hypertext button this is start a download but in browser . and when i am google for this purpose the give me "
    Background file transfer
    " Process and then code is also using a isolated storage but i want a external storage process Please Help me 
    how to download a pdf file in external storage(sd-card) not use a isolated storage wp8 

    Hello,
    This forum is for discussions and questions regarding profiles and Microsoft's recognition system on the MSDN and TechNet sites. It is not for products/technologies.
    As it's off-topic here, I am moving the question to the
    Where is the forum for... forum.
    Karl
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C40686F746D61696C2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

  • How can I read pdf files from LabVIEW with different versions of Acrobat reader?

    How can I read pdf files from LabVIEW with different versions of Acrobat reader?
    I have made a LabVIEW program where I have possibility to read a PDF document.  When I made this LabVIEW program it was Acrobat Reader 5.0.5 that was installed on the PC. Lather when the Acrobat Reader was upgraded to version 6.0, there was an error when VI tries to launch the LabVIEW program. And Later again when we upgraded to Acrobat Reader 7.0.5 I must again do some changes and rebuild the EXE files again
    It isn't so very big job to do the changes in one single LabVIEW program, but we have built a lot of LabVIEW programs so this take time to due changes every time vi update Acrobat Reader. (We have build EXE files.)
    The job is to right click the ActiveX container and Click "Insert ActiveX Object", then I can brows the computer for the new version of acrobat Reader. After this I must rebuild all the "methods" in the Activex call to make the VI executable again.
    Is there a way to build LabVIEW program so I don't have to do this job every time we update Acrobat Reader?
    This LabVIEW program is written in LabVIEW 6.1, but I se the problem is the same in LabVIEW 8.2.
    Jan Inge Gustavsen
    Attachments:
    Show PDF-file - Adobe Reader 7-0-5 - LV61.vi ‏43 KB
    Read PDF file.jpg ‏201 KB
    Show PDF-file - Adobe Reader 5-0-5 - LV61.vi ‏42 KB

    hi there
    try the vi
    ..vi.lib\platform\browser.llb\Open Acrobat Document.vi
    it uses DDE or the command line to run an external application (e.g. Adobe Acrobat)
    Best regards
    chris
    CL(A)Dly bending G-Force with LabVIEW
    famous last words: "oh my god, it is full of stars!"

  • How can I delete PDF files from my iMac desktop?

    How can I delete PDF files from my iMac desktop?

    Not on my system,When I try to dump if off in the trash it will not go. I get a message that says this file cannot be removed. I also tried going to File and clicking on Move to Trash. No dice.

  • How can I transmit PDF files from my Mac to my iPad, How can I transmit PDF files from my Mac to my iPad

    How can I transmit PDF files from my Mac to my iPad, How can I transmit PDF files from my Mac to my iPad

    Yes you can definitely do this. You'll need an app on the iPad that handles PDF viewing and editing. There are many around - two of the best I've seen are GoodReader and PDF Expert.
    In iTunes when you iPad is connected to your PC, go to the Apps tab and scroll down and you'll see the File Sharing section. You can drag files to there to share them to your iPad.
    You could also look at online file sync services like PDF to ePub Maker if you prefer not to have to connect your iPad to a PC

  • How do I transfer PDF files from PC to IPAD using Itunes 12.1.2.  Previous versions let me drag file in Itunes to Ipad and files appeared under Ibook but can't get it to work in latest 12.1.2 version.

    How do I transfer PDF files from PC (Windows 7) to IPAD using Itunes 12.1.2.  I would like to do files manually rather then auto synch.  Previous versions let me drag file in Itunes to Ipad and files appeared under Ibook and then I could move them to an appropriate collection title.  The interface appears to have changed in the latest ITunes version and I am not sure what the proper procedure is.

    King_Penguin - Thanks it worked perfectly.  I had my pdf files copied into ITunes on my PC but when I clicked on a pdf file to copy it I thought the sidebar would appear with my IPAD name and then I would drag it over.  I didn't realize that I needed to click-and start dragging it towards the left-hand side for the sidebar to appear.  It worked like a charm - THANKYOU!!!

  • How to create a pdf file from multiple images ?

    Dear All,
    I want to create a SINGLE page pdf file from two or more page size images that are combined to make a single page pdf. Again, this question is on pdfs that are made out of several, atleast  two color images and a black-and-white mask for one of them.
    I have such pdf files from an unknown source (the producer is edited out) whereby there are three tiff images, obtained using the well known pdfimages extractor.
    When I want to make a pdf out of tiff or png or other image formats, I right click and tell Adobe Acrobat to make a pdf.
    However, I dont know how I can give a command to select say,  three tif images and specify which is the mask for which and then join  them in a way that I get the pdf from the composite of the two color images and a mask for one of them.
    Please help me out.
    I am a little familiar with the pdf structure skeleton and when necessary, fixed xref tables in one of my favorite editors. A few years ago, I also wrote a bunch of javascripts to make some annotations and needed some automation and used some itext type libraries. However, I need your help in this problem as I am now rusty and forgot some of what I studied to solve my earlier problems. This is a new problem for me. Gentle hints from you would be very nice to help me in this problem. Please specify if necessary what manual and pages to read. in the pdfspec.
    Best Regards
    Disabled Veteran [physically handicapped]

    Hello Again.
    On Fri, May 11, 2012 at 12:20 PM, lrosenth <[email protected]> wrote:
    >
    > Re: How to create a pdf file from multiple images ?
    >
    > created by lrosenth in PDF Language and Specifications - View the full
    > discussion
    > ________________________________
    >
    > No clue who Irving is…
    >
    I was hoping to have your first name so its easy for me to address you.
    > I have no clue what OS platform, programming language, etc. you use so
    > can’t really narrow things down.
    I would gladly mention that I am working on windows platform, preferably XP.
    I can also work on linux for free products that come with it.
    >  Also, as this is an Adobe forum, we only
    > recommend Adobe products – so there may be other options that even my list
    > wouldn’t include.
    But adding other products, for the help of an adobe products user,
    even if it outside adobe, shall add greater prestige to your company
    and give impression of user-centeredness.
    > If you read ISO 32000-1:2008 (aka the PDF standard), you will find the
    > information about Images and Image Masks well described.  I didn’t think I
    > needed to repeat any of that information.
    Well, just add the few pdf stanzas since you are proficient on it and
    I am presently a little rusty as I mentioned. Just asking a little
    extra yard, not even to go an extra mile.
    > And, if you read that same document, you will see that there is NO SUCH
    > THING as a “text only PDF”.   All PDF documents are structured binary files.
    Well, ascii format or uncompressed format that is human readable. I
    know its a binary file, but human readable ascii version of it.
    I hope you can give me some stanza and various other approaches
    possible so I can select or combine things for myself. I see only a
    miniscule number of posts claiming to have written masks in this forum
    and then with no details.
    Regards
    Roger
    Message was edited by: dying veteran
    because the adobe posting system went crazy and truncated all except the first line ... dunno why

  • How to copy a pdf file from a windows PC to an iPad?

    how to copy a pdf file from a windows PC to an iPad?

    You can use iTunes to sync the file to the iPad using File Sharing.
    About File Sharing
    http://support.apple.com/kb/ht4094

  • How to transfer my PDF files from computer to iphone 5s

    How to transfer my PDF files from my laptop to my iPhones 5 s and how to make folder to store those files?

    The iphone does not have a file system to create a folder in, instead apps themselves are responsible for storing their files,
    Use an app like ibooks or acrobat reader.
    You can then transfer the files via itunes or email them and then use the open in... option and select your chosen app.
    They will then be stored within that app.

  • How to move PDF file from Spool to Application Server?

    How to move PDF file from Spool to Application Server?
    Cannot use RSTXPDFT4 because that converts OTF to PDF and the file is already PDF.
    RSTXPDFT5 doesn't work. It picks the file up and assigns it a 'text' type and outputs a 1 line txt (1kb in size) on the server with the spool number in it!
    The program which outputs the file to the spool, in the first place, uses adobe forms and outputs to a printer of type PDF.

    Hi Gemini ,
    Please refer the below links.
    [http://sap.ittoolbox.com/groups/technical-functional/sap-hr/convert-a-spool-to-pdf-and-save-on-application-server-in-background-720959]
    [http://www.sapfans.com/forums/viewtopic.php?f=13&t=325628&start=15]
    Edited by: Prasath Arivazhagan on Apr 13, 2010 4:48 PM

  • How do I read PDF files from the SARS website

    How do I read PDF files from the SARS website
    Got the latest version xi.0.08 of Abobe Reader
    Operating system is win XP Sp3

    You need Adobe Reader or Adobe Acrobat or other PDF reading application installed on your system. Then just double click on the form or publication wanted and follow the prompts as needed.

Maybe you are looking for

  • HELP! i can't fix this !

    so i accidentally hit reply all on in my email, and it wont send it, but now the list so so long i cant click on the option at the bottom to edit and or cancel sending the emal. im not sure how to explain it but here are photos

  • SAP 4.6 installation aborted.

    Hi All My sap 4.6installation aborted with given below error.. My OS is Windows 2003Server and oracle 8i Info: DBR3LOADEXEC_NT_ORA R3loadPrepare 2 710 Total number of processes: 20 17 process(es) finished successfully: 0 4 5 6 7 8 9 10 11 12 13 14 15

  • Does Premiere Elements use a "rate curve" for pan/zoom?

    Does Premiere Elements pan/zoom feature have a sort of accelerate/decelerate option, either user-selectable, or built in to the pan/zooms? By accelerate/decelerate, I mean the pan/zoom will start very slowly, then over a period of just a second or tw

  • Contribute and Application.cfc

    I'm building out a site that is contribute-ready, and also makes use of Coldfusion MX 7's Application.cfc page. The application.cfc page has an onRequestStart function that <cfincludes> the navigational elements. When I drop into edit mode for a page

  • Manager Reporting Tool Needed

    If this iTunesU is really going to be successful it needs a way to add quizes/assessments and to have a reporting tool for managers to check on the progress of students work assignments and the scores (even pass/fail would be ok) So far all I see is