Printing multipages tiff

Hello everybody !
I have developped an applet using JAI library in order to display multipages tiff file (...with previous and next button to display each page).
Now I want it to print one selected page or all pages of the tiff file but I'm a beginner in printing task and I don't know exactly how to do.
I have cut and paste a piece of code doing print job but the window printer display wrong number of page (1 - 9999 whereas there are 3 pages) and if I select all print, just the displayed page is printed ... (?)
If someone can I have a look on used methods...
protected void print()
PrinterJob pj = PrinterJob.getPrinterJob();
pj.setPrintable(this);
if(pj.printDialog())
try
pj.print();
catch(Exception e)
System.out.println(e);
else
System.out.println("Did Not Print Any Pages");
public int print(Graphics g, PageFormat f, int pageIndex)
if(pageIndex >= 1)
return Printable.NO_SUCH_PAGE;
Graphics2D g2d = (Graphics2D) g;
g2d.translate(f.getImageableX(), f.getImageableY());
if(op1 != null)
double scales = Math.min(f.getImageableWidth()/ op1.getWidth(), f.getImageableHeight()/ op1.getHeight());
g2d.scale(scales,scales);
printImage(g2d, op1);
return Printable.PAGE_EXISTS;
else
return Printable.NO_SUCH_PAGE;
public void printImage(Graphics2D g2d, RenderedImage image)
if((image == null)|| (g2d == null)) return;
int x = printLoc.x;
int y = printLoc.y;
AffineTransform at = new AffineTransform();
at.translate(x,y);
g2d.drawRenderedImage(image,at);
public void setPrintLocation(Point d)
printLoc = d;
public Point getPrintLocation()
return printLoc;
THANKS FOR YOUR HELP !

please first send me ur complete code for this example at [email protected]

