Problem with printing generated pdf.

Hello!
I need to print pdf file, that was generated by my application. I am using Apache FOP to generate pdf (xml+xslt). For printing I am using Maxatec MT-150 receipt printer. Seems, that pdf is generated successfully, because I can open it and I also can print it using Windows interface. However, when I am sending it to printer in my JAVA application, printed file is just set of unreadable characters and black lines. I was trying to use different DocFlavors, like DocFlavor.INPUT_STREAM.AUTOSENSE, DocFlavor.URL.AUTOSENSE, but neither had a luck. My code looks like this:
PrintService receiptPrintService = getReceiptPrinterService(printerName);
DocPrintJob printJob = receiptPrintService.createPrintJob();
FileInputStream fis = new FileInputStream(new File("StatusReport.pdf"));
Doc doc = new SimpleDoc(fis, DocFlavor.INPUT_STREAM.AUTOSENSE, null);
printJob.print(doc, null);
private static PrintService getReceiptPrinterService(String printerName) {
          PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);
          for (PrintService printService : services) {
               if (printerName.equals(printService.getName())) {
                    return printService;
          return null;
     }For some reason I cannot set DocFlavor.INPUT_STREAM.PDF, as it throws following exception: sun.print.PrintJobFlavorException: invalid flavor. (despite the fact that I can pdf using the same printer, but through Windows interface)
So, I really don't see what is the problem. Should I use something in my xslt template to specify content type? currently I have:
<xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="yes"/>Any help would be appreciated.
Alexander.

@Dick_Adams
I am sorry, but what error message are you talking about? The only error I get is "sun.print.PrintJobFlavorException: invalid flavor" and as far as I understand it depends on printer, what is supported and what is not supported. Or am I wrong? I am using standard java.awt.print library.
@AndrewThompson64, thanks for the tip!)) It does print correctly, but in this case I am not sure I have enough possibilities to control printing. For instance, my pdf was printed as landscape, but I need portrait.

