Printing a image created by java?

is there an fairly easy way to print an image created by a java applet or a way to write an application or applet that creates a image file?
I know about print screen so if there's no other (easy) way, what do i need to install to use it?

Could you please post your code?
-B.

Similar Messages

  • Help, print to pdf creates huge files!

    Usually when I want to print an image created in Photoshop or Illustrator, I first print it to pdf to make a smaller file size. This has worked great for me for years, but now I have an Illustrator file which ends up much bigger (22 mb instead of 2 mb) in the pdf version, and I can see all the layers when it opens. How can I print a flattened image?

    If you have layers in Illustrator with visibility off, delete them before making a .pdf.
    You would think they that gets deleted before making a .pdf but they do not.
    In acrobat the protection/remove hidden information also bitmaps the file, though that is not good for me, oif that is ok you iwll get your smaller file.

  • How to print the image data stored in object of 'java.io.File' Class in jsp

    I have created a file object for the image file in the system temporary directory.Now I want to display it in my page. please tell,How to print the image data stored in object(in my program it is imgr) of 'java.io.File' Class in jsp

    Create a servlet which gets an InputStream of the file and writes it to the OutputStream of the response and call this servlet in `src` attribute. That's basically all.
    Here's an example which covers the most of the minimum needs: [http://balusc.blogspot.com/2007/04/imageservlet.html].

  • How can I convert an image created in Photoshop into a format that Java's ImageIO library will take?

    Hi all,
    I've been trying to write an image resize tool to use the Lancoz resample algorithm to resize images to a high standard in Java.  The library with the algorithm/filter in it is mortennobel's image scaling library and it takes a buffered image as an input and returns the resized image as desired.  However the trouble I’m having is that the ImageIO library in Java, a standard library, which converts images given to its read method to buffered images doesn't accept certain images created in Photoshop and so it throws an exception.  My library needs to be fully automated to process possible thousands of images at a time and so manually converting them by resaving them as JPEG's is really feasibly.  Is there some way I can convert these images from Adobes Exif format to standard JFIF format?  I've tried simple inserting the APP0 marker from a JFIF image in-between the SOI and APP1 marker but the ImageIO library still failed.
    The above image is a screenshot of the binary in hex of one of the images that cause an Invalid Format exception when passed to ImageIO.
    Any help you could offer me with this would be much appreciated.
    Kind regards and thank you,
    Alexei Blue
    Science Warehouse.
    NB: I previously posted this post in Developers but was told to post it in a Photoshop forum so apologies if this is the incorrect formum

    The image scaling library does have a BiCubicFilter in it so I'll experiment around with them and see what happens.  As for the imageIO library I think it accepts Exif image types, but still for some reason it just doesn't like Adobe Photoshop types.  Maybe its the colour map it doesn't like I just can't seem to work out what's wrong which is slightly frustrating but looking round to see if I can find an answer

  • How can I create a java.awt.Image from ...

    Hi all,
    How can I create a java.awt.Image from a drawing on a JPanel?
    Thanks.

    JPanel p;
    BufferedImage image =
        new BufferedImage(p.getWidth(), p.getHeight, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = image.createGraphics();
    p.paint(g);
    g.dispose();

  • White background of image created in Photoshop prints as grey through iPhoto postal ordering service.

    I have created an image in Photoshop with a white background (I stuck with the default white background that the new image gave me). Over the top of this, I placed some images, saved it as a JPG, imported it into iPhoto and ordered it as a postcard-sized picture.
    When I received it in the post, the whole image had printed with a grey overtone: the white background was in fact grey, and the pictures over the top were darker.
    How can I resolve this to print my image with a truly white background through iPhoto's ordering service?
    Many thanks,
    Adam

    If unchecking the scene-referred profiles box clears the display problem in Photoshop, you most likely have hit a known bug with defective monitor profiling packages building defective monitor profiles that affect Photoshop and After Effects — specifically, the defective profile is erroneously marked as "scene referred."
    Version 4 ICC Profiles: If your are using v4 printing profiles, try Googling for more information...some symptoms of this bug are Photoshop prints a light cyan or blue in the page white areas. The Fix is to use Version 2 printer profiles.
    there is another old known issue that has to do with trying to Hard Proof simulate press conditions (printing cyan in whites) but i am not sure what you are trying and i can't recall it right now
    if those aren't it upload these screenshots of your workflow:
    show full Photoshop window including zoom% and Docuent Profile in lower left corner

  • Landscape print causes images to be

    Hi.
    I am developing the printing portion of a Java-based medical imaging application. I need to be able to print a sheet containing several medical images (usually, grayscale images), with different layouts.
    I am using a code like this to start the print job:
    ===============================
    // Create the Print Job
    PrinterJob printJob = PrinterJob.getPrinterJob();
    // Create my own Printable Manager (implements the Printable interface)
    MyPrintableManager printMan = new MyPrintableManager();
    // Set the print attributes for initialization of print dialog
    PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
    aset.add(OrientationRequested.LANDSCAPE);
    aset.add(new Copies(1));
    aset.add(PrintQuality.HIGH);
    aset.add(new JobName("My Job Name", null));
    // Display the print dialog and start printing
    if (printJob.printDialog(aset))
    try
    // Set the Printable interface on the Print Job
    printJob.setPrintable(printMan);
    // Start the Print Job
    printJob.print(aset);
    catch (Exception ex)
    ex.printStackTrace();
    ===============================
    Then, in the class MyPrintableManager, I implemented my printing code in the print() method:
    ===============================
    public int print(Graphics g, PageFormat pf, int pi) throws PrinterException
    // Obtain a Graphics2D object for Java2D functionalities
    Graphics2D g2d = (Graphics2D)g;
    AffineTransform scaleTranslTransform = AffineTransform.getTranslateInstance(imgXOrigin, imgYOrigin);
    scaleTranslTransform.scale(finalScale, finalScale);
    BufferedImage bufImgToPrint = ...;
    g2d.drawRenderedImage(bufImgToPrint, scaleTranslTransform);
    ===============================
    I am facing the following strange behavior: if I choose the "Portrait" orientation in the Print dialog, everything is printed fine.
    On the other hand, when I choose the "Landscape" orientation in the Print dialog, grayscale images are printed "lighter" than what they shall be, as if something had increased the lightness of the grayscale image.
    Can you guess the cause for this strange behavior? Can it be a bug of the Java2D Printing API?
    Any help would be greatly appreciated.
    Regards,
    Marco.

    Should anyone be interested, I've assembled a self-contained code sample which demonstrates the problem with landscape printing of grayscale images (they get printed lighter than what they should be, while portrait printing looks fine):
    I've run the code below on Windows XP, JDK 1.5.0_06, and I am getting the problem with landscape printing: maybe some of you may want to make the test on his own PC and tell what happens...
    =====================================
    import java.awt.geom.*;
    import java.awt.print.*;
    import java.awt.*;
    import java.awt.image.*;
    import java.io.*;
    import javax.imageio.*;
    import javax.print.attribute.standard.*;
    import javax.print.attribute.*;
    public class PrintableManager implements Printable
    private BufferedImage imgToPrint = null;
    public PrintableManager(BufferedImage img)
    imgToPrint = img;
    public int print(Graphics g, PageFormat pf, int pi) throws PrinterException
    if (pi >= 1)
    return Printable.NO_SUCH_PAGE;
    // Obtain a Graphics2D object for Java2D functionalities
    Graphics2D g2d = (Graphics2D)g;
    g2d.setClip(null);
    AffineTransform translTransform = AffineTransform.getTranslateInstance(pf.getImageableX(), pf.getImageableY());
    // Draw the final image
    g2d.drawRenderedImage(imgToPrint, translTransform);
    return Printable.PAGE_EXISTS;
    public static void main(String[] args)
    try
    // Substitute the path below with the actual path of the sample image
    // file on your hard drive (the used TestImg.jpg can be downloaded
    // from 'http://demo.neologica.it/Images/TestImg.jpg')
    File imgFile = new File("C:\\TestImg.jpg");
    BufferedImage imgToPrint = ImageIO.read(imgFile);
    // Create the Print Job
    PrinterJob printJob = PrinterJob.getPrinterJob();
    // Create the Printable Manager
    PrintableManager printMan = new PrintableManager(imgToPrint);
    // Set the print attributes for initialization of print dialog
    PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
    // The following line is the crucial one:
    // If I specify OrientationRequested.LANDSCAPE, then the image is printed
    // LIGHTER (i.e., with a higher lightness) than what it should be.
    // If I specify OrientationRequested.PORTRAIT, then the image is printed
    // fine (i.e., with the correct lightness)
    aset.add(OrientationRequested.LANDSCAPE);
    // Display the print dialog and start printing
    if (printJob.printDialog(aset))
    // Set the Printable interface on the Print Job
    printJob.setPrintable(printMan);
    // Start the Print Job
    printJob.print(aset);
    catch (Exception ex)
    ex.printStackTrace();
    =====================================
    Thank you,
    Marco.

  • How to print a text file using Java

    How can I print a text file using Java without converting the output to an image format. Is there anyway I can send the characters in the text file as it is for a print job? I did get a listing doing this ... but that converted the text to an image format before printing....
    THanks,.

    Hi I had to write a print api from scratch, and I did not convert the output to image. Go and read up on the following code. I know there is a Tutorial on Sun about the differant sections of the snippet.
    private void printReport()
         Frame tempFrame = new Frame(getName());
         PrintJob printerJob = Toolkit.getDefaultToolkit().getPrintJob(tempFrame, "Liesltext", null);
         Graphics g = printerJob.getGraphics();
                    //I wrote the method below for calculations
         printBasics(g);
         g.dispose();
         printerJob.end();
    }This alone wont print it you have to do all the calculations in the printBasics method. And as I said I wrote this from scratch and all I did was research first the tutorial and the white papers
    Ciao

  • Print a IMAGE in a REPORT

    I need to print a IMAGE (hosting in the SE78 transaction store) in a REPORT.
    is it possible????
    Wait your responses. See you.

    Hi,
    Using ALV, you can upload logo into report like this:
    For those who wish to upload and use a picture in your ALV abap reports.
    Steps for uploading Logo :-:
    1.  Goto the transaction OAER
    2.  Enter the class name as 'PICTURES'
    3.  Enter the class type as 'OT'
    4.  Enter the object key as the name of the logo you wish to give
    5.  Execute
    6.  Then in the new screen select Standard doc. types in bottom window
         Click on the Screen icon 
         Now, it will ask for the file path where you have to upload the logo
    7.  Now you can use this logo in REUSE_ALV_COMMENTARY_WRITE
    or 
    Import Logo and Background Picture for Reporting
    In this step, you can import a customer-specific logo and a background picture into the R/3 System. These will be displayed in the header area of reports in HR Funds and Position Management.
    From the SPRO: 
    HR Funds and Position Management --> Dialog Control --> Customize Reporting Interface --> Import Logo and Background Picture for Reporting.
    Activities
    1. Enter the Name of your logo/background picture as an object key in the initial screen.
    2. Make sure that the class name is PICTURES, and the class type is OT.
    3. Choose Execute.
    4. Double-click the document type Picture on the Create tab page.  A dialog box will appear in which you can enter the path in which the logo/background picture can be found.
    5. Enter the path and choose Open.  The logo will be uploaded into the current R/3 System. If the logo/background picture is to be transported into other systems as well, choose Transport.
    6. Return to the initial screen and repeat the procedure after having entered the Name of your background picture as an object key.
    Please note that the logo/background picture can only be displayed in ALV-based reports with an HTML header. Manually programmed reports such as business distribution plans are not based on the ALV.
    If you have selected several initial objects, ALV-based reports in HR Funds and Position Management will automatically use a hiearchical-sequential display. A logo is not displayed here either. Note also that the logo cannot be printed (see print preview in program).
    Make sure that the logo does not exceed a height of 100 pixels because it would mean that the header of the report will be scrollable.
    Regards,
    Bhaskar

  • Action to: Print current document to PDF Printer "As Image" with Specified DPI

    I FREQUENTLY do the following task on documents.  I would LOVE to have an action that did it for me.  Can someone help me create one or point me to someone who can?
    Version: Adobe Acrobat X Pro.  Windows 7 64-bit
    With current PDF file open:
    2) Print
    3) Select PDF Printer
    4) (Under advanced printer settings) choose "Print as Image", "150" DPI.
    5) OK
    6) Save file AS the original with _printed appended to the filename.
    Image1: Printer dialogue box
    Image 2: After selecting the PDF Printer and pressing "Advanced"

    The forum added some nice links and i found my answer here http://forums.adobe.com/message/1179199#1179199 - changed the registry key permissions and it's working like a charm. Thank you.

  • Set image path in java class library

    Hi,
    I created a java class library project and made .jar file. My java class library contains .jpg files in separete folder named as Images. My .jar file contains list of classes and image folder also but when i am using .jar file in applet. java class library is working but images are not shown. Let me know how to create imageicon to show images also in the class library

    ImageIcon icon = new ImageIcon(getClass().getResource(path-to-file));

  • Rotate Image Created with createImage() ?

    I've been looking around online for a way to do this, but so far the only things I have found are 50+ lines of code. Surely there is a simple way to rotate an image created with the createImage() function?
    Here's some example code with all the tedious stuff already written. Can someone show me a simple way to rotate my image?
    import java.net.*;
    import java.awt.*;
    import java.awt.geom.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class RotImg extends JApplet implements MouseListener {
              URL base;
              MediaTracker mt;
              Image myimg;
         public void init() {
              try{ mt = new MediaTracker(this);
                   base = getCodeBase(); }
              catch(Exception ex){}
              myimg = getImage(base, "myimg.gif");
              mt.addImage(myimg, 1);
              try{ mt.waitForAll(); }
              catch(Exception ex){}
              this.addMouseListener(this);
         public void paint(Graphics g){
              super.paint(g);
              Graphics2D g2 = (Graphics2D) g;
              g2.drawImage(myimg, 20, 20, this);
         public void mouseClicked(MouseEvent e){
              //***** SOME CODE HERE *****//
              // Rotate myimg by 5 degrees
              //******** END CODE ********//
              repaint();
         public void mouseEntered(MouseEvent e){}
         public void mouseExited(MouseEvent e){}
         public void mousePressed(MouseEvent e){}
         public void mouseReleased(MouseEvent e){}
    }Thanks very much for your help!
    null

    //  <applet code="RotationApplet" width="400" height="400"></applet>
    //  use: >appletviewer RotationApplet.java
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.AffineTransform;
    import java.awt.image.BufferedImage;
    import javax.swing.*;
    public class RotationApplet extends JApplet {
        RotationAppletPanel rotationPanel;
        public void init() {
            Image image = loadImage();
            rotationPanel = new RotationAppletPanel(image);
            setLayout(new BorderLayout());
            getContentPane().add(rotationPanel);
        private Image loadImage() {
            String path = "images/cougar.jpg";
            Image image = getImage(getCodeBase(), path);
            MediaTracker mt = new MediaTracker(this);
            mt.addImage(image, 0);
            try {
                mt.waitForID(0);
            } catch(InterruptedException e) {
                System.out.println("loading interrupted");
            return image;
    class RotationAppletPanel extends JPanel {
        BufferedImage image;
        double theta = 0;
        final double thetaInc = Math.toRadians(5.0);
        public RotationAppletPanel(Image img) {
            image = convert(img);
            addMouseListener(ml);
        public void rotate() {
            theta += thetaInc;
            repaint();
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
                                RenderingHints.VALUE_INTERPOLATION_BICUBIC);
            double x = (getWidth() - image.getWidth())/2;
            double y = (getHeight() - image.getHeight())/2;
            AffineTransform at = AffineTransform.getTranslateInstance(x,y);
            at.rotate(theta, image.getWidth()/2, image.getHeight()/2);
            g2.drawRenderedImage(image, at);
        private BufferedImage convert(Image src) {
            int w = src.getWidth(this);
            int h = src.getHeight(this);
            int type = BufferedImage.TYPE_INT_RGB; // options
            BufferedImage dest = new BufferedImage(w,h,type);
            Graphics2D g2 = dest.createGraphics();
            g2.drawImage(src,0,0,this);
            g2.dispose();
            return dest;
        private MouseListener ml = new MouseAdapter() {
            public void mousePressed(MouseEvent e) {
                rotate();
    }

  • Problems with image field and java

    Hi, i´m a beginner user of Adobe LiveCycle Designer, i create a form and i fill the text fields with a Java code, but when i try to dinamically assign a image on the image field of my form it doesn´t work, someone have any idea of whats happening or how can i manipulate the image field from Java code? thanks

    Session data will only last as long as the servlet container allows. In most cases (eg Tomcat) this defaults to about 30 minutes, but can be changed. Check that the session timeout configuration in your servlet container hasn't been set to "never timeout".
    Even if it had, I would have expected OutOfMemory errors rather than degrading performance. Although if the max heap size of the JVM has been set to a level higher than the RAM on the machine you could be getting excess page file usage.
    This probably wouldn't put CPU utilization at 99% though.. I suspect this is a code related problem.
    My best guess is one of two reasons:
    1. Somewhere in your code, or someone elses, there is a loop that never ends.
    2. There is a bug in the servlet container.
    I don't know which servlet container you are using, but I have used Tomcat extensively and never seen this behaviour.
    In terms of solving this problem, that's a tough one. I would try running the entire application within a profiling tool to see which threads are clogging up the processor. The Eclipse java IDE has a plugin called Eclipse Profiler which will allow you to track the utilization of code right down to the method level.
    If it were me, I'd be running the entire web application with a profiler like Eclipse Profiler and waiting for it to start clogging, then see who the guilty code is.

  • Print as Image changes between Adobe Reader ver7 and ver8+

    Hi,
    We have customers that upgraded to Adobe Reader ver8+ and are now experiencing printing issues with our printer driver (operating system is Windows XP/Vista). When they use Adobe Reader ver8 and above to print their PDF files, with "Print as Image" option selected, the print output is smaller. It looks like the latest version of Adobe Reader output the images using a square DPI. Our printer (line matrix) does not handle square DPI (for example: printer resolution are 120x48, 120x72, 120x144, and 180x96).
    Our printer driver just takes the output from the Microsoft print spooler and just encapsulate it with our printer language. We don't do any image manipulation. So, I would like to know was there a change in the way Adobe Reader version 8 and above create the output image? If so, is there a backward compatibility switch our driver can issue during the printing function?
    I tried talking to Adobe Tech support (bronze support), but they only handle end user issues. Is there a tech support option that I can purchase that will allow me to get to the root of this driver compatibility issue? Any suggestion would be appreciated.

    Adobe doesn't apparently care. I get this problem all the time on our work network. There's a lot of questions in this forum and elsewhere on the internet.
    The best answer I've seen is that there's something wrong with the PDF or you don't have the right font, or you did something wrong, or here try this ridiculously complicated workaround. I wish they would just fix their program!
    Suggestions: go through all the "standard" things like updating printer drivers, printing the document as an image, updating Adobe (yeah, like "it works now" is a new feature in the latest version), etc. It's possible that could fix the problem. Otherwise, wait until Adobe releases a version of Reader that doesn't have this issue.

  • IPhoto Doesn't Print Full Image

    Odd problem here. I'm having trouble printing my images at 100%. For some reason that I haven't been able to troubleshoot, when I try to print an image from iPhoto, I lose a half inch or more of the photo around the edges. This happens whether I choose 'borderless' or not.
    When I bypass iPhoto altogether and use my printer software, this cropping issue doesn't exist, but I prefer some of the options iPhoto offers.
    By the way, I'm running Mac OSX 10.5.8-haven't yet updated to iLife 09.
    Any suggestions?

    Since your image is probably in the 4:3 size ratio (from a digital camera) you will have to select a custom size in iPhoto's print window. If you're printing to 4x6 borderless stock select a custom size of 3x4 or 4x5.33 (to get the max size on the 4x6 stock.
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto (iPhoto.Library for iPhoto 5 and earlier versions) database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger or later), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. There are versions that are compatible with iPhoto 5, 6, 7 and 8 libraries and Tiger and Leopard. Just put the application in the Dock and click on it whenever you want to backup the dB file. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.
    NOTE: The new rebuild option in iPhoto 09 (v. 8.0.2), Rebuild the iPhoto Library Database from automatic backup" makes this tip obsolete.

Maybe you are looking for