How to manage the PDF file

Dear all,
I have one question about Servlet. I have been using the Sun Java Application Server 8.0.
0) Obtains the inputs (name, birthday) from the user
1) Creates a PDF file, in which the inputs obtained are to be written
2) Stores the PDF file in the external hard disk drive
3) Only permits the same user to review the file
My question is how to let the permitted user to view the file.
a) Creates an HTML file with an appropriate Content-Type value
b) Exports the PDF file to the HTML file
If you are familiar with this problem, could you please help me to solve it?
Thank you very much in advance.
Yours faithfully,
t91006sa

Dear Saish,
Thank you very much for your instruction. I found it very interesting.
Following your instruction, I wrote the following code.
Thank you very much again. You are very kind.
BrendaAndEddie (t91006sa)
<%@ page pageEncoding="UTF8" %>
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<%
     final String DIRECTORY = "C:/Documents and Settings/Administrator/Desktop/";
     final String FILENAME = "abc.pdf";
     final int OPTIMIZATION = 1024;
     response.setContentType("Application/Octet-Stream");
// response.setContentLength(???);
     response.setHeader("Pragma", "no-cache");
     response.setHeader("Cache-Control", "no-cache");
     response.setHeader("Content-disposition", "inline; filename=\"" + FILENAME + "\"");
     byte buffer[] = new byte[OPTIMIZATION];
     FileInputStream fin = new FileInputStream(DIRECTORY + FILENAME);
     OutputStream os = response.getOutputStream();
     int size = 0;
     while (true) {
          size = fin.read(buffer);
          if (size == -1) {
               break;
          os.write(buffer, 0, size);
     if (os != null) {
os.flush();
          os.close();
     if (fin != null) {
          fin.close();
%>

Similar Messages

  • How to fix the .pdf file with error "invalid annotation object"

    how to fix the .pdf file with error "invalid annotation object"

    As long as the PDF opens, then just try saving it to a new file name. There may be a preflight script that would help troubleshoot the issue.

  • How to process the PDF files at one time

    Hello,
    I'm using WebDynpro for ABAP and Adobe Interactive Forms as offline forms.
    I collect PDF files from received e-mails.
    I want them to be taken in at one time.
    (for example,
    system job read PDF files and create data in ERP,
    or I upload the files one time.)
    Please let me know
    - How to process the PDF files at one time.
    Best regards,
    Koji

    When you click the edit button in recents, try clicking the clear button in the upper left.

  • How to break the PDF file into images?

    How to break the PDF file into images? There should be settings in Photoshop CS 6 that imports PDF file and break it into images.  I have a short instruction:
    2.    Open the file in Photoshop.
    3.    A new window should open to Import PDF.  Click on images, not pages  import pdf into Photoshop.doc
    4.    Select all the files shown (shift + click), Click O.K.  Four files should open on your screen.
      Was anybody successful with that?

    Whether this is available solely depends on the structure of the PDF and whether it actually contains whole images that can be extracted separately. Depending on whatgoing on in the PDF this may simply not be the case and the images have been tiled and split up in multiple "objects" whose appearance can only be retained by rasrerizing the whole page...
    Mylenium

  • How to send the PDF file to FAX will the nast table updates

    Hi all,
    How to send the PDF file to FAX. Will the nast table updates ( which fields updates ).
    Need is once fax is send for that delivery, again it should not fax again. Will the nast table helps to check the sent fax.
    Please give me sutable suggessions....

    Have you checked Forums » Community Discussions » Code Snippets 
    I believe there were some examples on converting/sending PDF.
    Or check FM 'SO_DOCUMENT_SEND_API1' and documentation for it.

  • How to send the pdf file....

    How to send the pdf file which is an outpu of smart form to sap users.
    How to delete the pdf file as soon as it was sent.

    Have you checked Forums » Community Discussions » Code Snippets 
    I believe there were some examples on converting/sending PDF.
    Or check FM 'SO_DOCUMENT_SEND_API1' and documentation for it.

  • How to chante the PDF File Name in Broadcasting

    Hi Team,
         Could you help me?, I am in a project where the customer need  the Following requirement with the PDF File Name in the Broadcasting:
    I am configuring one distribution Job in Broadcasting configuration Tab this Job need send a report via E-Mail in  PDF Format, but the customer requirement is that the file name is sent with the description name and not with the technical name from report.
    Then, some of you know "How change the name to the PDF File that is sent in the Distribution Jobs, I need the Description name, because actually the E-mail send the PDF File with the Technical Name, and the user does not want in that way".
    Thank you very much.
    Leslie Denise.

    Hi,
        Thank you for your answer, but that parameter i added in the content of the email. But I need change the name from the file not to add the description in the subject or in the content.
    And if there are somebody to know if is possible to change the name from the PDF File I will apreciate your comments and answers.
    But Thank you so much for your answer voodi.
    Regards
    Leslie Denise.

  • How to upload the pdf file to the next view?....urgent

    Hi Experts,
    I need to upload the pdf file( a interactive form ) using the fileupload element in the A_view and the pdf file can be displayed in the b_view.
    But I don't know how to complete the function?
    Action:
    0.  Create a adobe form (c_form)in the R/3 using sfp with a inputfield.
    1.  Create a adobe interactive form (A_interactive_form)in the view(display_view) of the WDA for abap.
    2.  Create a context attribute(upload) in the display_view.
    3.  Bind the c_form to the A_interactive_form, so that the data can be transfered to the c_form.
    4.  Bind the "pdfSourth" property to context attribute "upload" in the A_interactive_form.
    4.  Type code in the WDA for abap for setting data("old") to the context.
    5.  Active the WDA and run the WDA.
    6.  In the IE, the interactive form is displayed with the value "old" in the field. Save the pdf form as "test.pdf" and close the IE.
    7.  Open the test.pdf, and type the inputfield "new" in the form, and save the test.pdf.
    8.  Create a context node(Pdfsourth) in the component controller, and create a attribute("upload") that type is xstring in the Pdfsourth.
    9.  Create a view(C_view), mapping the context node(Pdfsourth) in the component controller.
    10. Create a fileupload element in the C_view, and the "data" property is binded the "upload" attribute in the context node(Pdfsourth).
    11. Create a button(Display_form) and create the action with the outplug for upload the pdf file(test.pdf).
    12. Change the window and set the C_view as default view, and set the Navigation link from the C_view to B_view.
    13. Type code in the wddoinit method in the display_view for transfering the test.pdf file.
    method WDDOINIT .
    DATA lo_componentcontroller TYPE REF TO ig_componentcontroller .
    DATA upload                 TYPE        xstring.
    lo_componentcontroller =   wd_this->get_componentcontroller_ctr( ).
      lo_componentcontroller->getupload(
        IMPORTING
          upload = upload                         " xstring
      DATA lo_nd_pdfsourch TYPE REF TO if_wd_context_node.
      DATA lo_el_pdfsourch TYPE REF TO if_wd_context_element.
      DATA ls_pdfsourch TYPE wd_this->element_pdfsourch.
    navigate from <CONTEXT> to <PDFSOURCH> via lead selection
      lo_nd_pdfsourch = wd_context->get_child_node( name = wd_this->wdctx_pdfsourch ).
    get element via lead selection
      lo_el_pdfsourch = lo_nd_pdfsourch->get_element(  ).
    get single attribute
      lo_el_pdfsourch->set_attribute(
        EXPORTING
          name =  `UPLOAD`
          value = upload ).
    endmethod.
    15. Active the WDA and run the WDA.
    In the fileupload of the C_view, I select the test.pdf from my local machine. and click the button(Display_form), the display_view is displayed with the A_interactive_form.
    But in the A_interactive_form, the value "old" is in the field in the form rather than "new".
    I hope to display the test.pdf in the A_interactive_form. I don't know how to change my code or configuration?
    Do you give some example or some hint for this problem ?
    Thanks & Regards,
    Tao

    Now, The problem has been solved.Thanks a lot.

  • How to save the pdf file or word doc into sap table

    Hi Expertu2019s
       I have a pfd file in my presentation server .Now I want to save the pdf file into sap table using module pool program. Whenever i need, I want to open that file from the table and show it in the Screen. Please any one tell me how I can save the file. What is the table name, guide me.
    Regards,
    S.Nehru.

    Hi,
    Try the following code
    FORM gui_upload.
      DATA: lv_filetype(10) TYPE c,
            lv_gui_sep TYPE c,
            lv_file_name TYPE string.
      lv_filetype = 'PDF'.
      lv_file_name = <name of ur file>.
    DATA: tb_file_data TYPE TABLE OF text4096.
    * FM call to upload file
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = lv_file_name
          filetype                = lv_filetype
          has_field_separator     = lv_gui_sep
        TABLES
          data_tab                = tb_file_data
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "gui_upload
    I dont think you can save the data into sap tables in PDF format.
    With the above code you can save data into an internal table.
    Regards,
    Manish

  • How to attach the PDF file in spool to an email?

    Dear friends,
        I need to attach the PDF file generated in the spool (SP01) to email.
    The PDF file is generated from VL02N at the time of Post Goods Issue .
    Thanks,
    Vidya.

    Hi,
    Refer to the link it is explained how to configure the output type to send the email with PDF attachment on saving the Billing Document.. you need to do the same way..
    Email Billing document as PDF Attachment while saving from VF01/02

  • How to show the pdf file of km in the portal?

    Hi all,
    I want to create a iView to display the PDF file of KM, how to do it?
    Thanks

    Hi Guang,
    You can create a KM document iview or a KM Navigation iview.
    Please refer to this document for the screenshots to creates these iviews.
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0235c19-9493-2b10-64a5-8487b23a7a41
    Cheers!
    Sandeep Tudumu

  • How to show the pdf file into the UIWebView from iphone documents directory?

    Hi ,
         I am working on web services right now I am getting string into base64 format. After decoding that string into NSData i am saving that data as a pdf into Document directory of iphone. Now the problem is that when I want to show the pdf into UIwebView then it is showing blank page. But when I am checking into /Users/pareshkarnawat/Library/Application Support/iPhone Simulator/4.3.2/Applications/ the pdf file is correctly generated and working fine when I ope it.
       How to show that pdf file into UIwebview ? or is there any alernative for this.
    Any ideas on how I can go about this? I have looked at a few posts and still can't seem to figure it out.
    Any idea's appreciated, thanks

    The result is a UIWebView that displays a blank page. No errors occur in the UIWebView delegate method. The thing is that data has the correct length, in bytes, for the PDF I am trying to display, and I also get the pdf file in Library/Application Support/iPhone Simulator/4.3.2/Applications/ Does anyone have an idea as to what might be going wrong here or how I can better debug this problem?

  • Urgent, SOS for help: How to show the pdf file name at the right bottow of the page?

    I want to show the pdf file name at the right bottow of the page for filing purpose, anybody knows anything?
    I know it can be showed at the left bottom through adobe printer, but i need it to be at the right bottom.
    thanks.

    The result is a UIWebView that displays a blank page. No errors occur in the UIWebView delegate method. The thing is that data has the correct length, in bytes, for the PDF I am trying to display, and I also get the pdf file in Library/Application Support/iPhone Simulator/4.3.2/Applications/ Does anyone have an idea as to what might be going wrong here or how I can better debug this problem?

  • K1- How to copy the *.pdf file to K1 , and what dir to copy to ???

    I did not install SD card into my K1 .
    When I connected K1 to my PC (window XP) I saw the directories:
    - Alarms.
    - capture.
    I had some book in *.pdf file format. I like to copy those pdf file to K1 so I can read under Adobe reader. What DIRECTORY I should copy to ?????
    Best Regards.

    You can put the PDF files anywhere you want, as long as you remember where you put them. Just as you'd do on a desktop operating system, like Windows or OS X, open a file manager app on your K1, and use the file manager app to navigate to your PDF file. Tap on the PDF file and Android will ask you which program (like Adobe Reader) you want to use to open it. For file managers, I like this one: https://market.android.com/details?id=com.rhmsoft.fm.hd It's ad-supported though, so there'll be a little advertisement in the corner. Or use the file manager app that is preinstalled on the K1.

  • How to store the pdf file

    hi all,
    i need a pl/sql code to store the pdf file into the oracle database using blob.
    help me.
    Thanks in advance

    rabbott wrote:
    My first question is "where is the PDF file located"? If the answer is "on a file system accessible to the Oracle database" Then you can use directory objects and the DBMS_LOB package. It would look something like this:
    as SYS user do:
    -- assume the PDF files are in /data/documents <font face="tahoma,verdana,sans-serif" size="1" color="#000">files</font>ystem directory
    create or replace directory pdfdir as '/data/documents';
    grant read on directory pdfdir to <USER>;
    as USER do:
    create table mydocs (id integer primary key, doc blob);
    declare
    bf bfile;
    b blob;
    src_offset integer := 1;
    dest_offset integer := 1;
    begin
    -- insert a new blob and return it to local variable
    insert into mydocs values(1, empty_blob()) returning doc into b;
    -- open the bfile for file "summary.pdf"
    bf := bfilename('PDFDIR', 'summary.pdf');
    dbms_lob.loadBlobFromFile(b, bf, dbms_lob.lobmaxsize, dest_offset, src_offset);
    -- done
    commit;
    end;
    /I have the issue which is similar to what you have faced, I'll follow what you said to take a try, Thanks a lot!

Maybe you are looking for

  • What do I need to transfer video and audio from my 2009 Macbook to my television?

    I want to watch a movie with my family tonight, but the DVD is broken. I was planning on renting the movie online and transferring the video and audio from my Macbook to the television. What cables will I need to accomplish this? Also, does anyone kn

  • Datetime in log is greater than current date, how to adjust them

    our env is jes8.1 and solaris 8, and the datetime of log in jes is 8 hours greater than current date in solaris, I want to know how to adjust datetime of log to current date?

  • Queue name qualification

    We are using advanced queues. There's a user TIA which owns all db objects, one of those is advanced queue named AQ_INT_ONLINE_QUEUE_SEND. There's a package BCP_INT_ONLINE in which there's a function SendToAs, that (besides others) enqueue a message

  • Simple Applet does not run in IE 5.0

    Hi, Am trying to run a simple applet in IE 5.0 on MS Window NT Server machine. I disabled the JVM option in Tools/Internet Options/Advanced/Java column. I have MS VM(Miscrosoft Virtual Machine) JIT(Just In Time Compiler) enabled. As a result any appl

  • ISight Recording Speed

    Hi there. I recently published a video on Youtube, but when I played the video back, the audio was regular speed but the video itself was in super speed. Someone on the Youtube help forum said to check and see if my iSight webcam is recording videos