Similar Messages

  • Trying to display multipage tiff image getting error

    Hi
    I am trying to read multipage tiff image but dont know how
    I tried to display single page tiff getting error
    my code is
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Drawing;
    using System.Drawing.Imaging;
    namespace Documentviewer1
        public partial class _Default : System.Web.UI.Page
            //string filepath = "";
            protected void Page_Load(object sender, EventArgs e)
                //// filepath = "image\045237302.tif";
                string appath = Server.MapPath("/image") + @"\";
                string imagename = Request.QueryString["ImageFileName"];
                string filename = appath + imagename;
                Response.ContentType = "image/tiff";
                new Bitmap(filename).Save(Response.OutputStream, ImageFormat.Tiff);
                ////System.Drawing.Image TheImg = new App.Files.TIF(Request.QueryString["FilePath"]).GetTiffImageThumb(System.Convert.ToInt16(Request.QueryString["Pg"]), System.Convert.ToInt16(Request.QueryString["Height"]),
    System.Convert.ToInt16(Request.QueryString["Width"]));//getting error in thisline Parameter not valid
    my aspx page is has
    <%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
        CodeBehind="Default.aspx.cs" Inherits="Documentviewer1._Default" %>
    <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
    </asp:Content>
    <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
        <h2>
          <img alt="" src ="image/045237302.tif" width="200" height="200"/>
        </h2>
        <p>
            To learn more about ASP.NET visit <a href="http://www.asp.net" title="ASP.NET Website">www.asp.net</a>.
        </p>
        <p>
            You can also find <a href="http://go.microsoft.com/fwlink/?LinkID=152368&amp;clcid=0x409"
                title="MSDN ASP.NET Docs">documentation on ASP.NET at MSDN</a>.
        </p>
    </asp:Content>
    getting error as Parameter not valid.
    Can anybody help me to display the image in the browser.
    Thanks
    Mary Abraham
    Mary Sunish

    Hi MaryAbraham,
    Since the issue regards ASP.NET and website deployment. I suggestion you post the question in the ASP.NET forums at
    http://forums.asp.net/. It is appropriate and more experts will assist you.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Problems using ECL Viewer to display multipage TIFF Files

    Hey there!
    Maybe someone here may have a good hint due to our problem?
    The Situation as it is:
    We are using ECL Viewer to display multipage TIFFs.
    The Process looks like following:
    The first step is to show a list of files situated in the user's personal folder(Network-Share).
    Then the user selects one of these Files through a mouse-click -> The File is displayed via ECL Viewer.
    Now the user selects the personal-Id where this file should be connected to and selects "SAVE".
    The Programm closes the Viewer and saves the Data in SAP Archiv.
    >> Everything works fine till here.<<
    But now the last processing-step would be to delete this file from the user-folder.
    (So next time the users starts it there will be only files he/she has to work on...)
    Here an error message is telling us that the file can not be deleted because there s some kind of file lock set...
    This problem only occurs only during processing multipage-Tiffs after paging down (swiching to page 2,3,4...) once at least.
    Any Idea what's the cause here  - or how to get through it?
    We are using a CL_GUI_CUSTOM_CONTAINER objekt as base -> hooked on that is a CL_GUI_ECL_VIEWERBOX and the TIFF itself is displayed wit an I_OI_DOCUMENT_VIEWER objekt.
    Maybe we get confused while destroying the "Connections" to the FIle oder something with Automation Queue Handling is not implemented right?
    Thanx for any idea, hints, or better practices
    Very kind Regards from Austria!
    Daniel

    Hi MaryAbraham,
    Since the issue regards ASP.NET and website deployment. I suggestion you post the question in the ASP.NET forums at
    http://forums.asp.net/. It is appropriate and more experts will assist you.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How do I save PDF as multipage TIFF?

    any idea how I can accomplish this task?

    Yes. You can either split the TIFF, or write code which generates a
    bitmap for each page and writes a page of a TIFF. Either way, you
    write the multipage TIFF, not Acrobat.
    Aandi Inston

  • Opening multipage TIFF files in Safari

    I regularly need to be able to open multipage TIFF files located on a website. Safari wants to use the Quicktime plug-in to open these files, but that only makes the first page visible.
    According to an article on the support site, Preview in OSX 10.4.3 and later should be able to open a multipage TIFF. However, even with 10.4.8 installed, Preview only opens the first page - the same as Quicktime.
    I did discover that ColorSync does allow me to view multipage TIFF, but I then discovered that the website I'm using doesn't offer me the option to save the file to the local machine.
    It is a client's application which has been designed for Windows machines and I am reluctant to risk asking them to change the application just for my sake.
    So I seem to be stuck - I can't get Quicktime to show more than the first page; Safari doesn't seem to offer me the option of using anything else; and I can't download the files so that I can use ColorSync.
    If anyone has any suggestions of how I can resolve this problem I would be very grateful.
    Brian
    Mac mini / iMac (Intel)   Mac OS X (10.4.8)  

    When viewing the page does the link to the .tiff file appear as a clickable link?
    Right-click (Control-click) and save it to your machine.
    Open it in Preview.

  • Printing multipage Word documents

    I am trying to automate printing multipage Word documents.  If more than 1 page, I wish to automate the duplex function.  I can't seem to get a script that works.  If anyone has one and wishes to share or could direct me, I will be grateful.  Thanks.

    The short answer is that the Java Print Service that comes with J2SE 1.4 does not contain support for MS-Word documents. I would be surprised if Sun ever offered support for anything from Microsoft. There is support for RTF some support in the J2SE for RTF (take a look at JEditorPane), which is a Microsoft standard, but that's about it. You might want to take a look at the POI project at http://jakarta.apache.org/poi/index.html There is support for working with a few Microsoft Office file formats there.

  • Delete of pages in multipage Tiff

    Hi everyone
    I'm faced with the task of deleting one or more pages in a multipage tiff -file.
    The only way I've found is something like this:
    ImageDecoder dec = ImageCodec.createImageDecoder("tiff", filestream, null);
    // Pull out pages I want to keep
    RenderedImage renderedImage1 =  dec.decodeAsRenderedImage(0);
    RenderedImage renderedImage5 =  dec.decodeAsRenderedImage(4);
    // The images are then added to a collection and then:
    encParam.setExtraImages(riList.iterator());
    ImageEncoder enc = ImageCodec.createImageEncoder("tiff", filoutstream, encParam);It works fine, except that on my 2GHz Pc it takes about 12 seconds to save a rather small two-page file (using compression or not, doesn't change the time significantly)
    I've tried to add the native accelrator dll using -Djava.library.path=C:\jai-1_1_2_01\lib, but that did'nt change those 12 seconds (which is much too long time for my impatient Swing users)
    I've tried to look into using TIFFDirectory to avoid having to do encoding/compressing once again - I mean, the pages I want to keep are nicely compressed already, and it might be possible to speed up the process, by just having to combine pages again.
    Anyone with some experience in this ??
    Torsten

    UmeshR
    Please don't post in threads that are long dead. When you have a question, start your own topic. Feel free to provide a link to an old post that may be relevant to your problem.
    I'm locking this thread now.
    db

  • Activex image viewers to view multipage tiff images

    I have some multipage tiff images which i need to show up on forms. but the image item doesn't support multipage images. does any body know any other activex components which can replace image item and can display multipage tiff images. or is there any tricky way to show multipage images on oracle forms. thanks.

    where are your images in? file system or table?
    do you want to show one image at a time and navigate to another one or show multiple images at one time?
    in table, you may use query and next_record; in file system, you may read next file by read_image_file() eatch time clicking a button.

  • How to split multipage TIFF images ?

    Dear Friends,
    I want to split multipage TIFF images using JAI...does anyone know about it...
    Regards,
    V.Prasanna

    Here are a couple of links about multi page tiffs in photoshop or elements.
    http://kb2.adobe.com/cps/325/325224.html
    http://forums.adobe.com/message/3172569
    MTSTUNER

  • Multipage TIFFs

    Does JavaFX have any built-in way to retrieve pages from a multi-page TIFF file other than the first one? Do I still need to use JAI (which is slooooow) to do this?

    IMO: I would rather have built in (multipage) TIFF support at the ImageIO level in stead of in JavaFX. TIFF has its uses, especially the multipage thingie makes it unique compared to the more popular image types that the JDK supports out of the box.
    I never experienced the JAI logic to be slow though. At least the platform independent version I was taking from the Maven repositories does the job decently in my opinion.

  • Splitting multipage tiff files?

    Hi,
    We have a webdynpro application that retrieves documents from the SAP backend.
    These documents are mainly multipage tiff files that need to be splitted into single pages and finally be saved in the backend.
    Any creative ideas how to tackle the issue?
    Thnx
    MK

    Michael, welcome to these discussions.
    Use the "Open Image Sequence" (File menu).
    All of your .tiff files must be sized the same dimensions and be named in series (1.tiif, 2.tiff, 3.tiff, etc.).
    They must all be in one folder.
    Highlight the first image in the list and hit the "Open" button or enter key.
    Pick a "frame rate" and click "OK" button or enter key.
    QuickTime Pro will then assemble your "movie" from your .tiff files.

  • U00BFIs it possible to print a .TIFF from SAP?

    I am developing CRM, and in the CRM Activities it is possible to attach files of different types (.TIFF, .XLS, .DOC, etc). The client wants the application to print directly the document without their having to open a new application. For example, they want to print a .xls without opening the excel (at least manually). Is this possible?
    Thanks in advance!
    Best regards,
    Paola del Giorgio

    Yes,  search forum for OLE.
    Regards,
    Rich Heilman

  • InDesign CS6 (Windows7) does not print a TIFF in full resolution to PDF

    I have CS6 file with a TIFF (300dpi), this Indesign file is again linked to another CS6 file. When exporting the later file with Adobe PDF (print), everything is correct except that the TIFF is in low resolution.
    With CS5.5 it works with the same workflow and files (XP machine)
    When printed (Adobe Acrobat X Pro) everything is fine.
    If exported using Adobe PDF (interactiv) it works also with CS6 (also using the distiller?)
    Is this a bug in CS6 (8.0.2) ?

    Hope this gives a better idea of the problem.
    I didn't get the impression that there was a misunderstanding of your assertions; except perhaps your conclusion that it can only be an InDesign "bug."
    Of course if it really was a bug, we'd all be able to reproduce it, and my attempts to do so have failed.
    Similar/same test; Windows 7; InDesign CS6; 300ppi TIFF image; one instance placed directly, and another nested in a placed InDesign file...
         Note: If I have missed something about your problem, I apologize. Please inform me of it and I'll adjust my approach accordingly.
    Exported to PDF/X-4 (defaults)
    I don't know that I think Willi's on the right track with his server speed theory, but I'd say there is something at your end causing the result you get.

  • Preview.app and multipage tiff files (page number)

    I scan completed job folders at my company and store the resulting files on a server for users to access. They are a multipage .tif format which is basically a fax file format that is very common among document scanners.
    Preview is pretty good at viewing these except I am stuck with two problems.
    - 10.4 Preview will only show the first 250 pages of a file.
    - 10.5 Preview will show many more pages which is good, but it gives NO WAY to know what image number you are looking at!! (preview 10.4 shows image numbers under the thumbnails, but the 10.5 version for some mysterious reason does not).
    So if you are looking at an image near the middle of a 500 page document, you have no idea what image number it is, and you basically have to click the little arrow on the print box until you get to that page (which can be hard to tell because you are looking at a small thumbnail of the page). It's completely unusable.
    Now before you tell me "yes it does show the page numbers in the thumbnail view!!!" let me remind you that I am not viewing PDFs. Yes, for PDF files the page number is right there all nice and handy. But for these multipage tif files, no page number for you!!!
    Hah, update! I have just discovered that with very short file names, you can see the image number, because Preview 10.5 appends the image number to the end of the file name on each thumbnail.
    So you can see: myFile.tif-389 on page 389's thumbnail.
    But if your filename is much longer, you see: myLongerFile... with no way to see the image number.
    I don't even know where to complain about this. Any ideas welcome.

    Paul Bruneau wrote:
    I scan completed job folders at my company and store the resulting files on a server for users to access. They are a multipage .tif format which is basically a fax file format that is very common among document scanners... Any ideas welcome.
    Multipage TIF is not common at all. Why not just save these files as PDF? Any modern scanner software should be about to generate PDF files. They won't be any larger than the TIF files and will be readable in anything with all available features.
    I don't have any multipage tif files and don't even know how I could generate one. You can send your request to Apple via their Feedback page. But there is really no downside and numerous benefits to saving as PDF instead.

  • Printing 16bit tiff with ID and Leopard

    Does anyone know what ID does to 16bit tiffs when print in Leopard with a 16bit capable driver?
    Since I can place 16bit tiffs in ID does ID pass it along when printing or does ID convert it to 8bit?

    InDesign cannot read the 16-bit data. It reads the flattened 8-bit composite saved with 16-bit TIFF and PSD files.
    And PostScript is limited to 12-bit data. Plus, you'd be hard pressed to see the difference in the real world anyway, even if it could be implemented.

Maybe you are looking for