Printing HTML files

I have created a HTML file and saved it. Now I want my program to send the file to the printer. Could somebody please send me an idiots guide of how to do this. The more simple, the better! Cheers.

http://java.sun.com/products/java-media/2D/forDeveloper
/sdk12print.htmlI have already read this. It is far too complicated for me(the html printing bit!). All I want is a class whereby I can call it (ie printIt("Page1.html")) passing it the file name in a string and it sends the file to the printer. Any help much appreciated.

Similar Messages

  • Print html file via share intent

    Hello HP
    I'm a developer, I trying to print html file to HP Printer via share intent. Here is my code:
    Intent intent = new Intent("org.androidprinting.intent.action.PRINT");
    Uri uri = Uri.parse(path);
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    intent.setDataAndType(uri, "ePrintWebContent/*");
    startActivity(intent);
    Nothing happen when I share this intent. Please show me right way to print html file.
    Thank you!!

    Did you look in the LabVIEW Help? http://zone.ni.com/reference/en-XX/help/371361G-01​/lvhowto/reg_hndl_ax_evnts/
    You right-click on that parameter and select Create Callback VI. This will automatically create a VI with the required inputs and outputs. This is the VI that will be called when the event occurs. If you need the callback VI to update any front panel controls of the main VI, then you can pass in control references via the User Parameter input.
    Attached is a modification of the shipping example that handles the Navigate and DocumentComplete events.
    Attachments:
    Navigate Callback Example.vi ‏24 KB
    Navigate Callback.vi ‏15 KB
    DocumentComplete Callback.vi ‏15 KB

  • Print html file with barcode from abap report

    hi
    i am printing html file from abap program using gui_execute.
    i am using netscape.exe , its printing first time and when reprint its not working
    basically html file contains gif file which has fedex barcode.
    could you please let me know how to print html file from report

    DGU wrote:
    where to check RAW or TEXT? the print report vi only asks for file name and printer name.
    When I print from notepad, everything just goes by default. This is a label printer, so I never need to specify printing parameter such as size, orientation, etc in the past
    Famous last words go something like this: "...never had to do that before."  Maybe you have to do that now.  It's worth at least comparing the defaults settings for bothe generic drivers.  It could save you a lot of headache if you notice something different.
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

  • How print .html file?

    Hi,
    I'm a beginner printing in Java.
    What I'm trying to do is to print .html file but I don't know how to do it well.
    Please, someone who can help me to solve this problem.
    Thanks a lot!

    i have the same problem, hope some1 could help.
    cheers.

  • Printting HTML file...

    Hi all,
    anybody knows that how to print HTML file. i mean the contents which are viewable in browser.
    please let me know..
    Thanks in advance..

    check this out
    http://java.sun.com/printing/whitepaper.html

  • Print HTML file inside JEditorPane

    Hi Guys,
    I'm trying to print the contents of a JEditorPane - actually, a html file that I read and display in that component from the underlying file system. I've had the class that manages the JEditorPane implement Printable - the following is my print() implementation:
    public int print(Graphics graphics, PageFormat pageFormat, int pageIndex)
              throws PrinterException {
              if (pageIndex > 0) {
                   return (NO_SUCH_PAGE);
              } else {
                   Graphics2D g2d = (Graphics2D) graphics;
                   g2d.translate(
                        pageFormat.getImageableX(),
                        pageFormat.getImageableY());
                   ivTextArea.paint(g2d);
                   return (PAGE_EXISTS);
    }I've got another method that gets called when a print button is clicked:
    class .... {
      PrintJob pj;
      PageFormat pf;
    private void printMe() {
               if (pj == null) {
                   pj = PrinterJob.getPrinterJob();
                   pf = pj.defaultPage();
                   pf.setOrientation(PageFormat.PORTRAIT);
              pf = pj.pageDialog(pf);
              pj.setPrintable(this, pf);
              try {
                   pj.print();
              } catch (PrinterException e) {
                   throw new RuntimeException(e);
    }Clearly I'm doing smth wrong, since only a single page gets printed and moreover the formatting is awful [text gets cut instead of moving on the next line]. Can someone help?
    Thanks much!

              if (pageIndex > 0) {
                   return (NO_SUCH_PAGE);This is why you only get a single page.
    page gets printed and moreover the formatting is
    awful [text gets cut instead of moving on the next
    line]. Can someone help?Yeah. Your best bet is either to put the editorpane in a scrollpane and just print what's visible, OR, you can take the print graphics object, convert it into a graphics2D object, and call scale on that by comparing component.getWidth/height to PageFormat.getImageableWidth/Height
    I'm attaching my StandardPrint class. It uses the pageable interface to carry the number of pages + page format as well. I'm not sure if I did the scaling here or not, but I've done it before so I know it works :-) Also, I've got methods for previewing the print, which can save a lot of paper.
    Please feel free to have and use this class, but please do not change the package or portray this as your own work
    =============================
    package tjacobs.print;
    import java.awt.*;
    import java.awt.image.BufferedImage;
    import java.awt.print.*;
    import javax.print.PrintException;
    public class StandardPrint implements Printable, Pageable {
        Component c;
        SpecialPrint sp;
        PageFormat mFormat;
        public StandardPrint(Component c) {
            this.c = c;
            if (c instanceof SpecialPrint) {
                sp = (SpecialPrint)c;
        public StandardPrint(SpecialPrint sp) {
            this.sp = sp;
        public void start() throws PrinterException {
            PrinterJob job = PrinterJob.getPrinterJob();
            if (mFormat == null) {
                mFormat = job.defaultPage();
            job.setPageable(this);
            if (job.printDialog()) {
                job.print();
        public void setPageFormat (PageFormat pf) {
            mFormat = pf;
        public void printStandardComponent (Pageable p) throws PrinterException {
            PrinterJob job = PrinterJob.getPrinterJob();
            job.setPageable(p);
            job.print();
        private Dimension getJobSize() {
            if (sp != null) {
                return sp.getPrintSize();
            else {
                return c.getSize();
        public static Image preview (int width, int height, Printable sp, PageFormat pf, int pageNo) {
            BufferedImage im = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
            return preview (im, sp, pf, pageNo);
        public static Image preview (Image im, Printable sp, PageFormat pf, int pageNo) {
            Graphics2D g = (Graphics2D) im.getGraphics();
    //        PageFormat pf = sp.getPageFormat(pageNo);
    //        int width = im.getWidth(null);
    //        int height = im.getHeight(null);
    //        g.setColor(Color.WHITE);
    //        g.fillRect(0, 0, width, height);
    //        double hratio = height / pf.getHeight();
    //        double wratio = width / pf.getWidth();
    //        g.scale(hratio, wratio);
            try {
                   sp.print(g, pf, pageNo);
              catch(PrinterException pe) {
                   pe.printStackTrace();
            g.dispose();
            return im;
        public int print(Graphics gr, PageFormat format, int pageNo) {
            mFormat = format;
            Graphics2D g = (Graphics2D) gr;
            g.translate((int)format.getImageableX(), (int)format.getImageableY());
            Dimension size = getJobSize();
            if (pageNo > getNumberOfPages()) {
                return Printable.NO_SUCH_PAGE;
            int horizontal = getNumHorizontalPages();
            int vertical = getNumVerticalPages();
            int horizontalOffset = (int) ((pageNo % horizontal) * format.getImageableWidth());
            int verticalOffset = (int) ((pageNo / vertical) * format.getImageableHeight());
            double ratio = getScreenRatio();
            g.scale(1 / ratio, 1 / ratio);
            g.translate(-horizontal, -vertical);
            if (sp != null) {
                sp.printerPaint(g);
            else {
                c.paint(g);
            g.translate(horizontal, vertical);
            g.scale(ratio, ratio);
            g.translate((int)-format.getImageableX(), (int)-format.getImageableY());
            return Printable.PAGE_EXISTS;
        public int getNumHorizontalPages() {
            Dimension size = getJobSize();
            int imWidth = (int)mFormat.getImageableWidth();
            int pWidth = 1 + (int)(size.width / getScreenRatio() / imWidth) - (imWidth == size.width ? 1 : 0);
            return pWidth;
        private double getScreenRatio () {
            double res = Toolkit.getDefaultToolkit().getScreenResolution();
            double ratio = res / 72.0;
            return ratio;
        public int getNumVerticalPages() {
            Dimension size = getJobSize();
            int imHeight = (int)mFormat.getImageableHeight();
            int pHeight = (int) (1 + (size.height / getScreenRatio() / imHeight)) - (imHeight == size.height ? 1 : 0);
            return pHeight;
        public int getNumberOfPages() {
            return getNumHorizontalPages() * getNumVerticalPages();
        public Printable getPrintable(int i) {
            return this;
        public PageFormat getPageFormat(int page) {
            if (mFormat == null) {
                PrinterJob job = PrinterJob.getPrinterJob();
                mFormat = job.defaultPage();
            return mFormat;
    }>
    Thanks much!

  • Print HTML File Without Showing on Screen

    Hi Everyone
    Is there a way to print a file (in particular, an html file) from a java app without actually displaying the file on the screen.
    ie. print from command line.
    I am creating an html file from within java app and would like to print it in one step.
    Any help would be greatly appreciated.
    Thanks
    Kelly

    Hi,
    Heres some code from an app I wrote that prints out text. I've stripped out little sensitive bits.
    // Procedure to perform when print button is pressed
       void printButton_actionPerformed(ActionEvent e){
         int x, y, pageNo = 1, maxPageHeight, textHeight = 0;
         Date today = new Date();
         String tempLine = new String("");
         String tempString = new String();
         Graphics pg;
    // Create date and time formats
         SimpleDateFormat dateFormatter = new SimpleDateFormat("dd/MM/yy");
         SimpleDateFormat timeFormatter = new SimpleDateFormat("HH:mm:ss");
    // Create date and time strings
         currentDate = dateFormatter.format(today);
         currentTime = timeFormatter.format(today);
    // Turn off double buffering
         RepaintManager.currentManager(this).setDoubleBufferingEnabled(false);
    // Get a print job
         PrintJob printjob = getToolkit().getPrintJob(this, "<printjob name>", null);
         if (printjob != null) {
           maxPageHeight = printjob.getPageDimension().height-(rowHeight*2);
           pg = printjob.getGraphics();
           if (pg != null) {
             pg.setColor(Color.black);
             pg.setFont(new Font("Courier", 0, 10));
    // Print header
             textHeight = topOfPage;
             pg.drawString("Report      Date " + currentDate +
                           "      Time " + currentTime + "  Page " + pageNo,
                           30, textHeight);
             textHeight += rowHeight;
             pg.drawString("File: " + dataFile , 30, textHeight);
    // Print errors
             textHeight += rowHeight*2;
             pg.drawString("Errors", 30, textHeight);
             textHeight += rowHeight;
             pg.drawString("------", 30, textHeight);
             textHeight += rowHeight;
             pg.drawString("col1         col2 col3                 Value        Reason",
                            30, textHeight);
             textHeight += rowHeight;
             pg.drawString("------------ ---- -------------------- ------------ --------------------",
                            30, textHeight);
             if(errorData != null){
               for(x = 0; x < errorData.length; x++){
                 textHeight += rowHeight;
                 if(textHeight > maxPageHeight){
                   pg = nextPage(pg, printjob, ++pageNo);
                   textHeight = topOfPage + rowHeight*2;
                 tempLine = "";
                 for(y=0; y<columnLengths.length; y++){
                   tempString = errorData[x][y] != null ?
                                roundLength(errorData[x][y].toString(), columnLengths[y])
                                : roundLength(" ", columnLengths[y]);
                   tempLine += tempString + " ";
                 pg.drawString(tempLine, 30, textHeight);
             pg.dispose(); // flush page
           printjob.end();
       }Hope that helps.
    Rob.

  • Print html file without seeing a print dialog box

    i need to script an action that would allow a user to print a sparcly formated html file to a printer while bypassing the normal print dialog box.
    the unix lpr command seems like it might work, but the man page only mentions PS and txt files.
    Ultimately i'd want to trigger the print action from a php script, but it could be a folder action also.
    Does anyone have any suggestions or point me in the right direction.

    lp is the right command to use but you may need to convert the html file in PDF format before printing it. Just test it. Also type man lp to see more options.
    enscript is a nice utility that may help you. man enscript for more.
    Mihalis.

  • Print HTML FILE

    Hi all :
    I save a HTML FILE ,, I want to print this file from labview ,, how can I do that
    thanks

    Hi Mike :
    Sorry that I am asking so lot ,, but I don,t know how to Change "Print HTML Report.vi" in the same way and save it with a new name. i am using labview 8.5 I don,t see "print HTML Report.vi", I have "print report.vi "only
    Who  can I change it  ?? can you explain or send 
    thank alot 

  • Problem while printing HTML file

    Hi All,
    I want to print a report in HTML file. The file is successfully created when there is simple query in group, but when I add some formula column, the report generate an error while generating report in HTML format.
    Thx,
    Sameen Jan

    Hi Eins Antony,
    According to your description that you have an report which you have created the subscription to send to email, but in the email the report shrink to the left, right?
    The layout issue can be caused by the new version of the Outlook, Outlook 2007 and later version have very limited support for HTML and CSS that is built into Word to display HTML email messages . Basically Outlook 2007  and later version uses MS Word
    HTML Rendering Engine (Which Makes Web Archive Report Looked Jacked Up) to display an e-mail and will ignores extra space, when MSHTML from Internet Explorer processes the table cell, MSHTML from Internet Explorer displays as much space as possible.
    Note Earlier versions of Microsoft Office Outlook use MSHTML from Internet Explorer to display e-mail, so in the Outlook 2003 you will not have this issue.
    Details information for your reference:
    http://support.microsoft.com/kb/935399
    http://www.sitepoint.com/microsoft-breaks-html-email-rendering-in-outlook/
    Similar thread for your reference:
    https://social.msdn.microsoft.com/Forums/en-US/97e8c12e-f64d-427f-a712-c53e68121f28/column-widths-in-email-sent-as-mthml-web-archive-format
    If you still have any question, please feel free to ask
    Regards
    Vicky Liu

  • Help needed:Printing HTML file using javax.print

    Hi
    I am using the following code which i got form the forum for rpinting an HTML file.
    The folllowing code is working fine, but the problem is the content of HTML file is not getting printed. I am geeting a blank page with no content. What is the change that is required in the code? ALso is there any simpler way to implement this. Help needed ASAP.
    public boolean printHTMLFile(String filename) {
              try {
                   JEditorPane editorPane = new JEditorPane();
                   editorPane.setEditorKit(new HTMLEditorKit());
                   //editorPane.setContentType("text/html");
                   editorPane.setSize(500,500);
                   String text = getFileContents(filename);
                   if (text != null) {
                        editorPane.setText(text);                    
                   } else {
                        return false;
                   printEditorPane(editorPane);
                   return true;
              } catch (Exception tce) {
                   tce.printStackTrace();
              return false;
         public String getFileContents(String filename) {
              try {
                   File file = new File(filename);
                   BufferedReader br = new BufferedReader(new FileReader(file));
                   String line;
                   StringBuffer sb = new StringBuffer();
                   while ((line = br.readLine()) != null) {
                        sb.append(line);
                   br.close();
                   return sb.toString();
              } catch (Exception tce) {
                   tce.printStackTrace();
              return null;
         public void printEditorPane(JEditorPane editorPane) {
                   try {
                        HTMLPrinter htmlPrinter = new HTMLPrinter();
                        htmlPrinter.printJEditorPane(editorPane, htmlPrinter.showPrintDialog());
                   } catch (Exception tce) {
                        tce.printStackTrace();
         * Sets up to easily print HTML documents. It is not necessary to call any of the setter
         * methods as they all have default values, they are provided should you wish to change
         * any of the default values.
         public class HTMLPrinter {
         public int DEFAULT_DPI = 72;
         public float DEFAULT_PAGE_WIDTH_INCH = 8.5f;
         public float DEFAULT_PAGE_HEIGHT_INCH = 11f;
         int x = 100;
         int y = 80;
         GraphicsConfiguration gc;
         PrintService[] services;
         PrintService defaultService;
         DocFlavor flavor;
         PrintRequestAttributeSet attributes;
         Vector pjlListeners = new Vector();
         Vector pjalListeners = new Vector();
         Vector psalListeners = new Vector();
         public HTMLPrinter() {
              gc = null;
              attributes = new HashPrintRequestAttributeSet();
              flavor = null;
              defaultService = PrintServiceLookup.lookupDefaultPrintService();
              services = PrintServiceLookup.lookupPrintServices(flavor, attributes);
              // do something with the supported docflavors
              DocFlavor[] df = defaultService.getSupportedDocFlavors();
              for (int i = 0; i < df.length; i++)
              System.out.println(df.getMimeType() + " " + df[i].getRepresentationClassName());
              // if there is a default service, but no other services
              if (defaultService != null && (services == null || services.length == 0)) {
              services = new PrintService[1];
              services[0] = defaultService;
         * Set the GraphicsConfiguration to display the print dialog on.
         * @param gc a GraphicsConfiguration object
         public void setGraphicsConfiguration(GraphicsConfiguration gc) {
              this.gc = gc;
         public void setServices(PrintService[] services) {
              this.services = services;
         public void setDefaultService(PrintService service) {
              this.defaultService = service;
         public void setDocFlavor(DocFlavor flavor) {
              this.flavor = flavor;
         public void setPrintRequestAttributes(PrintRequestAttributeSet attributes) {
              this.attributes = attributes;
         public void setPrintDialogLocation(int x, int y) {
              this.x = x;
              this.y = y;
         public void addPrintJobListener(PrintJobListener pjl) {
              pjlListeners.addElement(pjl);
         public void removePrintJobListener(PrintJobListener pjl) {
              pjlListeners.removeElement(pjl);
         public void addPrintServiceAttributeListener(PrintServiceAttributeListener psal) {
              psalListeners.addElement(psal);
         public void removePrintServiceAttributeListener(PrintServiceAttributeListener psal) {
              psalListeners.removeElement(psal);
         public boolean printJEditorPane(JEditorPane jep, PrintService ps) {
                   if (ps == null || jep == null) {
                        System.out.println("printJEditorPane: jep or ps is NULL, aborting...");
                        return false;
                   // get the root view of the preview pane
                   View rv = jep.getUI().getRootView(jep);
                   // get the size of the view (hopefully the total size of the page to be printed
                   int x = (int) rv.getPreferredSpan(View.X_AXIS);
                   int y = (int) rv.getPreferredSpan(View.Y_AXIS);
                   // find out if the print has been set to colour mode
                   DocPrintJob dpj = ps.createPrintJob();
                   PrintJobAttributeSet pjas = dpj.getAttributes();
                   // get the DPI and printable area of the page. use default values if not available
                   // use this to get the maximum number of pixels on the vertical axis
                   PrinterResolution pr = (PrinterResolution) pjas.get(PrinterResolution.class);
                   int dpi;
                   float pageX, pageY;
                   if (pr != null)
                        dpi = pr.getFeedResolution(PrinterResolution.DPI);
                   else
                        dpi = DEFAULT_DPI;
                   MediaPrintableArea mpa = (MediaPrintableArea) pjas.get(MediaPrintableArea.class);
                   if (mpa != null) {
                        pageX = mpa.getX(MediaPrintableArea.INCH);
                        pageY = mpa.getX(MediaPrintableArea.INCH);
                   } else {
                        pageX = DEFAULT_PAGE_WIDTH_INCH;
                        pageY = DEFAULT_PAGE_HEIGHT_INCH;
                   int pixelsPerPageY = (int) (dpi * pageY);
                   int pixelsPerPageX = (int) (dpi * pageX);
                   int minY = Math.max(pixelsPerPageY, y);
                   // make colour true if the user has selected colour, and the PrintService can support colour
                   boolean colour = pjas.containsValue(Chromaticity.COLOR);
                   colour = colour & (ps.getAttribute(ColorSupported.class) == ColorSupported.SUPPORTED);
                   // create a BufferedImage to draw on
                   int imgMode;
                   if (colour)
                        imgMode = BufferedImage.TYPE_3BYTE_BGR;
                   else
                        imgMode = BufferedImage.TYPE_BYTE_GRAY;
                   BufferedImage img = new BufferedImage(pixelsPerPageX, minY, imgMode);
                   Graphics myGraphics = img.getGraphics();
                   myGraphics.setClip(0, 0, pixelsPerPageX, minY);
                   myGraphics.setColor(Color.WHITE);
                   myGraphics.fillRect(0, 0, pixelsPerPageX, minY);
                        java.awt.Rectangle rectangle=new java.awt.Rectangle(0,0,pixelsPerPageX, minY);
                   // call rootView.paint( myGraphics, rect ) to paint the whole image on myGraphics
                   rv.paint(myGraphics, rectangle);
                   try {
                        // write the image as a JPEG to the ByteArray so it can be printed
                        Iterator writers = ImageIO.getImageWritersByFormatName("jpeg");
                        ImageWriter writer = (ImageWriter) writers.next();
                                       // mod: Added the iwparam to create the highest quality image possible
                        ImageWriteParam iwparam = writer.getDefaultWriteParam();
                        iwparam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT) ;
                        iwparam.setCompressionQuality(1.0f); // highest quality
                        ByteArrayOutputStream out = new ByteArrayOutputStream();
                        ImageOutputStream ios = ImageIO.createImageOutputStream(out);
                        writer.setOutput(ios);
                        // get the number of pages we need to print this image
                        int imageHeight = img.getHeight();
                        int numberOfPages = (int) Math.ceil(minY / (double) pixelsPerPageY);
                        // print each page
                        for (int i = 0; i < numberOfPages; i++) {
                             int startY = i * pixelsPerPageY;
                             // get a subimage which is exactly the size of one page
                             BufferedImage subImg = img.getSubimage(0, startY, pixelsPerPageX, Math.min(y - startY, pixelsPerPageY));
                                                 // mod: different .write() method to use the iwparam parameter with highest quality compression
                             writer.write(null, new IIOImage(subImg, null, null), iwparam);
                             SimpleDoc sd = new SimpleDoc(out.toByteArray(), DocFlavor.BYTE_ARRAY.JPEG, null);
                             printDocument(sd, ps);
                             // reset the ByteArray so we can start the next page
                             out.reset();
                   } catch (PrintException e) {
                        System.out.println("Error printing document.");
                        e.printStackTrace();
                        return false;
                   } catch (IOException e) {
                        System.out.println("Error creating ImageOutputStream or writing to it.");
                        e.printStackTrace();
                        return false;
                   // uncomment this code and comment out the 'try-catch' block above
                   // to print to a JFrame instead of to the printer
                   /*          JFrame jf = new JFrame();
                             PaintableJPanel jp = new PaintableJPanel();
                             jp.setImage( img );
                             JScrollPane jsp = new JScrollPane( jp );
                             jf.getContentPane().add( jsp );
                             Insets i = jf.getInsets();
                             jf.setBounds( 0, 0, newX, y );
                             jf.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
                             jf.setVisible( true );*/
                   return true;
              * Print the document to the specified PrintService.
              * This method cannot tell if the printing was successful. You must register
              * a PrintJobListener
              * @return false if no PrintService is selected in the dialog, true otherwise
              public boolean printDocument(Doc doc, PrintService ps) throws PrintException {
                   if (ps == null)
                   return false;
                   addAllPrintServiceAttributeListeners(ps);
                   DocPrintJob dpj = ps.createPrintJob();
                   addAllPrintJobListeners(dpj);
                   dpj.print(doc, attributes);
                   return true;
              public PrintService showPrintDialog() {
                   return ServiceUI.printDialog(gc, x, y, services, defaultService, flavor, attributes);
              private void addAllPrintServiceAttributeListeners(PrintService ps) {
                   // add all listeners that are currently added to this object
                   for (int i = 0; i < psalListeners.size(); i++) {
                   PrintServiceAttributeListener p = (PrintServiceAttributeListener) psalListeners.get(i);
                   ps.addPrintServiceAttributeListener(p);
              private void addAllPrintJobListeners(DocPrintJob dpj) {
                   // add all listeners that are currently added to this object
                   for (int i = 0; i < pjlListeners.size(); i++) {
                   PrintJobListener p = (PrintJobListener) pjlListeners.get(i);
                   dpj.addPrintJobListener(p);
              // uncomment this also to print to a JFrame instead of a printer
              /* protected class PaintableJPanel extends JPanel {
                   Image img;
                   protected PaintableJPanel() {
                        super();
                   public void setImage( Image i ) {
                        img = i;
                   public void paint( Graphics g ) {
                        g.drawImage( img, 0, 0, this );
    Thanks
    Ram

    Ram,
    I have had printing problems too a year and a half ago. I used all printing apis of java and I still find that it is something java lacks. Now basically you can try autosense. To check whether your printer is capable of printing the docflavor use this PrintServiceLookup.lookupPrintServices(flavor, aset); . If it lists the printer then he can print the document otherwise he can't. I guess that is why you get the error.
    Regards,
    Kevin

  • How to print .html file ?

    Hello friends,
    In my program I have to give output of my reports into HTML PAGE. This is fine and I have already done. But now on click of a button I have to print this file. The html file I am storing on my project folder only.
    Pls tell me using I/O or any other way, how I can print the file on the printer. I also want the status of succesful printing.
    Even the guidance, where I should look for to get the solution ?
    Chhaya

    I'd start with http://www.google.com/search?q=java+print+html

  • Printing HTML file to printer

    Hi,
    I'm getting
    sun.print.PrintJobFlavorException: invalid flavor
    at sun.print.Win32PrintJob.print(Win32PrintJob.java:327)
                InputStream is = new BufferedInputStream(new FileInputStream("temp.html"));
                PrintService service = PrintServiceLookup.lookupDefaultPrintService();
                DocPrintJob job = service.createPrintJob();
                DocFlavor flavor = DocFlavor.INPUT_STREAM.TEXT_HTML_UTF_8;
                Doc doc = new SimpleDoc(is, flavor, null);
                job.print(doc, null);
                is.close();Or, how do I print HTML code (generated on the fly, not from any file) to printer?

    Whether you can depends on what the printer you're using is capable of. The chance of it working is small, tho. Run this pgm and see what your default printer will accept.
    import javax.print.DocFlavor;
    import javax.print.PrintService;
    import javax.print.PrintServiceLookup;
    public class DocFlavorLister
        public static void main(String args[])
            PrintService service =
                PrintServiceLookup.lookupDefaultPrintService();
            System.out.println(service + " supports :");
            DocFlavor[] flavors = service.getSupportedDocFlavors();
            for (int i = 0; i < flavors.length; i++)
                System.out.println("\t" + flavors);

  • Help me "Printing HTML file"

    Hi all,
    I am trying to print an html file using java. i used the following code
             PrintRequestAttributeSet attributes;
    try {
    PrintService service =
    PrintServiceLookup
    .lookupDefaultPrintService();
    InputStream is =
    new BufferedInputStream(
        new FileInputStream("C:\\STAR.HTM"));
    //Find the default service
    DocFlavor flavor =
    DocFlavor.INPUT_STREAM.AUTOSENSE  ;
    //Create the print job
    DocPrintJob job = service.createPrintJob();
    Doc doc = new SimpleDoc(is, flavor, null);
    //Print it
    job.print(doc, null);
    //It is now safe to close the input stream
    is.close();
    } catch (PrintException e) {
    e.printStackTrace();
    } catch (IOException ex) {
    ex.printStackTrace();
    }it says invalid flavor.
    if any one have an alternative method for printing an html file. please help me.
    Br
    wilzad

    You should post your question on the OTN (Oracle Technology Network) discussion forum.: www.technet.oracle.com. There is an iAS section where you can post questions on oas.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by kate:
    Hi all,
    Is there any owa_util commands for set the printer options. what i need is i want to hide the url name and date at the top or bottom at the time printing a oas html file. Please help me.
    thanks,
    kate.<HR></BLOCKQUOTE>
    null

  • Load and print HTML file

    Hi all :
    I saved a HTML file that include test result labview 8.5 application .. I want to load this file to other application and print it
    How can I do that

    Hi
    its labview vi ... this application will load the file then print it .. this waht i want to do ....
    i generate HTML report and save it into specific directory .. i need application to load and print it
    thanks

Maybe you are looking for

  • Loading a movie clip to Flash

    I have a huge movie clip to be imported, its pretty huge so I divided them to smaller pieces and tried to import, everything my PC gets hung and does not respond after import. What is the best method to import a single huge movie clip? Your help is a

  • Illustrator CS4 on Windows Vista 64--opening multi-page PDF

    I see that Illustrator CS4 will save multi-page PDFs, so I'm wondering what I'm missing that I cannot open all the pages of a multi-page PDF at once?  I'm receiving illustrations from an artist who uses a much older version of Illustrator and he send

  • Java Web Services and hosting companies

    Hi At this moment I am looking for a web hosting companies. I will be developing website in Java and I will also develop Web Services. Can you tell if I am able to host Web Services with any hosting company that supports Java. Or is there any special

  • Possible to preserve creation date when copying an email file?

    I'm using a PowerBook Pro 17" running Mac OS X 10.8.3. I'm copying email files (both Apple Mail and Outlook 2011) by dragging them from their email folder to the desktop.  In the past, the creation date used to be preserved.  But tonight, the creatio

  • Learn to Play Artist Previews not Working

    I can't seem to see the video of the Learn to Play Artist lessons. I'm hesitant to buy a lesson if my video is going to look like it does. It's really just a bunch of wavy lines. Any thoughts? TimR>