Html doc to printer?
I am having trouble finding out how to print(send to a printer) out html. I have tried java 1.4's Java print service, but get this error: sun.print.PrintJobFlavorException: invalid flavor, so it seems operation I am trying to do isn't supported. Have enyone an exaple how to print html?
There is 1 way to do it on Windows, create a file from the application, then make the application run the spooler on the local PC with the location of the file, that should work.
The other: about that PrintFlavor - does the class implement the PrintGraphics interface? It has to if it wants to print.
Thats all I know for now.
Similar Messages
-
Printing HTML Docs with JPS ???
Hello!
How can I print a HTML-File with Java Printing Service (not the source, but the view of it) ???
Some experience???
kind regards
pedros25I'm currently trying to do just that. My problem is
that in order to get a lengthy HTML document to
print, you have to have an object that
implements the Pageable interface. The two methods
I'm having trouble with are
getNumberOfPages()
This returns the number of pages in the Print job.
How do I calculate the number of pages in an HTML
document?
getPrintable(int pageIndex)
For this part, I just rerturn a reference to the JScrollPane which contains the JEditorPane. However,
I also have to get it to scroll to the appropriate
page. Right now I'm using the following:
public void goPage(int pageIndex)
int block = pane.getScrollableBlockIncrement(scroller.getViewport().getViewRect() ,SwingConstants.VERTICAL,1);
int newVal = block*pageIndex;
//scroller.getVerticalScrollBar().setValue(newVal);
scroller.getViewport().scrollRectToVisible(new Rectangle(0,newVal,this.getSize().width,block));
But this seems to be causing a few lines to be skipped
between each page. Any ideas on how to implement the
pageable interface for a JScrollPane that contains a
JEditorPane which contains an HTMLDocument? -
How can I print a html Using javax.print
Hi friends,
I am in big trouble . I use following code to print a html file using javax.print api.
import java.io.*;
import javax.print.*;
import javax.print.attribute.*;
import javax.print.attribute.standard.*;
import javax.print.event.*;
public class PrintPS
public static void main(String args[]) {
PrintPS html = new PrintPS();
public PrintPS() {
DocFlavor flavor = DocFlavor.INPUT_STREAM.TEXT_HTML_HOST;
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
aset.add(MediaSizeName.ISO_A4);
aset.add(new Copies(1));
aset.add(MediaTray.MAIN);
PrintService pservices = PrintServiceLookup.lookupDefaultPrintService();
if(pservices==null)
System.out.println(" printer not found");
if (pservices!= null) {
System.out.println("selected printer " + pservices.getName());
DocPrintJob pj = pservices.createPrintJob();
try {
InputStream fis = new FileInputStream("abc.html");
Doc doc = new SimpleDoc(fis, flavor, null);
System.out.println("printing started ");
pj.print(doc, aset);
System.out.println("printing completed");
} catch (IOException ie) {
System.err.println(ie);
} catch (PrintException e) {
System.err.println(e);
This code gives me "sun.print.PrintJobFlavorException: invalid flavor"
So i use all four TEXT_HTML flavor but i do not find the solution.
I am able to print pdf, jpg, gif files but i can not able to print txt and html file.
My printer supports txt and html printing becaue i do printing directolly by browser's or notpad's print command .Hi friends,
I am in big trouble . I use following code to print a
html file using javax.print api.Use Code Tags
http://forum.java.sun.com/help.jspa?sec=formatting
My printer supports txt and html printing becaue i do
printing directolly by browser's or notpad's print
command .Notepad & your browser prob. convert to the HTML/text(1) into the printers native format.
1) I am suprised that it does not print text. -
Dreamweaver can't preview html doc in Firefox
When I create an html doc in Dreamweaver and I go to the option Preview in Browser and select Firefox, nothing happens. It is supposed to open a Firefox windows and preview the doc there, but it won't.
Just DL'd Firefox13 and it still seems the same!
Out of date or not... It bugged me so here's my answer(MAC), download Firefox 3.5.8 from Mozilla old versions(easy search) and rename it to something relevant, this is your browser for Dreamweaver previews. Download the lastest FF version for general browsing. Edit your dreamweaver browser list to use 3.5.8 - It's a workaround but simply fire up 3.5.8 during site editing and it's plain sailing.
'''Poor-show Mozilla.''' -
Both HTML docs and links dragged from Firefox now fail -- error msg: THERE WAS A PROBLEM SENDING THE COMMAND TO THE PROGRAM -- last night, I had no problem: both types worked fine -- I never shut my HP laptop down -- now I'm afraid to -- I won't even close my Firefox browser -- maybe a TSR is continuing to wreak havoc with my system -- please help soon.
rj_oregon wrote:
If you like email me out-of-band and I can send you a full sample .txt file of "hello world" that takes 3K in plain text, 256KByte in rich-text, most of it injected.
If it looks anything like the sample here, that's unnecessary:
Test_Email_Adblock_enabled.txt
If what you see is substantially different, though, I'd be interested in seeing it. (I can't e-mail you, though, as I don't know your e-mail address. You can find mine, though, by looking at the contact link at the bottom of any page on my site, listed in my profile here.)
This is not a feature in adblock, I view it as a bug.
I agree, it should not be doing that.
My suspicion is that AdBlock works by adding this code to every page you view, thus rendering the advertising elements invisible. However, in the case of OWA, it must be inserting that code in a bad place, where it shows up in the message. Mail servers will be prone to rejecting such a message, probably because some of the strings that code uses to identify these ads might look malicious. There's nothing that I can see in that code that's actually malicious, though... just a bunch of CSS conditions that make matching elements invisible. -
Sub-Tabs attached to HTML docs in CS4
Anyone else find this to be true as well?
Do yourself a favor and don't use the sub-tabs under a html
doc to edit CSS. They dont update when you have the CSS file in its
own tab and save. It makes it incredibly confusing switching
back-n-forth between the HTML file and the CSS file.
The only thing it is useful for is quickly seeing all of the
linked files to your html doc, not for editing those files.Hi Tyler,
Yes, that's correct. The File > Save All command was added
to help this
case.
HTH,
Randy
> Anyone else find this to be true as well?
>
> Do yourself a favor and don't use the sub-tabs under a
html doc to edit CSS.
> They dont update when you have the CSS file in its own
tab and save. It makes
> it incredibly confusing switching back-n-forth between
the HTML file and the
> CSS file.
>
> The only thing it is useful for is quickly seeing all of
the linked files to
> your html doc, not for editing those files.
> -
New to Servlet - Existing html doc
I created a new servlet and have an existing html doc. How do I connect the doc to the servlet so that it will send request to the servlet.
In the html file I have the following code.
<form action = "/servlet/TEDServicesDatabrowserServlet" method = "post" name ="myName">
I place the follow in the web.xml file
<servlet>
<servlet-name>TEDServicesDatabrowserServlet</servlet-name>
<servlet-class>mil.navy.nrlssc.dmap.TEDServices.TEDSServer.TEDServicesDatabrowserServlet</servlet-class>
<init-param>
<param-name>WorkingDirectory</param-name>
<param-value>C:\tedsservletworkingdirectory</param-value>
</init-param>
<init-param>
<param-name>ScratchDirectory</param-name>
<param-value>c:\apache\htdocs\mapb</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
It is not responsing to any request I make. What to do!Hello
A sample web.xml file is attached for your reference.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app id="WebApp">
<display-name>Web</display-name>
<filter>
<filter-name>RedirectFilter</filter-name>
<display-name>RedirectFilter</display-name>
<filter-class>test.RedirectFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>RedirectFilter</filter-name>
<url-pattern>/ResourceLookupServlet</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>RedirectFilter</filter-name>
<servlet-name>ResourceLookupServlet</servlet-name>
</filter-mapping>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>validate</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<servlet-name>ResourceLookupServlet</servlet-name>
<display-name>ResourceLookupServlet</display-name>
<servlet-class>test.ResourceLookupServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ResourceLookupServlet</servlet-name>
<url-pattern>/ResourceLookupServlet</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-nested.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-template.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-template.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
</taglib>
</web-app>
You are missing the servlet mapping tag. The servlet mapping tag maps the servlet name with a url pattern, so that the web server can understand which servlet to call.
In your html form specify this url-mapping
HTH
VJ -
Jump to a Named Anchor when loading an HTML doc
I have a CollapsiblePanel with a Content Link to a Named
Anchor in info.html and I thought I could use loadURL() to load the
page into the Div "thetext" but it does not work. Can Spry Jump to
a Named Anchor when it loads an HTML doc?
onClick:
Spry.Utils.updateContent('thetext',
'/information2.php#Insurance')
And I also tried:
Spry.Utils.loadURL('thetext', '/information2.php#Insurance')
The Head:
<script src="SpryAssets/SpryCollapsiblePanel.js"
type="text/javascript"></script>
<link href="SpryAssets/SpryCollapsiblePanel.css"
rel="stylesheet" type="text/css" />
<script language="JavaScript" type="text/javascript"
src="Spry_P1_6_10-01/includes/SpryData.js"></script>
<script language="JavaScript" type="text/javascript"
src="Spry_P1_6_10-01/includes/SpryEffects.js"></script>On 08 Oct 2007 in macromedia.dreamweaver, antonioconte wrote:
> Does anyone know if and how its possible to jump to a
named anchor?
> I need to use the behavior panel to call a page into a
pop up and
> jump to an anchor too - is this possible?
Sure - just make the link to the anchor:
<a
href="page.php#anchor"
onclick="popupscript('page.php#anchor');return false;">
Open my popup window</a>
Making the link attribute (href=) the same as the popup
window means that
people who are visiting your site with javascript turned off
will also
get the information from the page. The 'return false' in the
onclick
event means that the href won't fire if javascript is turned
on.
Joe Makowiec
http://makowiec.net/
Email:
http://makowiec.net/contact.php -
i can't seems to print using my macbook air with hp series printers. When I plug the printer via usb to my system, the printer was recognized and installed. But when i send a doc for printing, it doesn't print all . Any help?
Greetings,
Here's a direct link to the drivers you need, they should work perfectly for your situation. -
Hi,
Can anyone provide me good docs for Print Workbench.
Good docs will be rewarded with points.
regards ,
VijayHi
Go thru this Link.
http://www.sap.com/industries/media/pdf/FICAPWB_EN.pdf#search=%22Print%20Workbench%20in%20SAP%22
Thanks
Sunil -
Protecting html,doc,pdf pages
I have a members protected area of a website. There are 4500
users that need to get to this area. Obviousl;y, this is too big
for my windows 2003 server internal users to handle. Is there a way
to have non-cfm files protected on the server such as html, doc, or
pdf files? I need to integrate this with a database for
authenicationFor a start, if you want to prevent access to a file or
directory, store it away from the web root. That is sufficient for
most purposes.
For added security, modify the file's or the directory's
permissions. If you want only a certain group of users to have web
access to a file or directory, then set up authentication in IIS
for that file or directory. -
OnLoad error while saving an html doc
I was saving an html doc, that I have used many times before as a 'start' doc for a website, I goet a very strange error.
What could be causing this and/or, how can I 'fix' this?The answer is in the Dreamweaver FAQ. You have a corrupt cache file. See Deleting a corrupt cache file.
-
Urgent help -- Printing HTML Content to printer from servlet
I am wanting know if there is a way to Print Reports from servlet.I have some idea about JPS API but it shows some errors on printer services. Pls help me, if any onme having sample code mail to me [email protected]
I want to print a html content to printer.Use the JavaScript window.print() function to print out the current window. However used the HTML LINK tag it can print out a report generated by a servlet without displaying the contents of the report in the browser window.
-
Printing a File(.html, .doc ,etc) from LabVIEW
Hi All,
I am currently using LabVIEW 6i(PDS). In one of my application I had created (HTML) reports. Now I want to print the report through LabVIEW. If I use the Standard report format than LabVIEW has a vi to print the report. Please guide me how to print the report or file through LabVIEw.
Thnaking you.
Vishal Shah.Let me explain my self
I generate a report then I save it in specific directory,,, what I want to if I want to print this file I want to load it then print it ..
I build application to explain what I want to do.
Attach see file ,, please run print vi
Attachments:
print1.vi 45 KB
print.vi 14 KB -
Printing a HTML doc from a JEditor Pane
I would like to print a HTML page from a JEditorPane. I've searched trhough the web, but haven't found any free libs yet... Does anybody have some tips?
See
JEditorPane.setPage(URL)
once you've done that and its rendered you should be able to print by using my StandardPrint class. Search for StandardPrint.java on this site
Maybe you are looking for
-
Some Events Don't Show Up in List View on Calendar
I love using Calendar on my iPhone 4S. I like the List View, where I can everything I have for that day. However, I've noticed a glitch: some events which are on my calendar for that day when you view the day by tapping on the day of the month, do
-
Are mac book pros no use buying as apple could stop supporting them in a few years ?? Will this mean you won't be able to update it ???
-
I have been searching online for hours and hours, and could find no solutions:?Last spring, my Zen Micro began having the "headphone jack problem." After finally becoming fed up with it, my dad found a guide showing how to solder and fix it. I had ne
-
i had a mac pro system..from last 2 days the keyboard is not working properly..if i typed a key but it displayed 2 or 3 keys..what is the problem? is keyboard gone..?
-
After moving from Entourage to Mail - a few questions.
I have just switched over from using Entourage 2008 to Mail, and so far I am happy (especially because of the better stability), but had a few questions about using Mail.app: - In the list of mail items, how do I (can I?) select the last email in the