How to print PDF files directly from SAP?

We have created output that is being saved in a PDF format. We can store it on any drive or send it through email. However, we would like to be able to print a PDF file directIy without any manual intervention. Now users still have to open the file and hit the print button and we want to avoid this. So basically we want to be able to create e.g. a sales order, generate an order confirmation in PDF format and send it directly to the output device that we stored in output master data. I have a feeling it is not possible to print directly because output device has to be like a PDF1 to create the PDF file itself and there is no space left somewhere to store the physical output device. We use ECC 5.
kind regards
Angelique Heutinck

You can use this custom FM -:)
  FUNCTION Z_PDF_DOWNLOAD.
*"*"Interfase local
*"  IMPORTING
*"     REFERENCE(FILENAME) TYPE  STRING
    SELECT RQIDENT
    INTO (T_TSP01-RQIDENT)
    FROM TSP01
    WHERE RQOWNER EQ SY-UNAME
      AND RQCLIENT EQ SY-MANDT.
    APPEND T_TSP01.
    ENDSELECT.
    SORT T_TSP01 DESCENDING.
    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
         EXPORTING
              SRC_SPOOLID              = T_TSP01-RQIDENT
              NO_DIALOG                = ''
         IMPORTING
              PDF_BYTECOUNT            = NUMBYTES
              PDF_SPOOLID              = PDFSPOOLID
              BTC_JOBNAME              = JOBNAME
              BTC_JOBCOUNT             = JOBCOUNT
         TABLES
              PDF                      = PDF
         EXCEPTIONS
              ERR_NO_OTF_SPOOLJOB      = 1
              ERR_NO_SPOOLJOB          = 2
              ERR_NO_PERMISSION        = 3
              ERR_CONV_NOT_POSSIBLE    = 4
              ERR_BAD_DSTDEVICE        = 5
              USER_CANCELLED           = 6
              ERR_SPOOLERROR           = 7
              ERR_TEMSEERROR           = 8
              ERR_BTCJOB_OPEN_FAILED   = 9
              ERR_BTCJOB_SUBMIT_FAILED = 10
              ERR_BTCJOB_CLOSE_FAILED  = 11
              OTHERS                   = 12.
    IF SY-SUBRC EQ 0.
      CALL FUNCTION 'GUI_DOWNLOAD'
           EXPORTING
                BIN_FILESIZE            = NUMBYTES
                FILENAME                = FILENAME
                FILETYPE                = 'BIN'
           TABLES
                DATA_TAB                = PDF
           EXCEPTIONS
                FILE_WRITE_ERROR        = 1
                NO_BATCH                = 2
                GUI_REFUSE_FILETRANSFER = 3
                INVALID_TYPE            = 4
                NO_AUTHORITY            = 5
                UNKNOWN_ERROR           = 6.
      IF SY-SUBRC EQ 0.
        DELETE FROM TSP01 WHERE RQIDENT EQ T_TSP01-RQIDENT.
      ENDIF.
    ENDIF.
  ENDFUNCTION.
Greetings,
Blag.

