How to Print Tiff File?

Hi can any one tell me how to print the Tiff Image.

import java.awt.print.*;
import javax.media.jai.*;
import javax.swing.JFileChooser;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.image.RenderedImage;
import java.awt.geom.AffineTransform;
public class PrintTest implements Printable{
    RenderedImage image;
    public PrintTest(RenderedImage image) {
        this.image = image;
    public int print(Graphics g, PageFormat pf, int page) throws
                                                        PrinterException {
        if (page > 0) {
            return NO_SUCH_PAGE;
        Graphics2D g2d = (Graphics2D)g;
        int x = (int) ((pf.getImageableWidth() - image.getWidth())/2 +
                pf.getImageableX());
        int y = (int) ((pf.getImageableHeight() - image.getHeight())/2 +
                pf.getImageableY());
        g2d.drawRenderedImage(image,AffineTransform.getTranslateInstance(x, y));
        return PAGE_EXISTS;
    public static void main(String args[]) {
        JFileChooser chooser = new JFileChooser();
        if(chooser.showOpenDialog(null) != JFileChooser.APPROVE_OPTION) {
            System.exit(0);
        RenderedImage toPrint = JAI.create("fileload",
                chooser.getSelectedFile().toString());
        toPrint.getTile(0,0); //force image load
        PrinterJob job = PrinterJob.getPrinterJob();
        job.setPrintable(new PrintTest(toPrint));
        if(job.printDialog()) {
            try{
                job.print();
            }catch(PrinterException ex) {
                ex.printStackTrace();
}

Similar Messages

  • 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 a File in JSFF

    Hi All,
    Anyone tried printing file through printer in JSC2.????????
    Expecting some Suggestions!!!!!!!!!!!!!!!!!!!!!!!!!!
    regards,
    Josh Machine

    If your question is how to call print from a button in the form:
    Go to the jsp page, and add to the print button attribute
    onClick="window.print()"
    <ui:button binding="#{Page1.button1}" id="button1" style="position: absolute; left: 288px; top: 120px" text="Button" onClick="window.print()"/>
    you can also do this by seelcting the button, and in the properties window, under javascript set the onClick property to window.print
    If you are question is how to print a file through the Creator IDE, you can use the File -> Print.
    To access the IDE's general print properties, choose Tools > Options > Advanced radio button, and then choose IDE Configuration > System > Print Settings. Expand the Print Settings node to select an individual editor.
    hope this helps
    Radhika
    http://blogs.sun.com/Radhika

  • 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 upload 'Tiff' file in scripts

    hi
    how to upload 'Tiff' file in scripts

    HI,
    To insert logo in SAP script, follow the steps below:
    /: INCLUDE Z_YOUR_LOGO OBJECT TEXT ID ST LANGUAGE E
    These are the steps to be followed for uploading graphics in R/3 system
    1. First save the file as BMP
    2. Open the BMP file in IMaging (Goto -> Programs -> Accessories -> Imaging) and
    make it Zoom as 100% and save as *.TIFF
    3. Open SE38 and execute program RSTXLDMC
    4. Give your TIFF file path name
    5. Select Bcol (for Color)
    6. TEXT ID will be ZHEX-MACRO-*.
    7. Inplace of * write your own logo name (ZCOMPANYLOGO)
    8. Execute the program
    9. Now Goto SE71 create your ZFORM
    10. Create logo window
    11. Goto text element of logo window
    or
    In 4.6x :-
    1. Goto SE71 Change the mode to GRAPHICAL
    2. Choose the Graph Tabstrips
    3. Now type in some name for the LOGO WINDOW
    4. Press the IMPORT BUTTON and then IMPORT the BMP file from your DESKTOP
    5. The code will be written automatically. You just need to drag and drop wherever you want
    the graphics to be.
    Regards,

  • 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

  • Printing Tiff File Format

    Is there anyway to print the tiff file present in the server on the client side?
    1.tiff file cannot be displyed on the browser ,so i cannot use javascript's [window.print() command].
    2.If i am using JAI jar then that works only on the server side{i.e when the clent cliks the print button the print dialog displays on the server side]
    3.If i will download the tiff file into local then client has to manualy go to that physical path where that tiff file was saved and print it.but requirement is to print from the front end.
    4.If i will use applet then how will i pass that tiff file name from the html.
    because if i use
    <PARAM NAME="imageName" VALUE="C:\\amarshi\\TIFF.tif">
    then the the value of imageName in the Applet class (using get{Parameter("imagename") comes as null.
    but if i use jpg,png or gif format then the value is not null.
    5.I also tried with JFrame ,but that also works on the server side only.
    plz suggest me ..its very very urgent .
    Thanks
    Amarshi                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    I had searched in goolge ,but there are some tools which support either IE
    or mozilla .I didnt found any tool supporting both the browser.
    Morever if i will use thesr tools ,then whenever the user will try to print then they hav to install atleast one the tool.
    the client wants to do this either using tools that will be uiinstalled inside the exe while release or do from coding side.
    They dont want that the user will have to install the tool to view the .tiff file for printing.
    And whatever jars i am using in the java side they work only on the server side??

  • How to show tiff files in sharepoint

    Hello,
    Ee have a bunch of scanned documents saved as tiff. How can I show them? Web app server won't preview them and this is a real big issue.
    On the other hand, websio does the job, but  I wouldn't like to have websio and web app server coexist.
    Is there anoter solution? I'm conmortable for a web part put in viewitem.aspx that shows the tiff file underneath the metadaa.
    Christos

    Hi,
    Below links seems to be the similar issue,
    http://social.msdn.microsoft.com/Forums/en-US/339fa5d3-1f77-462f-8b04-fd5efdf77479/opening-tiff-files-inbrowser?forum=sharepointgeneralprevious
    Let us know if that helped you or not.
    Regards,
    Purvish Shah

  • How to print pdf file not using the the adobe reader ?

    hello,
    i used the adobe sdk to open a pdf file in read and modify it serveral times and each time save it to another directory,and now i need to write a program to print the pdf file in this directory.when print the file,i want to continue my work also,so who i tell me how to solve this problem?
    thanks.

    The SDK is only a collection of documentation and headers that show you how to interact with and automate Adobe Acrobat and to some extent Adobe Reader. You need a copy of Acrobat or Reader installed on the system in order to use any of the SDK functions. You cannot "print not using the Adobe Reader", unless you have Adobe Acrobat installed on the system instead of Reader.

  • 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 a file index in mac os 10.9

    How do I print a file index in 10.9?

    I don't have a plain CD, but I tried a CD-RW and the ability to leave it appendable was not available. I'm not sure if that is related to CD-RW or if the feature was dropped in Mavericks.
    Check the More Like This links on the right.
    The process previously was to create an image of the folder that held the things you wanted to burn. Then, in Disk Utility, burn the image to disk and check the box to leave it appendable. This was only available for CDs, not DVDs.
    You might try some other burning software.

  • 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 .sql file name in the same file using sqlplus

    Oracle 10g on Linux platform.
    I am trying to print the name of .sql script file in that file but could not. Following is the file:
    test.sql
    select '&0' from dual;But instead of printing, it is asking for input:
    SQL> @test.sql
    Enter value for 0: Can any body give me a hint as how can i print the file name.

    Use this
    SELECT FNAME_KRBMSFT AS name FROM X$KRBMSFT
    and see
    SQL> create or replace procedure get_dir_list
    2 (p_directory varchar2)
    3 is
    4 l_null varchar2(100);
    5 l_directory varchar2(100);
    6 BEGIN
    7 l_directory := p_directory;
    8 sys.dbms_backup_restore.searchfiles(l_directory, l_null);
    9 FOR x IN (select fname_krbmsft fname from x$krbmsft) LOOP
    10 dbms_output.put_line(x.fname);
    11 END LOOP;
    12
    13 END;
    14 /
    Edited by: HuaMin Chen on Jun 26, 2012 12:26 PM

  • How can print a file PDF from  form

    Hi to all,
    I need to print a file PDF from form (developer 6i), Is IT POSSIBLE?
    Thank you
    Silvia

    "Print" probably won't work for a pdf file. As the HOST command try:
    host('<path_to>/AcroRd32.exe /t pathname "printername" "drivername" "portname"');See "How do I use the Windows command line with Acrobat and Adobe Reader?" in:
    http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/Acrobat_SDK_developer_faq.pdf

Maybe you are looking for

  • Billing created on date as the baseline date in FBL5N

    Hello All, We have a requirement where the baseline date in FBL5N (BSEG-ZFBDT) should be the Billing document created ( VBRK-ERDAT) and not the accounting document created on date. I tried changing the Payment terms to "Document date" but it does not

  • Datatable header display issue

    Hi, I need to display more then one component in the header of a datatable. Currently, we are able to display the table along with the header values using datatable. Next to the header we want to display 2 icons, one to denote sorted by descending an

  • Adobe livecycle server installable link

    Hi, Could someone provide me link to download adobe livecycle ES2 version 9.0 for AIX (64 bit). We have license and infact my senior has given me adobe lc server installable but for windows (64 bit) but i need it for AIX(64 bit). Please help me and p

  • SalesOpportunityEBM missing in ebm file

    Hi, I am not able to locate SyncSalesOpportuntiyEBM in the SalesOpportunityEBM.xsd file that is delivered in FP 11g R1 on edelivery. Can you please advice if there will be a patch to include this? Thanks Sathya

  • PDF Report Output

    Hi, In relation to thread: PLPDF experience / references has anyone tried using the XML/PDF Access API for Java (XPAAJ) (http://www.adobe.com/devnet/livecycle/downloads/xpaaj.html) to generate PDF Reports from Apex? Having had a look at PL/PDF, I'm w