Skip to Content
avatar image
Former Member

How to SAVE pdf doc in hard disk programatically

Folks,

How to save pdf doc to harddisk programatically in webdynpro application.

Thanks,

Manish

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Oct 10, 2006 at 05:28 AM

    Hi Manish,

    You can save the PDF in your local hard disk by adding the below mentioned piece of code under the action of any particular button,outside the PDF.

    // Coding in the view side.

    IPrivate<ViewControllerName>.IContextElement currentContext = wdContext.currentContextElement();

    // to obtain the context -

    byte[] bytes = currentContext.getPdfSource();

    // The context attribute mapped to the pdfSource must be used to retrieve the path

    try{

    String filepath = "Provide your local path

    (Ex: C:
    PDF
    SAVE
    sample.pdf)";

    File file = new File(filepath);

    FileOutputStream Output = new FileOutputStream(file);

    Output.write(bytes);

    Output.close();

    }

    catch(Exception e)

    {

    e.printStackTrace();

    }

    This code should be run on the click of the button.

    Kindly award points, if the solution/code provided achieve your requirement.

    Regards,

    Sharath

    Add comment
    10|10000 characters needed characters exceeded