Similar Messages

  • Problem with printing a PDF

    Hi All,
    I'm developing a web application written in J2EE that uses Java Reporting Component (JRC) to display crystal reports from some filters recovered from a jsp and passed to a report .rpt previously designed and invoked just at runtime.
    I have a problem with printing a PDF:
    I want, after entering the filters in a jsp, to print a report in PDF format (WORD) without opening it
    with Adobe Reader (Microsoft Word). The class of API JRC used for export is ReportExportControl.
    Can anyone help me?
    I wish a great day to You all.

    Hi Ted Ueda,
    sorry for the delay of my answer.
    I understand very well the problems related to security.
    With the following code that I used to produce a report (PDF) at runtime,
    is the PDF created on the server and then sent to the client, or is it directly created on the client as PDF
    from RTF previously realized?
    ReportExportControl exportControl = new ReportExportControl();
    String report = report path;
    ReportClientDocument reportClientDoc = new ReportClientDocument();
    reportClientDoc.open(report, OpenReportOptions._openAsReadOnly);
    Object reportSource = null;
    reportSource = reportClientDoc.getReportSource();
    //The method setConnectionProperties() stores all the connection parameters in the collection
    //ConnectioInfos
    ConnectionInfos connInfos = setConnectionProperties(request, reportClientDoc);
    exportControl.setEnableLogonPrompt(false);
    exportControl.setEnableParameterPrompt(false);
    exportControl.setReportSource(reportSource);
    exportControl.setDatabaseLogonInfos(connInfos);
    //Single method to pass parameters to Crystal Reports. Using classes ParameterFieldController and
    //ParameterFieldDiscreteValue
    setReportParametersValue(reportClientDoc, reportParameters, subReportParameters);
    ExportOptions exportOptions = new ExportOptions();
    //Set the export format (PDF)
    exportOptions.setExportFormatType(ReportExportFormat.PDF);
    PDFExportFormatOptions PDFExpOpts = new PDFExportFormatOptions();
    exportOptions.setFormatOptions(PDFExpOpts);
    exportControl.setExportOptions(exportOptions);
    exportControl.setExportAsAttachment(true);
    try {
          exportControl.getHtmlContent(request, response, getServletConfig().getServletContext());
    } catch (ReportSDKExceptionBase e) {
    throw new ApplicationException("error code", ": error message"); }               
    As, however, I predicted in my previous message about the direct printing on the client,
    I read about ActiveX, but I don't know how to use them.
    I read this information in the 'Crystal Reports for Eclipse Developer Guide' about "printMode" attribute:
    "In ActiveX print mode, an ActiveX control is downloaded to the client machine and the report is send directly to the printer...."
    The ActiveX alternative is a java applet that runs on the client and takes the pdf from the server and prints directly onto the clients through the commands that I used in the DOS command line:
    1)     AcroRd32.exe /p /h FILENAME
    where
    /p = print
    /h = hide window
    to print the report and
    2)     tkill AcroRd32
    to close Adobe Reader, because it doesn't end automatically after printing and the command  /h  is used just to minimize the process.
    I hope you can give me advice because I need to print directly on the client. Thank you

  • Problems with print to pdf with Acrobat Pro 9 and FireFox 8

    ***The page I am using for my base is: http://blogs.adobe.com/digitalpublishing/2010/12/google-ebooks.html
    ***I have Adobe Acrobat 9 Pro and FireFox 8 installed.
    The problem with FireFox is when I select a part of a web page and try to print that selected text the first line gets chopped, if the text is small the first line might even be missing completely.  Perhaps it is a margin issue but not sure how to modify this.
    I know I am not being very clear but if anybody has any ideas or would like further info please let me know.
    Thank you.

    I suspect if you do the same process with a print to paper, you will get the same result. I got the same result with SeaMonkey, but IE8 printed the full font to a PDF. That would suggest it is not Acrobat, but the browser. As I said, suggests, so be careful about drawing your conclusions.

  • Problems with Printing a PDF of DWG with details as raster refernces???...

    So, I'm trying to print a detail sheet that has a few client details refenced as raster images among our own details. Made a PDF using Adobe PDF. Unfortunately, when printing the PDF of this sheet, somehow the raster details get scaled down and a huge black border appears around where the extents of the original image was in the PDF....
    After doing some more digging I noticed that if I uncheck "print as image" in Adobe, the problem goes away. Unfortunately, the "print as image" option is generally very helpful for printing large drawings or drawing sets...
    Any idea how to fix???
    Thanks guys!

    Bruce De Benedictis wrote:
    I looked at the specs, and it seems this printer has PostScript emulation.
    The Australian stores I looked at showed that PS was an option with this model, with the Samsung proprietary language as standard.
    These days, emulators are quite good,
    I've never seen a machine running a PS emulator do a good job with a large file, especially when it is a multifunction as the CPU still has to be informed of the other functions while it is processing the spool file.
    so I would be more likely to suspect that you would get more bang for the buck by adding memory to the printer. You could probably find that fairly inexpensively, if you go for third-party memory. Manufacturer-supplied memory for printers is usually outrageously expensive.
    Agree with this. More memory would help if it hasn't got the maximum already and vendor supplied memory is always dearer than 3rd party.
    Other ways to get around memory limitations are to print only a few pages at a time, and also to turn off collation.
    Collation is an issue when performing multiple copies. But when the file is a multiple page single document then the Collate button has no impact.

  • Illustrator CS6 - Organisation problems with printing from PDF

    Hi everybody
    I working with the Illustroartor for some times now and I get better every time, but now its appears that’s I have a organization problem with my Illustrator CS6 and maybe somebody can help me here.
    My problem: I create for example a logo and this logo I like to print on an Objekt like a Paperclip or a Lighter. I have now a print template as a PDF File (see attachement) with serveral predefined print areas. Around 100 predefined printing areas are on the PDF File and the only way to add my logo into this 100 predefined printing areas is by using the funktion “copy/past” but this takes long time and I have to adjust each single logo into the predefined printing area by hand … so this way don’t make really sense and is also very time consuming.
    My question is: Is there any way to automate this process by using e.g. the artboard funktion or some other functions?
    I would appreacte any help in this case!!!
    Thank you very much in advance.
    Nice regards
    Klaus

    Hi Alex,
    There is newer version of Data Modeler (3.0 EA2) and it is free
    You can download it from here
    http://www.oracle.com/technetwork/developer-tools/datamodeler/ea2-downloads-185792.html
    Regards
    Edited by: Dimitar Slavov on Dec 9, 2010 2:15 AM

  • Adober reader problem with printing a PDF

    I instaleed Adobe reader on a new computer w/o problem. I could open a view documents. When I go to print I get a message that says: "Adober Reader has stopped working" I can then check one of two boxes: 1. Checkonline for a solution later and close program or 2. "Close program"
    I'm baffeled - all i want to do is print a PDF doc??

    Hi,
    We have provided the permanent fix for this issue. please refer http://kb2.adobe.com/cps/928/cpsid_92870.html.
    Thanks,
    Atul Agarwal
    Adobe Systems

  • Problem with printing to PDF from ID

    I am having trouble printing my ID document as a PDF using "export" or print options. See screen shots for error messages.

    First off, you are not PRINTING to PDF, you are EXPORTING to PDF, which is the preferred method here. You can try export to .idml (see Remove minor corruption by exporting), but most likely there's a problem on one of the pages that won't get fixed that way. For troubleshooting tips, see Adobe Community: File Crashing on Output - printing/PDF/other

  • Text problems with printing to PDF from AutoCAD 2011

    When we print to PDF from AutoCAD, the text in the PDF looks wrong/bad.  It takes on a jagged appearance and doesn't look anything like what the font is supposed to look like.  Any suggestions?

    Yup. It's not that it won't do it, it is just limited to 129". Thanks for the thought. When you print in Acrobat you can see the document size and the page size the program is assuming below the print window. The properties have been set, document adjusted, page size customized. It works exactly as it's designed (according to Adobe help, their knowledge base, etc) but only up to 129". Can do it at any size, decminal, etc. up to and including 129 inches. Prints beautiful, doesn't get chopped no issues at all. Just hits a wall at 129". Been doing it with blueprints for years. Just never needed it this big. In my case it's not a printer/plotter limitation. It's the Adobe PDF printer which is advertised to be able to cusomize page size to 15,000 inches.
    Tried customizing in post script, no luck there either.
    Again, I very much appreciate the suggestions....
    S.

  • Problem with printing indesign PDF

    Hello
    I'm french so I hope you'll understand what I mean.
    I'm working on a product catalog. When I export in PDF, everything is ok.
    But when I want to print, I have some blank pages.
    If you want I have an example file
    Can someone help me ?
    Thank you

    Thanks everyone!  That really helped.
    There were a few other things that I had to make sure of also.
    Solution:
    Images placed in InDesign that were made in Photoshop or another program should be in ckmy format.  The background needs to be in the same ckmy.   Transparency blend must be set at CKMY, then Transparency Flattener presents must be set at Rasters/Vectors: 0 Line art and text resolution: 600, Gradient and mesh resoltuion 300.  Exporting to PDF must be done under present PDF/X-4:2008 Compatibility: Acbrobat 7.

  • Problem with printing pdf file

    hello,
    lately i have problem with printing pdf file:
    i click on the print button and the respod is very slow
    it takes more than a minute till the print window apears.
    i tryied to install version X but it's the same, the problem exist only when printing via adobe reader,
    other programs i'd working much faster.
    please advice,
    thank you

    No, it is not set to overprint. Also, I have to add that the printing results were not consistent. Sometimes it covered and sometimes it did not.

  • Problem with printing files created by tcpdf class

    Hello,
    I have problem with printing pdf files created with tcpdf php class which contain embedded fonts
    http://www.tecnick.com/pagefiles/tcpdf/example_008.pdf
    Could someone try to print that example file at his Reader (printing to file .ps will be fine).
    I'm trying to determinate if problem is in my system (Ubuntu 8,04) in Reader or in class.
    Thanks in advance

    No problem with Adobe Reader 8 or 9 .

  • Problem with printing from Acrobat Reader XI

    SInce I installed Acrobat Reader XI I have got problems with printing out pages. The text starts a bit down (2 cm) on the paper, resulting that the last part of the text on the page will be missing. And the missing part does not follow on page 2, it just don´t comes out!
    It doesn´t matter what settings i click in on the print setting page in Acrobat Reader, it always gets the same result.
    Does anyone know what can be the problem?

    No files appeared in C:\Users\Pavilion\AppData\Roaming\Adobe\Adobe PDF\Settings but they did appear in Distiller.
    I tried to copied them from C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\Settings, but found they were already there.  I copied them by adding -COPY before .joboptions in the name.  Now they appeared in  Printing Preferences with the -COPY added.
    I tested a print from Word (using File / Print), but was not prompted for the filename or location.  I checked my entire system and couldn't find the PDF file anywhere.  I tried changing the Port to Desktop\*.pdf using Printer Properties, but that didn't work either.
    I was able to successfully use the Acrobat menu item in Word & Excel to create a PDF but it automatically created the file on the Desktop without an option to change the filename.
    After several days and hours, I gave up and installed Acrobat X on the W7 computer.  I can still use Acrobat XI on the W8 computer.  So be it!
    Thanks anyway for your attempts to help.

  • Problem with printing more than one page (ghostscript broken?)

    Hello,
    since one of the last package updates I have problems with printing more than one page. The print problems occurs as well with pdf files as well with printing websites. I use an actual KDE system with commercial turboprint printer driver. The first page always prints fine, but all consecutive pages are corrupted.  As from a similar problem some months ago, I assume a broken ghostscript package. I tried to downgrade ghostscript to check that, but I get depency problems:
    root@arch32 dieter]# ls -l /var/cache/pacman/pkg/ghostscript-*
    -rw-r--r-- 1 root root  9906288 21. Mär 2010  /var/cache/pacman/pkg/ghostscript-8.71-3-i686.pkg.tar.xz
    -rw-r--r-- 1 root root 11402624  8. Okt 22:44 /var/cache/pacman/pkg/ghostscript-9.00-1-i686.pkg.tar.xz
    [root@arch32 dieter]# pacman -U /var/cache/pacman/pkg/ghostscript-8.71-3-i686.pkg.tar.xz
    Löse Abhängigkeiten auf...
    Suche nach Zwischen-Konflikten...
    Fehler: Konnte den Vorgang (Kann Abhängigkeiten nicht erfüllen) nicht vorbereiten
    :: libspectre: benötigt ghostscript>=9.00
    [root@arch32 dieter]#
    Anyone else having printing problems or a solution for my problem?
    Thanks, Dieter

    This may not be related but I had a problem printing a pdf today whereby the second page got corrupted. The same pdf had printed fine several months ago. I realised that (long story) for some reason I had switched drivers (HP printer) from hpijs to hpcups. I installed the printer again as a "new" printer using the hpijs driver and it printed properly this time.
    So it may be that the bug causes issues with some drivers. You could try an alternative driver for the printer as temporary workaround?

  • Problem with Printing from Spool

    Dear Experts,
                  I am facing the problem with Printing, Once i press the Print button, the spool is generated. But Instead of giving one page, It is generating the more than one page. Some times, the last page its getting is blank. I am confused how this happens.
    Kindly solve my issue, this happen frequently.
    Thanks & Regards,
    Srinivas

    Dear Siva,
                   Everything is ok in SPAD. This happen for few process order for COPI transaction.
    Regards,
    Srini

  • Problem with saving a pdf file to computer. Continually get an error message " This document could not be saved. There was a problem reading this document (21).

    Need advice on a saving file issue. I'm having problem with saving a .pdf file to computer. Continually get an error message " This document could not be saved. There was a problem reading this document (21). This is new as this error message just recently started to pop-up.

    More information about this issue can be found here:
    https://forums.adobe.com/thread/1672655
    A "quick" fix that worked for me was to uninstall Adobe... then download the base install for Adobe Reader 11.0.
    Then download each of the individual updates and run them sequentially. 
    I've installed back up to the last security update which is version 08 and have been able to do normal Save As operations.
    You will have to disable automatic updates in order to stay at version 08 until Adobe resolves this issue in a later release.
    http://www.adobe.com/support/downloads/product.jsp?product=10&platform=Windows
    Adobe Reader 11.0 - Multilingual (MUI) installer    AdbeRdr11000_mui_Std
    Adobe Reader 11.0.01 update - Multilingual (MUI) installer    AdbeRdrUpd11001_MUI.msp
    Adobe Reader 11.0.02 update - All languages    AdbeRdrSecUpd11002.msp
    Adobe Reader 11.0.03 update - Multilingual (MUI) installer    AdbeRdrUpd11003_MUI.msp
    Adobe Reader 11.0.04 update - Multilingual (MUI) installer    AdbeRdrUpd11004_MUI.msp
    Adobe Reader 11.0.05 security update - All languages    AdbeRdrSecUpd11005.msp
    Adobe Reader 11.0.06 update - Multilingual (MUI) installer    AdbeRdrUpd11006_MUI.msp
    Adobe Reader 11.0.07 update - Multilingual (MUI) installer    AdbeRdrUpd11007_MUI.msp
    Adobe Reader 11.0.08 security update - All languages    AdbeRdrSecUpd11008.msp

Maybe you are looking for

  • New Infinity Order - As it happens !!!

    I've just ordered Infinity (today) and I thought I'd track the order etc here for others to see 'live' what to expect: As a precursor, I've had BT ADSL for many years, and no end of problems with the Indian call centre, but great experience from the

  • How can I create a pdf but not have it open in acrobat afterwards

    I want to be able to create a pdf file but not have it open up in acrobat after it is created. I am doing this in an Access application that outputs a report to a pdf and then faxes that pdf to a fax number associated with that report.  It might loop

  • Finding a minimum value in an array without using loops

    I can find a minimum value in an array using a loop, but I am unsure of how to do it without any type of of loop Here is what I have using a loop: // This method searches for the minimum value in an array public static int min(int a[]){ int min = a[0

  • Adobe PDF 8.0 error - cannot print on MacBook Pro

    I have just checked and I am up to date on on software. Since getting this laptop I have not been able to print to PDF with the Adobe PDF 8.0 printer. I have deleted the printer - which sets up fine. And re-added it back in. When I print I get this i

  • Log file location settings

    Is it possible to change the log file locations, both master log file (from hyperion_home\essbase\essbase.log) and individual application log files (from their respective applicaiton folders), to some completely different locations. If yes, then what