Similar Messages

  • How to print PDF file content from ABAP in background?

    Hi,
    Is it possible to print PDF file content from ABAP in background?
    I have some PDF content which I need to print it, these PDF files are generated outside the SAP.
    Please have you any suggestions?
    Thank you
    Tomas

    <b><u>Solution:</u></b><br>
    <br>
    The target output device must support PDF print, this is only one limitation.<br>
    <br>
    REPORT  z_print_pdf.
    TYPE-POOLS: abap, srmgs.
    PARAMETERS: p_prnds LIKE tsp01-rqdest OBLIGATORY DEFAULT 'LOCL',
                p_fname TYPE file_table-filename OBLIGATORY LOWER CASE,
                p_ncopi TYPE rspocopies OBLIGATORY DEFAULT '1',
                p_immed AS CHECKBOX.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
      DATA: lv_rc     TYPE i,
            lv_filter TYPE string.
      DATA: lt_files TYPE filetable.
      FIELD-SYMBOLS: <fs_file> LIKE LINE OF lt_files.
      CONCATENATE 'PDF (*.pdf)|*.pdf|' cl_gui_frontend_services=>filetype_all INTO lv_filter.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          file_filter             = lv_filter
        CHANGING
          file_table              = lt_files
          rc                      = lv_rc
        EXCEPTIONS
          OTHERS                  = 1.
      IF sy-subrc NE 0 AND lv_rc EQ 0.
        MESSAGE 'Error' TYPE 'E' DISPLAY LIKE 'S'.
      ENDIF.
      READ TABLE lt_files ASSIGNING <fs_file> INDEX 1.
      IF sy-subrc EQ 0.
        p_fname = <fs_file>-filename.
      ENDIF.
    AT SELECTION-SCREEN.
      DATA: lv_name   TYPE string,
            lv_result TYPE boolean.
      lv_name = p_fname.
      CALL METHOD cl_gui_frontend_services=>file_exist
        EXPORTING
          file                 = lv_name
        RECEIVING
          result               = lv_result
        EXCEPTIONS
          OTHERS               = 1.
      IF sy-subrc NE 0.
        MESSAGE 'Bad file!' TYPE 'E' DISPLAY LIKE 'S'.
      ENDIF.
      IF lv_result NE abap_true.
        MESSAGE 'Bad file!' TYPE 'E' DISPLAY LIKE 'S'.
      ENDIF.
    START-OF-SELECTION.
    END-OF-SELECTION.
      PERFORM process.
    FORM process.
      DATA: lv_name     TYPE string,
            lv_size     TYPE i,
            lv_data     TYPE xstring,
            lv_retcode  TYPE i.
      DATA: lt_file TYPE srmgs_bin_content.
      lv_name = p_fname.
      CALL METHOD cl_gui_frontend_services=>gui_upload
        EXPORTING
          filename                = lv_name
          filetype                = 'BIN'
        IMPORTING
          filelength              = lv_size
        CHANGING
          data_tab                = lt_file
        EXCEPTIONS
          OTHERS                  = 1.
      IF sy-subrc NE 0.
        MESSAGE 'Read file error!' TYPE 'E' DISPLAY LIKE 'S'.
      ENDIF.
      CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
        EXPORTING
          input_length = lv_size
        IMPORTING
          buffer       = lv_data
        TABLES
          binary_tab   = lt_file
        EXCEPTIONS
          failed       = 1
          OTHERS       = 2.
      IF sy-subrc NE 0.
        MESSAGE 'Binary conversion error!' TYPE 'E' DISPLAY LIKE 'S'.
      ENDIF.
      PERFORM print USING p_prnds lv_data CHANGING lv_retcode.
      IF lv_retcode EQ 0.
        WRITE: / 'Print OK' COLOR COL_POSITIVE.
      ELSE.
        WRITE: / 'Print ERROR' COLOR COL_NEGATIVE.
      ENDIF.
    ENDFORM.                    " PROCESS
    FORM print USING    iv_prndst  TYPE rspopname
                        iv_content TYPE xstring
               CHANGING ev_retcode TYPE i.
      DATA: lv_handle    TYPE sy-tabix,
            lv_spoolid   TYPE rspoid,
            lv_partname  TYPE adspart,
            lv_globaldir TYPE text1024,
            lv_dstfile   TYPE text1024,
            lv_filesize  TYPE i,
            lv_pages     TYPE i.
      CLEAR: ev_retcode.
      CALL FUNCTION 'ADS_SR_OPEN'
        EXPORTING
          dest            = iv_prndst
          doctype         = 'ADSP'
          copies          = p_ncopi
          immediate_print = p_immed
          auto_delete     = 'X'
        IMPORTING
          handle          = lv_handle
          spoolid         = lv_spoolid
          partname        = lv_partname
        EXCEPTIONS
          OTHERS          = 1.
      IF sy-subrc NE 0.
        ev_retcode = 4.
        RETURN.
      ENDIF.
      CALL FUNCTION 'ADS_GET_PATH'
        IMPORTING
          ads_path = lv_globaldir.
      CONCATENATE lv_globaldir '/' lv_partname '.pdf' INTO lv_dstfile.
      OPEN DATASET lv_dstfile FOR OUTPUT IN BINARY MODE.
      IF sy-subrc NE 0.
        ev_retcode = 4.
        RETURN.
      ENDIF.
      TRANSFER iv_content TO lv_dstfile.
      IF sy-subrc NE 0.
        ev_retcode = 4.
        RETURN.
      ENDIF.
      CLOSE DATASET lv_dstfile.
      IF sy-subrc NE 0.
        ev_retcode = 4.
        RETURN.
      ENDIF.
      CALL FUNCTION 'ZBAP_RM_PDF_GET_PAGES'
        EXPORTING
          iv_content = iv_content
        IMPORTING
          ev_pages   = lv_pages.
      lv_filesize = XSTRLEN( iv_content ).
      CALL FUNCTION 'ADS_SR_CONFIRM'
        EXPORTING
          handle   = lv_handle
          partname = lv_partname
          size     = lv_filesize
          pages    = lv_pages
          no_pdf   = ' '
        EXCEPTIONS
          OTHERS   = 1.
      IF sy-subrc NE 0.
        ev_retcode = 4.
        RETURN.
      ENDIF.
      CALL FUNCTION 'ADS_SR_CLOSE'
        EXPORTING
          handle = lv_handle
        EXCEPTIONS
          OTHERS = 1.
      IF sy-subrc NE 0.
        ev_retcode = 4.
        RETURN.
      ENDIF.
    ENDFORM.                    " PRINT

  • Print pdf file directly from a folder, Adobe Reader X in  Windows Server 2003

    In previous versions of Adobe Reader we were able to print pdf files groupwise directly when selected in a folder.
    Now I've installed Reader X on the Windows Server 2003 environment. Logged in as administrator I can still select <Print> by selecting the right mouse button in a folder. Logged in as a user, this is not available.
    I checked user-rights and permissions and made sure they have full control.
    Someone who can help us in this matter?
    Thanks

    Thanks for your reply.
    The file menu doesn't show the print option either. We used to work this way, after installing the 9.0 and Reader X version, this option has disappeared from both the File menu and the right mouse button. For other filetypes, for example Excel the Print option is still available and works properly. Logged in as administrator on the serverconsole, there is no problem. So it seams to be something specific to pdf-formats in a server 2003 environment. The userrights are all set on full control (same as administrator).
    Thanks again

  • How to Print PDF in background from SAP directory

    Hi,
    My PDF file is there in SAP directory, I want to Print the PDF file without opening it . how can i Print in background mode.
    Please help me ASAP.
    thanks in advance

    Hey,
    i'm having a similar problem here: I want to print a PDF from KW_Storage in background. Any ideas?
    Jens

  • Print PDF file directly to store printer

    Hi Gurus,
    Having not found a solution, we think we need help from you. We have searched forums and google but have not found adequate solutions.
    We are a retailer having different stores. Our main office is using SAP. Each store has its printer and defined in our SAP system. We want to print PDF files directly to store printer using SAP . How should we do that ? We think there are 2 steps:
    1) Upload PDF files from network directory into SAP (We done it, no problem)
    2) Having now PDF files in internal tables, how should we proceed to print PDF files using store printers?
         Please note that we do not want to use CL_GUI_PDFVIEWER since we do not want to display the PDF and having the obligation to choose the print option from dialog and also we do not want to call Adobe OLE object  to print
    Any answer would be appreciated
    Thank you very much

    Hi,
    It is really late to give response this post. But still who ever refering to this post for the same issue this solution is useful for achieving same in background:
    Even same can be used in smartforms, for getting spool request in PDF format as well which will decrease the size of file when printing in SAP printer.
    ct_tline is PDF output:
    DATA: lv_pdfsource TYPE xstring.
    FIELD-SYMBOLS:<p> TYPE x. " <p> type any.
    LOOP AT ct_tline INTO cs_tline.
      ASSIGN cs_tline TO <p> CASTING TYPE x.
      CONCATENATE lv_pdfsource <p> INTO lv_pdfsource IN BYTE MODE.
    ENDLOOP.
    * ->Create spool request in PDF format
    CALL FUNCTION 'ADS_CREATE_PDF_SPOOLJOB'
      EXPORTING
        printer  = 'LOCL'            "Printer name supporting PDF device type
    *   DEST     =
        pages    = 1
        pdf_data = lv_pdfsource        "XSTRING internal table
    *   NAME     =
    *   SUFFIX1  =
    *   SUFFIX2  =
    *   COPIES   =
    *   PRIO     =
        IMMEDIATE_PRINT         = 'X'
    *   AUTO_DELETE             =
    *   TITLELINE               =
    *   RECEIVER =
    *   DIVISION =
    *   AUTHORITY               =
    *   LIFETIME = '0'
    * IMPORTING
    *   SPOOLID  =
    * EXCEPTIONS
    *   NO_DATA  = 1
    *   NOT_PDF  = 2
    *   WRONG_DEVTYPE           = 3
    *   OPERATION_FAILED        = 4
    *   CANNOT_WRITE_FILE       = 5
    *   DEVICE_MISSING          = 6
    *   NO_SUCH_DEVICE          = 7
    *   OTHERS   = 8
    IF sy-subrc <> 0.
    * Implement suitable error handling here
    ENDIF.

  • Orarrp can't print pdf file directly to printer

    oracle remote print utility (orarrp) can't print pdf file directly to printer.
    we expect orarrp utility can handle ".rrpa" file (i.e. pdf file generated on the application server) by directly print the file to the client's printer, i.e. invoke the acrobat reader on the client side, display the the printer selection dialogue, after confirmation print the pdf file, then the acrobat reader close automatically nicely.
    However we are disappointed as the acrobat reader startup and display the pdf file content but does not print and does not close.
    After testing the problem several times, there are some findings:-
    Finding (A):-
    (a) for the success of direct printing of pdf file, a physical path must be provided; we have tried 2 methods:
    1) using drag & drop to copy the pdf file directly to the browser
    2) open pdf file in the browser directly using browser menu-->File-->Open.
    (b) for the failure of direct printing, a virtual path is involved and we have also tried 2 methods:
    1) when web.show_document() is used
    2) enter the url to the URL bar of the browser,
    eg. http://appsvr.com:7777/report/test_printout/APPSVR1094707.rrpa (this is a virtual path/url)
    Finding (B):-
    (a)when the physical path is used, a temporary pdf file is generated in the same directory where the rrpa file exists in the application server,
    e.g. in application server: d:/printout/yyy.pdf is generated for d:/printout/xxx.rrpa when direct print occurs
    (b) however when the virtual path is used, there is no such temp "pdf" file generated and direct print failed.
    May be when virtual path is used, orarrp utility don't know where to generate the temp "pdf" so direct print doesn't occur.
    So, anyone has similar experience or further queries or has solutions, please join.
    Thanks for your attention.

    Hi,
    It is really late to give response this post. But still who ever refering to this post for the same issue this solution is useful for achieving same in background:
    Even same can be used in smartforms, for getting spool request in PDF format as well which will decrease the size of file when printing in SAP printer.
    ct_tline is PDF output:
    DATA: lv_pdfsource TYPE xstring.
    FIELD-SYMBOLS:<p> TYPE x. " <p> type any.
    LOOP AT ct_tline INTO cs_tline.
      ASSIGN cs_tline TO <p> CASTING TYPE x.
      CONCATENATE lv_pdfsource <p> INTO lv_pdfsource IN BYTE MODE.
    ENDLOOP.
    * ->Create spool request in PDF format
    CALL FUNCTION 'ADS_CREATE_PDF_SPOOLJOB'
      EXPORTING
        printer  = 'LOCL'            "Printer name supporting PDF device type
    *   DEST     =
        pages    = 1
        pdf_data = lv_pdfsource        "XSTRING internal table
    *   NAME     =
    *   SUFFIX1  =
    *   SUFFIX2  =
    *   COPIES   =
    *   PRIO     =
        IMMEDIATE_PRINT         = 'X'
    *   AUTO_DELETE             =
    *   TITLELINE               =
    *   RECEIVER =
    *   DIVISION =
    *   AUTHORITY               =
    *   LIFETIME = '0'
    * IMPORTING
    *   SPOOLID  =
    * EXCEPTIONS
    *   NO_DATA  = 1
    *   NOT_PDF  = 2
    *   WRONG_DEVTYPE           = 3
    *   OPERATION_FAILED        = 4
    *   CANNOT_WRITE_FILE       = 5
    *   DEVICE_MISSING          = 6
    *   NO_SUCH_DEVICE          = 7
    *   OTHERS   = 8
    IF sy-subrc <> 0.
    * Implement suitable error handling here
    ENDIF.

  • How to print pdf files not using acrobat product?

    i just want to print pdf files,but not want to use the adobe acrobat or acrobat reader,just want to write a tools print pdf files directly.

    > no i just want to print it,not need to read it.can you help me?
    Well, the problem is to print it you need to be able to read it. Something needs to convert it into a format the printer can understand (most printers are PostScript or PCL).
    I'm not sure you entirely understand what a PDF file is. It's not a fancy text file. It's a binary format. Saying "I want to print a PDF without a PDF interpreter" is like saying "I want to run an EXE without Windows". You need software to interpret the format.
    You certainly can write your own software to interpret the PDF format, convert it to a print language and output that to a printer, but as Aandi said you will need to start by reading the PDF Reference so you know how the inside of a PDF file works, and it will most likely take several years of development even for a seasoned, expert programmer. It's just not as simple as "Printer, meet PDF. PDF, meet printer."

  • How to print PDF files

    How to print PDF files????

    Please see FAQ: How to print a PDF file from Adobe Reader Touch.
    If you don't see the Print button in the toolbar, please update to the latest version of Adobe Reader Touch.
    FAQ: How to update Adobe Reader Touch to the latest version
    The latest version (1.2) also includes newly supported features such as Commenting (adding Sticky Notes, Highlight, Strikeout, and Underline), Save/Save As, and Go to Page.
    Here's the blog post by Dennis Griffin (Product Manager for Adobe Reader for Tablets and Smartphones).
    Adobe Reader Touch for Windows 8 adds Comments and More

  • How to print PDF files using java print API

    Hi,
    I was goign throw lot of discusion and reading lot of forums related to print pdf files using java api. but nothing seems to be working for me. Can any one tell me how to print pdf files using java api.
    Thanks in advance

    Mike,
    Can't seem to get hold of the example described in your reply below. If you could let us have the URL to get then it would be great.
    My GUI application creates a pdf document which I need to print. I want to achieve this using the standard Java class PrinterJob (no 3rd party APIs I'm afraid, commercial restraints etc ..). I had a stab at it using the following code. When executed I get the pretty printer dialog then when I click ok to print, nothing happens!
    boolean showPrintDialog=true;
    PrinterJob printJob = PrinterJob.getPrinterJob ();
    printJob.setJobName ("Contract.pdf");
    try {
    if (showPrintDialog) {
    if (printJob.printDialog()) {
    printJob.print();
    else
    printJob.print ();
    } catch (Exception PrintException) {
                   PrintException.printStackTrace();
    Thank you and a happy new year.
    Cheers,
    Chris

  • How to print Pdf files using Adobe Reader

    How to print Pdf files using Adobe Reader

    Open the PDF file with File > Open... in Adobe Reader and print it with File > Print

  • How to print PDF file from java application?

    Hi,
    I have a java application that needs to print an PDF files. Could any one provide me links to tutorial/sample codes for doing this?

    http://onesearch.sun.com/search/onesearch/index.jsp?qt=print+pdf+files&subCat=&site=dev&qp=&chooseCat=javaall&col=developer-forums

  • How to print the file name in sap

    Hi All,
    I have requirment like,
    there is a folder in my local system, inside that folder there are 10 Excel file like file1.xls,file2.xls..............file10.xls
    how to print the file name of all these file in SAp like
    file1.xls
    file2.xls
    file3.xls
    file4.xls
    file10.xls
    Appropriate points will be rewarded.
    Thanks in Advance
    Arun kumar

    Hi,
    Still you are facing any problem with this code expalin the problem with details , otherwise close this thread.
    Use Method <b>cl_gui_frontend_services=>directory_list_files</b> to read file names for a given directory
    after reading the files then Use FM : <b>RSPO_SX_OUTPUT_TEXTDATA</b> to create spool from internal table data and print the data.
    <b>sample code :</b>
    data: desktop_dir type string.
    data: ifiles type table of string.
    data: xfiles type string.
    data: count type i.
    data: filepath type string.
    call method cl_gui_frontend_services=>get_desktop_directory
      changing
        desktop_directory    = desktop_dir .
    call method cl_gui_cfw=>flush.
    call method cl_gui_frontend_services=>directory_list_files
      exporting
        directory                   = desktop_dir
    *    filter                      = '*.xls'
         files_only                  = 'X'
    *        DIRECTORIES_ONLY            =
      changing
        file_table                  = ifiles
        count                       = count.
      DATA : x_name       LIKE tsp03d-name,
             x_dest       LIKE tsp03d-padest VALUE 'LOCL',
             x_rows       LIKE sxpcklsti1-body_num VALUE 0,
             x_startrow   LIKE sxpcklsti1-body_start VALUE 1,
             x_pages      LIKE rspotype-pages VALUE 1,
             x_pages_1    TYPE p DECIMALS 2,
             x_rqtitle    LIKE sxpcklsti1-obj_descr,
             x_rqcopies   TYPE i VALUE 1,
             x_rqowner    LIKE trdyse01cm-username,
             x_immediate  LIKE pri_params-primm VALUE ' ',
             x_rqid       LIKE tsp01-rqident,
             i_contents    LIKE  solisti1 OCCURS 0 WITH HEADER LINE,
          x_pages   = 1.
          x_rqowner = sy-uname.
          x_dest     = 'LOCL'.
          x_startrow = 1.
          x_rqcopies = 1.
          x_immediate = 'X' .
          CALL FUNCTION 'RSPO_SX_OUTPUT_TEXTDATA'
           EXPORTING
    *       name                 =   x_name
             dest                 =  x_dest
             rows                 =  x_rows
             startrow             =  x_startrow
             pages                =  x_pages
             rqtitle              =  x_rqtitle
             rqcopies             =  x_rqcopies
             rqowner              =  x_rqowner
             immediately          =  x_immediate
           IMPORTING
             rqid                 =  x_rqid
           TABLES
             text_data            = i_contents
           EXCEPTIONS
             name_missing         = 1
             name_twice           = 2
             not_found            = 3
             illegal_layout       = 4
             internal_error       = 5
             size_mismatch        = 6
             OTHERS               = 7.
          IF sy-subrc <> 0.
    ** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    **         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    Regards
    Appana
    *Reward Points for helpful answers
    Message was edited by: L Appana

  • How to print PDF file with hp-ux 11.31 on itanium

    We finished upgrade from 11.5.7 to 12.1.1.
    With 11.5.7 ( pa-risc hp-ux 11.23 ) we print our pdf file in using acroread to convert them in postscript and print them to printer.
    In our 12.1.1 environment ( itanium hp-ux 11.31 ) ; acroread is not available on itanium.
    Which tool can we use to be able to print PDF file on itanium ( itanium pdf to postscript tool ) free
    Thanks
    Marc

    Pl see MOS Doc 778970.1 (How to Print PDF/UTF8 in R12?)
    HTH
    Srini

  • How to print pdf file to my Designjet 500+HPGL2 (C7769B)

    Hi,
    We have HP Designjet 500+GL2 plotter in the office, used to print A1 & A3 drawings. Last time someone from HP install HP eprint & share to my computer for me to print PDF files to the plotter. But my CPU brokedown, so now I'm using a new PC. But now I can't print PDF files to our plotter. Even when I install the eprint & share software from you website.
    I already check the possibility that I'm not connected to the printer but no because when I print test page, it is working. Please help. Thanks.

    Hello lean1025,
    Welcome to the HP Support Forums!
    To get your issue more exposure I would suggest posting it in the commercial forums since this is a commercial product. You can do this at Printers - Designjet & Large Format.
    The support page for your product may be helpful in the meantime: Product Support & Troubleshooting (Select your model)
    I hope this helps!
    JERENDS
    I work on behalf of HP
    Please click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" to the left of the reply button to say “Thanks” for helping!

  • How to  print pdf file by using java print API ? I am trying with this code

    import java.io.FileInputStream;
    import java.io.InputStream;
    import javax.print.Doc;
    import javax.print.DocFlavor;
    import javax.print.DocPrintJob;
    import javax.print.PrintException;
    import javax.print.PrintService;
    import javax.print.PrintServiceLookup;
    import javax.print.SimpleDoc;
    import javax.print.attribute.HashPrintRequestAttributeSet;
    import javax.print.attribute.PrintRequestAttributeSet;
    import javax.print.attribute.standard.Copies;
    import javax.print.attribute.standard.MediaSizeName;
    public class PDFPrint {
    static public void print(InputStream inputStream, PrintService printService) throws PrintException {
    Doc doc = new SimpleDoc(inputStream, DocFlavor.INPUT_STREAM.AUTOSENSE, null);
    PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
    attributes.add(MediaSizeName.ISO_A4);
    attributes.add(new Copies(1));
    print(doc, attributes, printService);
    }//print()
    static public void print(Doc doc, PrintRequestAttributeSet attributes, PrintService printService) throws PrintException {
    if (printService == null) {
    printService = PrintServiceLookup.lookupDefaultPrintService();
    System.out.println("The Printer Name is :"+printService.getName());
    DocPrintJob docPrintJob = printService.createPrintJob();
    System.out.println("Before Print Start()");
    docPrintJob.print(doc, attributes);
    }//print()
    public static void main(String args[])
    PrintService defaultPrintService = PrintServiceLookup.lookupDefaultPrintService();
    String file="c:/BackUp/file.pdf";
    FileInputStream fis=new FileInputStream(file);
    System.out.println("Before Print() called ..");
    print(fis,defaultPrintService);
    System.out.println("After Printing....");
    I am using this code to print pdf file. But when I try this one automatically the printer starting with print ascii codes with infinite loop.
    I am using jdk1.4,Acrobat 8.0, Windows environment.
    Can u help me in this regard'
    Thank u
    grani

    import java.io.FileInputStream;
    import java.io.InputStream;
    import javax.print.Doc;
    import javax.print.DocFlavor;
    import javax.print.DocPrintJob;
    import javax.print.PrintException;
    import javax.print.PrintService;
    import javax.print.PrintServiceLookup;
    import javax.print.SimpleDoc;
    import javax.print.attribute.HashPrintRequestAttributeSet;
    import javax.print.attribute.PrintRequestAttributeSet;
    import javax.print.attribute.standard.Copies;
    import javax.print.attribute.standard.MediaSizeName;
    public class PDFPrint {
    static public void print(InputStream inputStream, PrintService printService) throws PrintException {
    Doc doc = new SimpleDoc(inputStream, DocFlavor.INPUT_STREAM.AUTOSENSE, null);
    PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
    attributes.add(MediaSizeName.ISO_A4);
    attributes.add(new Copies(1));
    print(doc, attributes, printService);
    }//print()
    static public void print(Doc doc, PrintRequestAttributeSet attributes, PrintService printService) throws PrintException {
    if (printService == null) {
    printService = PrintServiceLookup.lookupDefaultPrintService();
    System.out.println("The Printer Name is :"+printService.getName());
    DocPrintJob docPrintJob = printService.createPrintJob();
    System.out.println("Before Print Start()");
    docPrintJob.print(doc, attributes);
    }//print()
    public static void main(String args[])
    PrintService defaultPrintService = PrintServiceLookup.lookupDefaultPrintService();
    String file="c:/BackUp/file.pdf";
    FileInputStream fis=new FileInputStream(file);
    System.out.println("Before Print() called ..");
    print(fis,defaultPrintService);
    System.out.println("After Printing....");
    I am using this code to print pdf file. But when I try this one automatically the printer starting with print ascii codes with infinite loop.
    I am using jdk1.4,Acrobat 8.0, Windows environment.
    Can u help me in this regard'
    Thank u
    grani

Maybe you are looking for

  • BUG in PE 13- cannot open and save projects from PE11!!!!!!!

    For 1 month I'm requesting a TECH Support to resolve a BUG in Adobe Premiere Elements 13 that cannot load and save projects from PE11. I already provided all details several times (about my PC system & exact steps to reproduce a problem, etc) & poste

  • Test Stand File menu item entry point execution in VC++ code

    Hi, Can you please suggest me, how to execute a file menu item entry point pragmatically in a VC++ code. My process model seq inserts an item called "Select Model" into TS file menu. i have to programmatically execute this entrypoint from an Operator

  • Can't hear music with out headphones

    Any suggestions

  • Pen Tool dragging our Bezier's

    I am going round and round over trying to mask something. I set my mask and when I try to use the Bezier handles (yes The Bezier box is checked) It is a crap shoot for IF the bezier's are going to show up or am I going to move the whole mask. I know

  • SAP Netweaver Developer Studio Version Issue

    Dear All, We need a clarification on SAP NWDS version to be installed on client machine. We have standalone SAP NW 7.3 (Enterprise Portal) server. Its SP level is sp00. To develop and deploy portal applications, Which NWDS version we need to use. We