Error in printing HTML to PDF

I want to print a HTML in PDF writter when i execute it creates text file
and give this error-[ Warning: Empty job. No PDF file produced. ] %%
Does any body know the solution?????
My code
try {
// Open the image file
InputStream is = new BufferedInputStream(
new FileInputStream("E:/examples.html"));
// Prepare the output file to receive the postscript
OutputStream fos = new BufferedOutputStream(
new FileOutputStream("E:/cr.ps"));
// Find a factory that can do the conversion
// DocFlavor flavor = DocFlavor.INPUT_STREAM.GIF;
DocFlavor flavor = new DocFlavor("text/html; charset=utf-16", "java.io.InputStream");
StreamPrintServiceFactory[] factories = StreamPrintServiceFactory.lookupStreamPrintServiceFactories(flavor,DocFlavor.BYTE_ARRAY.POSTSCRIPT.getMimeType());
System.out.println("hhhhhhhhhh"+DocFlavor.BYTE_ARRAY.POSTSCRIPT.getMimeType());
if (factories.length > 0) {
StreamPrintService service = factories[0].getPrintService(fos);
// Create the print job
DocPrintJob job = service.createPrintJob();
Doc doc = new SimpleDoc(is, flavor, null);
// Monitor print job events; for the implementation of PrintJobWatcher,
// see e706 Determining When a Print Job Has Finished
// PrintJobWatcher pjDone = new PrintJobWatcher(job);
// Print it
job.print(doc, null);

Try:
1. LOTS of println() calls.
2. Don't ignore exceptions, insted of:
public class Danger {
    public static void main(String args[]) {
        try {
            Somebody.doSomething();
        } catch (Exception lazinessIsAVirtue) {}
}try:public class Safer {
    public static void main(String args[]) throws Throwable {
        Somebody.doSomething();
The VM will call Safer.main([Ljava/lang/String;)V (vm syntax) regardless of private or throws.

Similar Messages

  • Error according printing html report

    I bulid a vi to print HTML report but I have problem printing this report .
    I try ever to used some example which national Instrument bulid , such as Report Generation > Text
    Report, but ever in this example I couldn't print the file (HTML).

    Wisam,
    Could you tell us what procedure are you following to run that example? and also what version of LabVIEW you have?
    The way you have to run that example (Text Report.vi) is that when you open it, in the control that reads: "Report Type" you select HTML, and also in the control that reads "HTML Save Path" you set the path like for example "C:\test1.htm", now run it and you should have now the HTML format type report. I believe that you also have in that same directory of examples another one called : Example HTML Report Report, that one also shows how to print a report to an HTML file. Try the example you mention setting up the controls that I wrote above and it should work. If not please contact us and we can try to send you an original example and see if i
    t works. You can do it by this same means or by direct contact ( www.ni.com/ask ).
    Good luck!...
    Nestor Sanchez
    Applications Engineer
    National Instruments
    Nestor
    National Instruments

  • Print html to PDF

    HTML to PDF

    If I understand your question correctly, you're trying to figure out how to turn a web page into a  PDF file.
    I don't know any app or alternative way to print a webpage to a PDF on iPad, but you can go to a Mac or PC and download the PDF reader. From there, in the same menu as print you will find, "Print to PDF".
    Sorry :(

  • PDF export from Pages fails "Print - error while printing"

    Every month I have been generating PDF versions of my invoices by using the 'export' function of Pages. This has always worked fine without any problems.
    Today (end of Feb 08), the pdf export function always fails with 'Print - error while printing". A pdf file is saved to disc but it is corrupted and unreadable. I can still export as rtfd.
    I don't see anything about this in the logs, but I do notice that there was a Pages software update to 3.0.2 earlier this month.
    Anybody know how to fix this?

    Hello
    Before re-installing, it may be useful to
    a - repair permissions with Disk Utility
    b - trash the preferences file: <bootVolume>:Users:<yourAccount>:Library:Preferences:com.apple.iWork.Pages.plis t
    if it's not sufficient, try to print from an other user account.
    If it works this way, you will know that the application's files are not the wrongdoers as every account calls the same application file.
    Yvan KOENIG (from FRANCE samedi 1 mars 2008 15:33:41)

  • Batch PDF Reports raising error REP-3002: Error initializing printer.

    We are running Reports 6.0 in Windows NT 4.0. When run manually the PDF reports are able to see the PostScript Print Driver and generates PDF output. We have a batch job on the NT that gets kicked off from the Mainframe via XPATH, which spawns multiple report processes as needed to run the PDF reports. We get the error "REP-3002: Error initializing printer." under this scenario.
    Any help to resolve this will be appreciated.
    Thanks,
    Babu

    Hi,
    i've changed to use RUN_REPORT_OBJECT as your advice and followed the instructions in "Oracle Reports Remote Printing Utility - An Oracle Technical White Paper December 2000". i tested orarrp by created the HTML file follow the steps in page 5 of the paper, it worked.
    then i modified existed form, set report object property like this :
    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_EXECUTION_MODE, BATCH);
    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESTYPE, FILE);
    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESFORMAT,'PDF');
    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESNAME,'test.rrpa');
    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_SERVER,'Rep60_NTSERVER2');
    note : i'm not sure that i set the right value for REPORT_SERVER property, i got this value from TNSNAMES.ORA file.
    then call the report with this statement :
    :GLOBAL.ReportHandle := RUN_REPORT_OBJECT(report_id);
    it showed the same error message :
    "REP-3002 Error initializing printer. Please make sure a printer is installed."
    i think i set something wrong, but i don't know where. could you help me ?
    Hunsa

  • Memory full error with printing pdf

    Occasionally I get a memory full error with printing pdf (Cmd-P - then use save PDF on lower left dialog screen). This is when just printing a few pages.
    Why Am I getting this and how can I fix this?

    I am not sure why but I have noticed some Adobe products when used to convert html documents (web pages) to pdf, can produce very large files.
    Try using Apple's Preview to see if those 'memory full' messages still occur.
    I am presuming you have plenty of free hard drive space and also sufficient RAM so suggesting it is an application bug about memory that is at issue and not actually a lack of physical memory.

  • Save to PDF in TextEdit - Error While Printing

    When I try to save a text file to PDF I receive the error message - "Error while printing".  This only seems to be happening to text files I open or create in TextEdit.  It works fine if I log in as a different user.  I've run repair permissions and also deleted a couple of com.apple.print plist files in my user library, but the error remains.
    Is there anything else I should try short of reinstalling TextEdit?
    Thanks in advance for any advice!
    Rick

    On OS X 10.8.2, with TextEdit, I can open or create text documents and export to PDF without any issue.
    Here are the two preference tabs and settings that work for me. You can single click on the images for a larger version.
    New Document
    Open and Save
    PDF documents on OS X are created with binary content, which is the junk you observe.

  • Error in generating HTML, PDF format

    Hi guys
    I am using Oracle Reports 6i with ORACLE 9i Database.
    After generating my report when i tried to generated report output in HTML or PDF format then system return following error message.
    PDE-PER001 Internal error (REP-3335. Unhandled Internal CA Error. depep 2).
    Remember when i tried to generate HTML or PDF format on other PC file generated successfully.
    Best Regards.
    Hassan Raza

    hello,
    you might want to contact oracle support services. maybe you need a patchset or so.
    thanks,
    ph.

  • "Save As PDF" in Safari only Results in "Error While Printing"

    Hi, first time poster. I searched through the forum and didn't find anything like my problem specifically on topic. I still Hope this isn't being redundant with anything else that has been posted.
    Problem:
    When I go to Print->Save as PDF the normal dialogue comes up without a problem. Its when I click on the save button that I an error saying "Error While Printing" pops up. Pulling up the console nets me with the following:
    5/25/08 11:36:12 AM Safari[95216] Printing failed because PMSessionEndDocumentNoDialog() returned -30871.
    And from CUPS:
    I [25/May/2008:11:35:06 -0700] Listening to ::1:631 (IPv6)
    I [25/May/2008:11:35:06 -0700] Listening to ::1:631 (IPv6)
    I [25/May/2008:11:35:06 -0700] Listening to 127.0.0.1:631 (IPv4)
    I [25/May/2008:11:35:06 -0700] Listening to /private/var/run/cupsd (Domain)
    I [25/May/2008:11:35:06 -0700] Loaded configuration file "/private/etc/cups/cupsd.conf"
    I [25/May/2008:11:35:06 -0700] Using default TempDir of /private/var/spool/cups/tmp...
    I [25/May/2008:11:35:06 -0700] Configured for up to 100 clients.
    I [25/May/2008:11:35:06 -0700] Allowing up to 100 client connections per host.
    I [25/May/2008:11:35:06 -0700] Using policy "default" as the default!
    I [25/May/2008:11:35:06 -0700] Full reload is required.
    I [25/May/2008:11:35:06 -0700] Loaded MIME database from '/private/etc/cups': 52 types, 49 filters...
    I [25/May/2008:11:35:06 -0700] Loading job cache file "/private/var/spool/cups/cache/job.cache"...
    I [25/May/2008:11:35:06 -0700] Full reload complete.
    I [25/May/2008:11:35:06 -0700] Cleaning out old temporary files in "/private/var/spool/cups/tmp"...
    I [25/May/2008:11:35:06 -0700] Listening to ::1:631 on fd 4...
    E [25/May/2008:11:35:06 -0700] Unable to bind socket for address ::1:631 - Address already in use.
    I [25/May/2008:11:35:06 -0700] Listening to 127.0.0.1:631 on fd 6...
    I [25/May/2008:11:35:06 -0700] Listening to /private/var/run/cupsd on fd 8...
    I [25/May/2008:11:35:06 -0700] Resuming new connection processing...
    *What I've Tried*
    I haven't had any luck with the solutions others have posted online (like Little Snitch being a culprit) when I've searched for either the "Save As PDF", "Error While Printing", or the console log error. I've run the printer reset function in system preferences and I've never had any printer installed on the system.
    I should note that prior to any of these problems with Safari, I installed the Firefox 3 RC1. I've since uninstalled it, because I was suspicious of it having an effect (being a little buggy as an RC). Removing it with AppCleaner hasn't changed the problem.
    Thanks all,
    -d

    I could print/save as .pdf until I did my latest software upgrade. Now I get "error while printing", and have been unable to find a solution. this is quite a problem for me, because I do a lot of research on the Web and have saved my results for years in pdf. Have you found a solution?
    Best regards,

  • Ad2kregp.dll error when printing to PDF file

    Greetings,
    I use Acrobat 7.0 to print reports from a home grown SQL Server application to PDF on a Dell laptop with WinXP. When I'm logged on in the office everything works fine. When I try it from home via VPN I get the follwoing error message:
    Access violation at address 70001CC7 in module 'AD2KReGP.DLL'. Read of address 00000000.
    I searched both the knowledge base and forums and have found no matches to my situation. Any help is greatly appreciated.
    Thanks,
    Brian McCulloch

    One of my users was getting the same error message when trying to print to a pdf from freq12. This problem is an adobe problem though. What I did to fix the problem was I got a copy of the 'AD2KReGP.DLL' from a computer that adobe was working fine on and replaced the bad one with it. The location of the file to be replaced is: C:\WINDOWS\system32\spool\drivers\w32x86\3
    After replacing the bad file with the file from another computer it worked great. Hopefully this helps.
    Ben Hall

  • My Acrobat 8 Pro is failing to print to a pdf from multiple software.  I get an error message that a repair fixes but only for a little while.  Pretty soon the trial version of 9 that I installed pops up telling me it has expired but it would take me to a

    My Acrobat 8 Pro is failing to print to a pdf from multiple software.  I get an error message that a repair fixes but only for a little while.  Pretty soon the trial version of 9 that I installed pops up telling me it has expired but it would take me to a way to buy a valid serial number and then 8 stops working again.  I’d be happy if the 8 I paid for worked right or I could get 9 for a small cost but I cannot afford $450 or $20/month.  I need a permanent solution that I should be already paid for with 8 pro.

    After multiple repair procedures with reboot in AA8 I was eventually able to restore the printing to pdf function from various software.  However I have again lost my Acrobat tab in Outlook 2007.  I need that back, but today an even bigger problem arose.  AA8 has stopped printing to fax.  It faxes a blank page.  The only fax printing option is “Microsoft Shared Fax Driver”.  My fax software is “Windows Fax and Scan” and it was working fine just a couple weeks ago.  My OS is Windows 7 Professional.
    I have tried doing the updates you referred to but I get error messages like these:
    “No qualifying products found to apply this update, or update has been already applied”
    or
    “The upgrade patch cannot be installed by the Windows Installer service because the program to be upgraded may be missing , or the upgrade patch may update a different version of the program.  Verify that the program to be upgraded exists on your computer and that you have the correct upgrade patch.”

  • After 9.3 update getting error printing to Adobe PDF while converting from Powerpoint to PDF

    That happened after upgrading Acrobat Pro 9.1.2 to 9.2->9.3 on Windows XP sp2 platform. Converting from other Microsoft Office 2003 products is totally normal(Excel, Word) Did anyone came accross and know how to fix that?? We have many users with exactly same issue.

    thanks...figured out my problem!
    Date: Wed, 3 Feb 2010 12:24:29 -0700
    From: [email protected]
    To: [email protected]
    Subject: Re: After 9.3 update getting error printing to Adobe PDF while converting from Powerpoint to PDF
    What happens if you try to print to the Adobe PDF printer?
    >

  • I have protected pdf files. You can not copy things, but it is allowed to print. In the menu of the pdf it says you are allowed to print. I already printed lots of times the document. But today there is an error "The printer is not admittet to print these

    I have protected pdf files. You can not copy things, but it is allowed to print. In the menu of the pdf it says you are allowed to print. I already printed lots of times the document. But today there is an error "The printer is not admittet to print these pdf". Its new. Theres no problem with the printer. I can print word documents, internet pages etc. But today I can not print anymore my pdf document, although printing is allowed and only copying is forbidden.
    How to solve the problem with the pdf?
    Thank you.

    Hi Hans,
    There seems to be other restrictions in the document that's not allowing it to print.
    Would it be possible to share the document with me so that I can have a look?
    Regards,
    Rave

  • Printing a Word 2013 file to a PDF, which prints the PDF, but when printing the gereated PDF to a laser printer an error occurs: Error: invalidfont Offending Command: show Stack: (  )

    I was wondering if any else has had an problem with error codes printing PDF that has been generated from Word 2013 to Acrobat Xi Pro. I have converted fonts from local install to common fonts - Arial, and the same error occurs.
    Help!

    Thank you Bill,
    you maybe right, there seems to be a localised issue as the PDF that has been created from Word 2013 can be printed, on the same printer I am using, by other members on the server with different versions of PDF.
    Still stuck though.

  • Out of Memory Error while printing to PDF

    I am using Apache FOP with OC4J on windows platform for printing to PDF. I got the following error when printing a report with about 10,500 records to PDF.
    07/09/20 15:23:07.78 fop: Servlet error
    java.lang.OutOfMemoryError: Java heap space
    Is there a way out of this problem. Could anyone please give me some suggestions?
    Thanks in advance
    Ravi

    You can try adding a -Xmx128M (or larger) when you run the java command to start oc4j.jar

Maybe you are looking for