HTML page slow to print
In my application, there is the option of dynamically creating a HTML page by using certain selection criteria which are displyed as dropdowns and checkboxes at the top of the screen, pressing a 'RUN' button populates the report/page and then pressing 'PRINT' displays the report/page without the selection criteria so the option to file/print gives a clean printout, the problem is that if the selection criteria returns many rows the process of sending the report to the printer takes and excessively long time.
As this is 'outside' the application and appears to me to be an issue with the length of time it takes to print a long html page I am not even sure where to start, if indeed it is a coding issue at all?
Any ideas?
I would suggest that you add the page processing stats (that Vikas has as examples on his examples page) to see where the time is really being consumed. He has two key stats; one for the server processing time and the other for the page rendering time.
You can find info here:
Calculating Page Load time
Timing accept processing
Earl
Similar Messages
-
I need to print Html Page into my printer, how can I do this. Any help will be appreciated.
WilFile > Print.
See: http://java.sun.com/javase/6/docs/technotes/guides/jps/spec/printing2d.fm.html
And:
http://java.sun.com/j2se/1.4.2/docs/guide/jps/index.html
And google "Java JPS" -
Problem with printing multiple Embedded PDF in HTML page
I have a list of embedded pdf in a html page to be printed in particular order. Using following java script i am trying silently print the pdf one by one. <br /><br />var objectList=document.getElementsByTagName("object");<br /><br />for(i=0;i<objectList.length;i++){<br /> priobj=document.getElementById(objectList[i].id);<br /> priobj.printAll();<br />}<br /><br />Actually the order of call to the printAll methods works correctly. But the printing of PDF are not is correct order of call. <br /><br />Any Inputs or directions or workarounds on this issue will be really appreciated.<br /><br />Thanks a lot<br /><br />Prem
HI,
wat i understand is u r trying to loop at a variable window .but tht is not suggestable.
write a loop in program lines. read the values in to different variables and the try printing them as text elements that will solve the problem.
or else in other way use a template and that can also solve the problem. -
While I am trying to print a HTML page using window.print(), the bgcolor of the table is not printing.
Did you consider inquiring about this at a Javascript or HTML forum?
-
After a good bit of reading, I found that printing HTML directly to the printer doesn't work for many printers. I don't want to print the code. I want the actual HTML page. I have some code here that reads the HTML file into a JEditorPane and then is rendered into a graphic for printing.
My code compiles fine, I'm not getting any errors, but what I'm also not getting is any pages printing.
Here is the source of my class:
* PrintReport.java
* @author tristan
* Created on September 27, 2007, 4:06 PM
package fedex;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.print.PageFormat;
import java.awt.print.Printable;
import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;
import java.io.*;
import javax.print.Doc;
import javax.print.DocFlavor;
import javax.print.DocPrintJob;
import javax.print.PrintException;
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import javax.print.ServiceUI;
import javax.print.SimpleDoc;
import javax.print.attribute.*;
import javax.print.attribute.standard.*;
import javax.swing.JEditorPane;
import javax.swing.RepaintManager;
public class PrintReport
private FileInputStream fileIS;
private Doc doc;
private DocAttributeSet das = new HashDocAttributeSet ();
PrintService defaultService;
/** Creates a new instance of PrintReport */
public PrintReport ()
public void printHTMLFile (String file) throws FileNotFoundException, IOException
PrintableEditorPane jEditorPane = new PrintableEditorPane ();
jEditorPane.setContentType ("text/html");
jEditorPane.read (new BufferedInputStream (new FileInputStream (file)), "");
System.out.println (jEditorPane.getText ());
PrinterJob job = PrinterJob.getPrinterJob ();
job.setPrintable (jEditorPane);
if (job.printDialog ())
try
job.print ();
catch (Exception ex)
System.out.println (ex);
public class PrintableEditorPane extends JEditorPane implements Printable, Serializable
public int print (Graphics g, PageFormat pf, int pageIndex) throws PrinterException
Graphics2D g2 = (Graphics2D)g;
g2.setColor (Color.black);
RepaintManager.currentManager (this).setDoubleBufferingEnabled (false);
Dimension d = this.getSize ();
double panelWidth = d.width;
double panelHeight = d.height;
double pageWidth = pf.getImageableWidth ();
double pageHeight = pf.getImageableHeight ();
double scale = pageWidth / panelWidth;
int totalNumPages = (int)Math.ceil (scale * panelHeight / pageHeight);
System.out.println ("Total pages to print are " + totalNumPages);
if (pageIndex >= totalNumPages) return Printable.NO_SUCH_PAGE;
g2.translate (pf.getImageableX (), pf.getImageableY ());
g2.translate (0f, -pageIndex * pageHeight);
g2.scale (scale, scale);
this.paint (g2);
return Printable.PAGE_EXISTS;
}I tried using a complex HTML file as well as a basic one, but everytime Total pages to print are 0 is printed back to the console. I can't figure out why it's unable to create any pages to print.DrClap wrote:
I think you will find thatDimension d = this.getSize ();produces (0, 0) until you actually display your component somewhere. I believe it's possible to "display" it in such a way that it doesn't appear on the user's screen, but I don't know how.
There's a Swing forum here where you get answers from people who are good at Swing. Posting here attracts answers from people like me who are mediocre at it.I think that calling validate() on a Container will lay it out and size it's components, even if it hasn't been made visible, but don't take my word for it. -
How do I customize my html page in Dreamweaver CS5 to an Avery template that I wish to print out?
Dreamweaver and websites do not easily match up to Avery templates. If you are trying to develop a program for customers/etc to print labels, you should look for a script to generate a PDF file to ensure the accuracy of the printing.
If you are trying to use Dreamweaver as a substitute to print your own labels, I would highly recommend using Microsoft Word, or Adobe InDesign for a better solution. -
Problem Printing html page with JEditorPane...
Hello All,
I Have a problem in printin html file with JEditorPane...
My Html file contains a Table on it..
Problem is that JEditorPane displays the html file correctly but
it prints the file without print that Table..
So pls help me...
Thanx in advance,..
Amit
[email protected]I think you would know how to retrieve content of an HTML page using the URL object. Just in case.
My apology if this short note doesn't help you at all. -
JEditorPane printing a HTML PAGE
Hi,
Here is my problem. I am displaying a HTML Page in a JEditorPane. So far so good.
when I try to print is printing to my printer. Here is the problem the Text or to say the font doesnot look good in the paper, each letter is not nice and smoth and it looks like some of the pixels in each letter were lost. This happens right when I initialize the JEditorPane with html code. I can also see the pixels in each letter are lost when I initilized it in a JEditorPane.
Any help will be appreciate.How are you printing? Are you using the Printing API?
You can try antialiasing the text before printing:
http://www.exampledepot.com/egs/java.awt/AntiAlias.html -
Print JSP/HTML Pages (perhaps PDF?)
Hi,
i have a table in HTML generated by JSP.
Just like the following simple example:
...<table>
<%
for( Enumeration et = free.getSqlIDs().elements(); et.hasMoreElements();)
String keyt = (String)et.nextElement();
Bean b = new Bean();
b.init(path,DB);
b.setID(keyt);
b.restore();
%>
<tr>
<td>
<%out.print(b.getName());%>
</td>
<td>
<%out.print(b.getAdress());%>
</td>
</tr>
%>
</table>...
No i want to give a button to the user. When pressed, the HTML-Page should transform to PDF.
With such a method i want to print the HTML-Page.
I Know that this is possible with the help of XML/XSP and a stylesheet. But i like to do that with this way:JavaBeans-->JSP-->HTML-->PDF
Anyone a solution, some code examples for me?
Or perhaps another solution to print HTML-Pages in a fine design?
Thank you for your help
AndyHi,
no one any idea?
How do you print Jsp Pages?
Thank you
Bye
Andy -
Script to print an html page in both sides (duplex printing)
Hi,
I have a website that can print page automatically without showing the print dialog box. Now, user's have requirement to print the page in both sides.
Is there any vbscript/javascript that will auto print the html page in both sides (duplex)
Thank You!Hello,
This should be asked in Microsoft's ASP.Net forums:
http://forums.asp.net/
Karl
When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
My Blog: Unlock PowerShell
My Book: Windows PowerShell 2.0 Bible
My E-mail: -join ('6F6C646B61726C40686F746D61696C2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}}) -
Printing a HTML page in a JTextPane
Hi all..
I nned to develop a report generating system for one of the softwares that I am writing and I am planing to generat the report as a HTML page (both text and images) and users can preview them on a JTextPane and can save to disk as html files for further use.
I also want to add functionality to the application to print the report through java.
what I want to do is to print what is displayed in JTextPane (Content Type: text/html)
I am familiour with Printable interface what I cant figure out is how to make the JTextPane printable and how to send the data in JTextPane to printers Graphic object
Can somebody give a sample code for this.
Also if you know any other way of printing a HTML formated text without use of any other componant like JTextPane please tel me how to do it.We had done the same using the JEditor Pane and later print the JEditorPane using the print API..
Here is the code to include the html file.
mainPane = new JEditorPane("file:///C:/project/JavaPrintingAPI/AddGlobalProduct.html");
mainPane.setEditable(false);If it work... hungry for yummy dukes... :-) -
Printing HTML PAGE in a Applet
I am tryng to print a HTML Page in a Applet .
When Using Eclipse Environment everythig goes fine.
Now I am trying to use the appletviewer to run the same
source, but it appears the following:
http://10.15.1.26/
Conecting to http://10.15.1.26/
Exception in thread "AWT-EventQueue-2" java.lang.RuntimeException: java.security.AccessControlException: access denied (java.net.SocketPermission 10.15.1.26:80 connect,resolve)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at javax.swing.JEditorPane.getStream(Unknown Source)
at javax.swing.JEditorPane.setPage(Unknown Source)
at javax.swing.JEditorPane.setPage(Unknown Source)
at javax.swing.JEditorPane.<init>(Unknown Source)
at AppletPrintHTML$EditorPaneHTMLViewer.loadStartingPage(AppletPrintHTML.java:90)
at AppletPrintHTML$EditorPaneHTMLViewer.<init>(AppletPrintHTML.java:103)
at AppletPrintHTML$5.actionPerformed(AppletPrintHTML.java:364)
at java.awt.Button.processActionEvent(Unknown Source)
at java.awt.Button.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.security.AccessControlException: access denied (java.net.SocketPermission 10.15.1.26:80 connect,resolve)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
Why I am not allowed to connect to the site without Eclipse? Any Idea?
Angel PortalThis code
* Load a HTML Page
private void loadStartingPage() {
try {
System.out.println("Conectando a "+ path);
mainPane = new JEditorPane(path);
} catch (IOException e) {
System.err.println("N�o Pode Conectar");
System.exit(1);
Open a html page ( path ) on JEditorPane!
In Eclipse worked just fine!
But if I try to do that on a Browser or appletviewer the error a told you shows up.
I am reading about the The Permission Classes.Someone have heard of it? -
Safari prints HTML page as blank
When I load an HTML page in Safari and print it, it's totally blank. Doesn't happen in Firefox with the same HTML files.
Hi John,
I don't see anything in the console that would be relevant. I'm happy to send you a log if you'd like to see it. (Lots of crap from TextExpander )
Yes, the thumbnail is blank.
I should mention I've already tried moving my printer plists to the trash.
Thanks -
Java has some Class to handle HTML Pages.
I want to build a Button that is able to print the
actual page of the Browser.
I know about ClipBoard Class, SomeOne has
some Idea how to do this?
The idea is to create an applet that creates a button
to print the actual HTML page.
Some Idea how to do this, or where I can get this
information?
Angel -PortalHello, I got your advise and I could write a small program
to open a URL ,put it in a JEditorPane like you sad.
public class EditorPaneHTMLViewer extends JEditorPane implements Printable {
Inside the code I create a menu to change to portrait to landscape.
But now I need somehow to print the HTML Page that I took from
internet.
I believe that I need to load the content of the JEditorPane to a graphics
and then set to a Format of a Page and Print, but I do not know how yet.
Some Hint.
That true that I could do in a easiest way in JavaScript. But it is going to
be possible to do landscape and portrait?
Angel Portal: [email protected] -
Problems printing html page created from servlet
Hi
How do I go about to print a html page that spans outside the visible window (to the left). All I get when I print is the visible page.
Is it at all possible?
Would appreciate an answer.
Thanks
David MossbergNo, not impossible to do.
You need to provide a printer friendly version of the content so that it spans correctly.
Again, this is not a Java problem this is an Application problem.
How you format the data is down to you.
Maybe you are looking for
-
Voice memos app crashing after updating to iOS 8
After upgrading to iOS 8 today, when I launch the Voice Memos app, it attempts to re-index the memos and then in the middle of the process, it crashes. When I re-launch the app, it simply says "No Recordings". I was really distressed, because I had s
-
Google adds in apex don't work in IE!?
Has anyone else noticed that google adds in apex don't seem to appear in IE? It would be seriously annoying if I had a large volume of users! They work fine in firefox or chrome. (this can be seen at: www.schedulemail.net)
-
ComputeSpectrum not working in CS6
I use computeSpectrum in many CS5.5 Flash applications. I just installed CS6 and when I compile the same file the byte array sent back by computeSpectrum is mostly empty. Seems to be a bug in the built player 11. I downgraded toi 10.3 and it still do
-
Hi, We have created a query in which we are using quantity conversion ( defined in RSUOM ) , the target quantity is to be taken from a variable. The quantity conversions is running fine but when we do a value help for the target quantity variable in
-
Should say, I have tried altering the LAN setting to 'automatically detect settings', updating itunes etc but nothing has worked. I have a very unhappy 6 year old!