Cache data locally in an HTML file used in a folio.

Hi
I am using a form in an HTML page as a page in my folio, does anyone know how to cache the information locally so that the information in the form will stay when you navigate away from the page and back again.
Alan

You should use html session storage or html local storage.
I didn't test if it works in folios.

Similar Messages

  • How to feed data to generate a html file using XSLT?

    I need to implement email content generation in the hmtl format using XSLT. The document information is stored in a xsl file and the data is generated dynmically in the application. How to feed the data to have the file?
    Thanks,
    v.

    Thanks for your information. I, however, already thought about using string stream instand of a XML file to pass in data. I am looking for a more intelligent method. It doesn't seem to have one so far.

  • How to read HTML files using UTL_FILE

    Hello Friends,
    How to read HTML files using UTL_FILE package ? According
    to Oracle documentation UTL_FILE can read or write OS Text Files.
    Thanx in advance..
    Adi

    HI Hareesh,
    i have gone through that blog.
    i tried it...but i am getting mapping error  no receiver determination fond because there are so  many excel files.
    my data is available on sharedString.xml but also it is in not same order.
    i have no clue how to handle this part form the blog.
    "This way our mapping will receive all data from the sheet in an XML format. The only thing that's left is to create an XSD file from the XML file we received in order to be able to use it in the mapping and as our Service Interface and we can proceed with mapping. As you can see from the sheet.xml files all the data is placed with column name and row number so it's not that difficult to map it to an table type format using the Message Mapping only (no java, abap mapping required)."

  • A working method to load local PDF and HTML files on iOS

    I had a lot of trouble getting this to work, and I'm hoping this post saves someone time. Some of the information that's been posted in other locations is either wrong, incomplete, or might only work on Android. By the time you read this message the information here may no longer be accurate, so here's the testing environment:
    Window 7
    Flash CS 5.5.0
    AIR 2.7.0.19530, which was compiled on June 28, 2011
    iPad 1, version 4.3.5 of iOS
    Let's get started.
    On iOS, you load external PDF and HTML files using the StageWebView class.
    On Windows, StageWebView works but the HTMLLoader class is a better choice if you're creating a desktop app.
    You can also load HTML files by reading in the file's text. The information in this post is only for loading external HTML files.
    StageWebView will not load a file that's in File.applicationDirectory. All files bundled in your app are placed in File.applicationDirectory, which means you'll have to copy any external file you wish to load with StageWebView to another directory.
    So where can you copy your file? File.applicationStorageDirectory won't work. File.documentsDirectory does work.
    Several people have recommended copying to a temporary file using File.createTempFile(). This works, but there's a catch: it seems that, like Windows, StageWebView relies on a file's extension when determining how to load it. When you create a temporary file on iOS using File.createTempFile(), the file will have no extension (and on Windows, File.createTempFile() creates a file with the extension .tmp, which is equally problematic).
    The solution to the file extension problem is to rename the temporary file by appending the original file's extension. AIR currently does not have a <file>.rename() function, so you'll have to do it using <tempFile>.moveTo().
    Here's some code I've successfully tested several times on both iOS and Windows. The file is copied to the temp directory. The file's extension is restored by just slapping the original file name to the end of the temp file.
            private function loadExternalFile():void
                var webView = new StageWebView();
                webView.stage = this.stage;
                webView.viewPort = new Rectangle( 0, 0, 1024, 555 );
                // Works with either html or pdf files.
                // These are stored in the root of the application directory.
                var fileName:String = "euei.pdf";
                //var fileName:String = "euei.htm";
                var sourceFile = File.applicationDirectory.resolvePath( fileName );
                var workingFile = File.createTempFile();
                try
                    sourceFile.copyTo( workingFile, true );
                    // You have to rename the temp file
                    var renamedTempFile:File = workingFile.resolvePath(workingFile.nativePath + fileName);
                    workingFile.moveTo(renamedTempFile, true);
                    webView.loadURL( renamedTempFile.url );
                catch (err:Error) { }

    I tried this with Flash CS5.5 and AIR 4.0 SDK. Any pdf loaded simply fills the viewPort with black. Also tested with a png version of the pdf and that displayed just fine.
    What's the purpose of copying to a temp work file? I found that webView.loadURL( sourceFile.url ); gave me the exact same results.
    Any ideas?
    Thanks!

  • How to parse a HTML file using HTML parser in J2SE?

    I want to parse an HTML file using HTML parser. Can any body help me by providing a sample code to parse the HTML file?
    Thanks nad Cheers,
    Amaresh

    What HTML parser and what does "parsing" mean to you?

  • How to display HTML files using ABAP Webdynpro?

    Hi,
    I have a html index file and a bunch of other files accessed by the index file  in a specific directory on the SAP server. I'd like to display the index file via ABAP webdynpro and allow the users to click on what they need to see. How can I achieve this using utilizing the ABAP webdynpro technology ?
    Thanks!

    Hi Thomas,
    Thanks for taking the time to answer my question.
    I have the main html file and all other files needed by the main file in one directory on the application layer of SAP. I'd like to provide the user with a link, by clicking on which they should be able to get to the main html file using the browser. This is just a standalone application.
    I can try the approach using BSPs, however, I'm new to that area. Could you point me in the right direction to get started?

  • How to extract data from Essbase to Flat File using ODI

    Hi,
    Anyone know how to extract data from Essbase to Flat File using ODI?
    Thanks in advance.
    Regards,
    Sumardi

    Hi,
    Have you read through :-
    Oracle Data Integrator Adapter for Hyperion Essbase Getting Started - http://download.oracle.com/docs/cd/E10530_01/doc/epm.931/odiess_getting_started.pdf
    Oracle Data Integrator Adapter for Hyperion Essbase User's Guide - http://download.oracle.com/docs/cd/E10530_01/doc/epm.931/odiess_users.pdf
    If you have read them and are still have a problem at what stage are you having the issues?
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Acquire data from a tab delimited file using a popup dialog object on a stamp

    I am trying to import data from a tab delimited file using a popup dialog object on a stamp.  I have purchased the book by Thom Parker--All About PDF Stamps in Acrobat and Paperless Workflows and have been working through the examples in the appendix.
    My problem is understanding how to bring the data into the dialog object from the file.
    I don't want to plagiarize his book--so am electing at this time not to show my code.  The  script is reading the file, just not bringing in the records from the file so that I can select which line to import into the stamp.
    I have typed in the code exactly how the book describes, but when the popup dialog object is selected, there is nothing in the drop-down.  When I click OK, the first record is put on the stamp--except for the fields that I am wanting to appear in the dialog object popup box.
    I have searched the forums, and also the JavaScript reference.  There are examples of the popup dialog object, but none of them show how to import the data from a file--just for the items to be typed in as the list.
    Any help would be greatly appreciated!  i have been trying to work on this for several months now.

    Karl
    Thank you for getting back with me!
    In answer to your questions:
    1. Your trusted function is not a trusted function. Did you put this
    function into a folder level script so that it will get executed at system
    startup?--
         yes--I saved the script as a .js file and put it in the following path (I have Acrobat XI Pro for Windows)
    C:\Documents and Settings\tjohnson\Application Data\Adobe\Acrobat\Privileged\11.0\JavaScripts\GetTabData.js
    2. The script cannot find your tab delimited data file, or it cannot
    extract the data. Did you add the data file in the correct location? The
    location from the script in the book would be c:\mydata\Contacts.txt
    Yes--the file is in the same path as the book.
    Below is my code that references the file.
    var cPath = "/c/mydata/Contacts.txt";
    the slashes in the book go in the direction of the text above--should they go in the direction that you have in your question?
    Also,  the name and email address need to be separated by one Tab character.
    They are. 
    3. The fields need to be named the same way as the columns in the data file (the two names are in the first line of the file).
    My headings are RevByFromTab and EmailFromTab--which match the names of the two fields on the stamp.
    So, check that you are not getting any errors in the JavaScript console
    (Ctrl-J or Cmd-J), and verify that the tab delimited file is in the correct
    location
    When I run in the java script console--and I just run the script on the stamp,
    it says
    TypeError: event.source is null
    17:Console:Exec
    undefined
    When I place the stamp on the page, the popup box is working, but when you click on the down arrow, there is nothing listed.  When I click OK, the RevByFromTab is populated by the first item in the file, but the EmailFromTab field says undefined.
    Thank you
    Message was edited by: tdjohnson7700

  • Opening HTML file using a Jbutton

    can anybody tell me how can I open an HTML file using a Jbutton.
    I have a help button on my menu of my GUI. I wanna open a html document using the help (jbutton)
    thank you

    call this class in your button action
    import javax.swing.JInternalFrame;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import java.net.URL;
    import java.net.MalformedURLException;
    import java.io.*;
    import javax.swing.text.*;
    import javax.swing.JOptionPane;
    import javax.swing.BorderFactory;
    import javax.swing.border.*;
    import javax.swing.JDesktopPane;
    public class Taa extends JFrame implements HyperlinkListener{
         public JEditorPane hh;
         public JScrollPane ss;
    *Taa default constructor
    *@param Nothing
    *@return Nothing
    *@thorws nothing
    *@see descon
    public Taa(){
    //set top left image in the gui
    setIconImage(Toolkit.getDefaultToolkit().getImage("buttons/help.jpg"));
    try{
         File f=new File("Here you can put your html"such as"Help.htm");
         String s = f.getAbsolutePath();
         s = "file:"+s;
         URL url = new URL(s);
    hh=new JEditorPane(s);
    hh.setEditable(false);
    hh.addHyperlinkListener(this);
    catch (MalformedURLException e) {
         System.out.println("Malformed URL: " + e);
    catch (IOException e) {
         System.out.println("IOException: " + e);
         ss=new JScrollPane(hh);
         getContentPane().add(ss);
         setBounds(232,0,490,500);
         setResizable(false);
         show();
    *Implementation of HyperlinkEvent
    public void hyperlinkUpdate(HyperlinkEvent e) {
         if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
         linkActivated(e.getURL());
    *this method activate link
    *@param URL the URL
    *@return Nothing
    protected void linkActivated(URL u) {
         Cursor c = hh.getCursor();
         Cursor waitCursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
         hh.setCursor(waitCursor);
         SwingUtilities.invokeLater(new PageLoader(u, c));
    *this class load help files
    class PageLoader implements Runnable {
    *Taa default constructor
    *@param Url the url,Cursor c
    *@return Nothing
    *@thorws nothing
    *@see descon
         PageLoader(URL u, Cursor c) {
         url = u;
         cursor = c;
    public void run() {
         if (url == null) {
              // restore the original cursor
              hh.setCursor(cursor);
              Container parent = hh.getParent();
              parent.repaint();
         } else {
              Document doc = hh.getDocument();
              try {
              hh.setPage(url);
              } catch (IOException ioe) {
              hh.setDocument(doc);
              getToolkit().beep();
              } finally {
              // schedule the cursor to revert after
              // the paint has happended.
              url = null;
              SwingUtilities.invokeLater(this);
         URL url;
         Cursor cursor;

  • How to upload an html file using jsp and jdbc

    Hi,
    im trying to upload an html page using JSP and jdbc. but of no success.
    my aim is to keep some important html pages in the database.the file size can vary.the file has to be selected from a local machine (through the browser) and uploaded to a remote machine(where the databse resides).
    any help/sample code or pointer to any helpful link is appreciated.
    thanks in advance
    javajar2003

    When uploading a file, I use a byte array as a temporary buffer..
    So, you should then be able to store the byte array in the
    database as binary data.
    example>
    //Temporary Buffer To Store File
    byte[] tmpbuffer = new byte[860];
    //Some Code To Upload File...
    //File Should Now Be In Byte Array
    //Get DB Connection and execute Prepared Statement
    Connection con=//GET DB CONNECTION;
    String sql=insert into TABLE(page) values(?);
    PreparedStatement ps=con.prepareStatement(sql);
    ps.setBytes(1,tempbuffer);
    ps.executeUpdate();
    //Close PS and Free DB Connection
    ..... and this method looks like you dont even have
    to store the file in a byte array, you can just give
    it the input stream.
    ps.setBinaryStream(int, inputStream, int);
    You may have to make several attempts at this. I have
    uploaded a file and temporarily stored it in a byte array,
    but have never from there stored it in the DB as binary
    data.. but this looks like it'll work.
    Good Luck!

  • How to mail the html file using javamail????

    hi
    i have captured the output of a jsp page in a html file....
    now i wish to send it in the mail ( *** not as an attachment)
    ie
    i wish the output of the jsp ie the html file to be displayed in
    the message box (ie text area) ..... and then when recieved by the
    receipient it shoud be displayed in the message area....
    is there any way to do this ........

    well as said by my fellow poster googling could have given you quick results.
    Anyways,if you are unable to do so checkout the below code snippet.
    SendMail.java:
    ===========
    import java.io.File;
    import java.io.FileReader;
    import java.io.BufferedReader;
    import java.util.Properties;
    import javax.mail.Session;
    import javax.mail.Message;
    import javax.mail.Transport;
    import javax.mail.internet.InternetAddress;  
    import javax.mail.internet.MimeMessage;
    import javax.activation.*;
    * @Author RaHuL
    * uses SMTP to send Email.
    public class SendMail {
        /** Method used to read contents of html/text/XML file */
        public String readFile(String fileName){
           StringBuffer sb = new StringBuffer();
           BufferedReader input = null;
           try{
               input = new BufferedReader(new FileReader(fileName));
               String str = null;
               while ((str = input.readLine()) != null){    
                      sb.append(line);
           }catch(Exception exp){
               exp.printStackTrace();
           }finally{
                  try {
                        if (input!= null)  
                          input.close(); 
                   }catch (Exception ex) {
                         ex.printStackTrace();
           return sb.toString();
        /** Send an HTML Email with the specific subject to specfic toAddress based on specified fromAddress & Smtp Hostname
          * and returns true on success.
        public boolean sendMail(String toAddress,String fromAddress,String hostName,String subject,String htmlMessage,String contentType) {
           boolean flag = false;    
            try {
                 String to = toAddress;
                 String from = fromAddress;     
                 String host = hostName;
                 // Setting Mail properties
                 Properties props = new Properties();
                 props.put("mail.smtp.host",host);
                 props.put("mail.debug","true");
                 // Getting a New Instance Generated by the API
                 Session session = Session.getInstance(props);
                   NOTE: a Mail Session could be configured and could be got from the Container via JNDI
                         which could be a better practise.
                // Instantiate a message
                Message msg = new MimeMessage(session);
                //Set message attributes
                msg.setFrom(new InternetAddress(from));
                InternetAddress[] address = {new InternetAddress(to)};
                msg.setRecipients(Message.RecipientType.TO, address);
                // Setting Subject Type
                msg.setSubject(subject);
                msg.setSentDate(new Date());
                // Setting Content Type
                msg.setContent(contentType);
                // Set message content
                msg.setText(htmlMessage);
                //Send the message
                Transport.send(msg);
                flag = true;
            }catch (Exception mex) {
             // Prints all nested (chained) exceptions as well
                mex.printStackTrace();
         return flag;
        public static void main(String args[]){
            SendMail sm = new SendMail();
            String htmlMessage = sm.readFile("myHtmlFile.html");
            boolean flag = sm.sendMail("[email protected]","[email protected]","your.smtp.server","EMail SubJect",htmlMessage,"text/html");
            if(flag)
              System.out.println("MAIL SENT SUCCEFULLY");
             else
              System.out.println("MAIL SENDING FAILURE");                          
    }NOTE:
    =====
    Make sure you inculde javamail & java activation libraries.
    Hope that might help :)
    REGARDS,
    RaHuL

  • How to generate PDF file from HTML file using Acrobat API's

    Hi,
    I want to generate a PDF file from an HTML file on server side(C# .Net).
    Their is a COM interop called "AcrobatWeb2PDF" availaible but could not find any document regarding how to use it.
    I cant use "Adobe live cycle PDF Generator" as we just have license for Adobe Acrobat 8 Professional.
    Please help...
    Thanks and Regards,
    Anand Mahadik.

    > It is hard to believe that Adobe doesn't provide a toolkit for generating PDF files, so many web based applications have vector based content that needs to be converted to PDF!!!!
    They do, it's just not free (A company in business to make money? I'm sure IBM would never think this way... ;)). As mentioned you have Adobe LiveCycle PDF Generator, which you can customize and extend with Java. You also have the Adobe PDF Library SDK, which is written for use with C/C++ although if you license it from Datalogics (the only company in NA Adobe allows to license the PDF Library) you will also get .NET and Java interfaces (part of the DLE - DataLogics Extensions).
    > There must be a way to generate PDF dynamically on a server or from Javascript!
    JavaScript? Not really, no. As far as I'm aware JavaScript has no file system access capabilities without some form of intermediary (like sending the data to a webservice that writes it out to file). How would you create a PDF file with JavaScript?
    The PDF Standard is also in ISOs hands now (ISO 32000-1:2008), it is no longer owned by Adobe - you can download a copy of the specification from them and write your own library based on that as well.

  • How to get data from an existing Excel file using report generation toolkit

    I'm trying to use the Excel Get Data vi from the report generation toolkit, but i can't figure out how to turn a browsable path into the right type for the VI.  I've tried using the New Report.vi, but that doesn't work unless you use a template.  It won't open an existing excel file and make it an open report to pull data from.
    Essentially, i have a bunch of excel files that have data in them and i want to use a VI to analyze the data.  So, i'm trying to pull in all the data directly from the excel file so i don't have to reproscess them all into text so i can use the more standard spreadsheet VIs.  But to even convert the excel file programtically in labview won't i still need to be able to open the excel file and get the data?
    Solved!
    Go to Solution.

    I C.
    Got it,
    the reason why I can view it using my Excel file because its in .CSV.
    I open Microsoft Excel to open .CSV file.
    But you can also open .csv file with notepad.
    So, you cannot open .xls with Read Spreadsheet File
    I learn something everyday
    Best regards,
    Krispiekream

  • 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

  • SSI of HTML file using SpryAssets

    Hi,
    I've saved a navigation header for my website in a nav.html
    file. I'm trying to get another file, test.shtml, to use
    server-side includes to include nav.html into it.
    However, the nav.html file was built in DW using a Spry Menu
    Bar, which stores its files in a directory SpryAssets.
    I have the following statement located right after my
    <body> tag, so it appears at the top of the webpage:
    <!--#include file="nav.html" -->
    The design view in DW shows the nav.html file included, but
    menu-bar is expanded to look like normal text. The DW preview
    doesn't show the nav.html being there at all.
    Any ideas how to solve this? The nav.html file sits in the
    same directory as test.shtml, and looks great when I open nav.html
    alone.
    Thanks in advance. -Gary

    An Include is a code fragment, not an entire page.
    It should not contain <html> or <body> tags, just
    the snippet of code that
    you are replacing the Include directive with.
    As currently set up, your page code will look like this once
    the Include has
    been processed by the server and "included" in the main page
    code:
    This means duplicate doctypes, head tags etc etc which won't
    work.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN"
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <body>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN"
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8" />
    <title>Untitled Document</title>
    <link href="StyleSheet.css" rel="stylesheet"
    type="text/css" />
    <style type="text/css">
    <!--
    -->
    </style>
    <script src="SpryAssets/SpryMenuBar.js"
    type="text/javascript"></script>
    <link href="SpryAssets/SpryMenuBarHorizontal.css"
    rel="stylesheet"
    type="text/css" />
    <style type="text/css">
    <!--
    .style2 {
    font-size: 16px;
    font-weight: bold;
    color: #336600;
    margin-top: 30px;
    margin-bottom: -12px;
    .style3 {
    color: #336600;
    font-weight: bold;
    .style6 {
    font-size: 14px;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: bold;
    vertical-align: middle;
    color: #6633FF;
    .style7 {
    font-size: 14px;
    font-family: Arial, Helvetica, sans-serif;
    position: static;
    height: 0px;
    top: 10px;
    margin-bottom: -12px;
    font-weight: bold;
    color: #333333;
    .style8 {
    color: #CC0000;
    font-weight: bold;
    .style10 {
    font-family: Arial, Helvetica, sans-serif;
    position: static;
    height: 0px;
    top: 10px;
    margin-bottom: -12px;
    font-weight: bold;
    color: #333333;
    font-size: 13px;
    .ucscheader {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    font-weight: bold;
    margin-bottom: -10px;
    text-align: center;
    .spacer1 {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    margin-bottom: 10px;
    -->
    </style>
    </head>
    <body>
    <table width="750" border="0" align="center"
    cellpadding="0"
    cellspacing="0"
    bgcolor="#669900">
    <!--DWLayoutTable-->
    <tr>
    <td width="159" height="7"></td>
    <td width="104"></td>
    <td width="327"></td>
    <td width="10"></td>
    <td width="150"></td>
    </tr>
    <tr>
    <td height="60" colspan="2" valign="top"><img
    src="Images/jittertime_icon_logo.jpg" alt="JitterTime Logo"
    width="222"
    height="53" hspace="20" vspace="3" /></td>
    <td> </td>
    <td> </td>
    <td valign="top"><img
    src="Images/allabouttimingjitter.jpg" alt="Timing
    Jitter Logo" width="129" height="56" hspace="0" vspace="2"
    align="top"
    /></td>
    </tr>
    <tr>
    <td height="6"></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    </tr>
    <tr>
    <td height="24" valign="top" bgcolor="#336600"
    class="HomeText">Home</td>
    <td colspan="2" valign="top" bgcolor="#336600"><ul
    id="NavMenu2"
    class="MenuBarHorizontal">
    <a class="MenuBarItemSubmenu" href="#">Training</a>
    <a href="#">Training Details</a></li>
    <a href="#">Seminar Overview</a></li>
    </li>
    <a href="#"
    class="MenuBarItemSubmenu">Resources</a>
    <a href="#">Rates &amp;
    Frequencies</a></li>
    <a href="#">Phase Jitter Calculator</a></li>
    <a href="#">Links</a></li>
    </li>
    <a class="MenuBarItemSubmenu" href="#">Articles</a>
    <a href="#">Convert dBc/Hz to ps</a> </li>
    </li>
    <a href="#" class="MenuBarItemSubmenu">Company</a>
    <a href="#">Biography</a></li>
    <a href="#">Contact</a></li>
    <a href="#">Policies</a></li>
    </li>
    </td>
    <td colspan="2" valign="top" bgcolor="#336600"
    class="HomeText"><div
    align="right" class="SiteMap">Site
    Map</div></td>
    </tr>
    </table>
    <script type="text/javascript">
    <!--
    var MenuBar1 = new Spry.Widget.MenuBar("NavMenu2",
    {imgDown:"SpryAssets/SpryMenuBarDownHover.gif",
    imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
    //-->
    </script>
    </body>
    </html>
    <p>this is a test</p>
    </body>
    </html>
    Regards
    John Waller

Maybe you are looking for

  • Cannot access common websites security certificate not trusted

    I am unable to get to many frequently accessed websites from either Chrome or Safari due to Security Certificate Trust issues. I have been attempting to access Paypal all afternoon without success, as there is no "Proceed anyway" button. I was only a

  • How can i make a Audio/video Application using JMF

    I want to work on media application and currently want to work on JMF.can anyone guide me about some basic to advance level concepts of java media framework.thanks...

  • How to do in-place-upgrades with the new patch sets (11.2.0.2.0)?

    Hello, Oracle has released the new patch set 11.2.0.2.0 for Oracle Database whose installation deviates from the previous patch set instructions. Are there any new deployment procedures available to do an in-place upgrade? We have a lot (about 100) o

  • XI Post Installation....Need help...

    Hi, I am new to XI and I am installing XI on a Windows 2000 server. I am done with the installation part....(web as ABAP+Java add in + newtweaver XI Component)....Now I am in the post install configuration steps.... My question is that...when I did t

  • Ipod touch or nano?

    i really like the new nano, but i want the internet too. is it worth getting an ipod touch over a nano? if the wifi reliable enough to spend the extra money?