Trying to print word document in postsript format it gives invalid flavor

I want to print word document in PDF format or post script format.I have installed PDF writter .This gives exception -invalid Flavor
Please help me how shall i correct this
import java.io.*;
import javax.print.*;
import javax.print.attribute.*;
import javax.print.attribute.standard.*;
import javax.print.event.*;
public class PrintPage {
public PrintPage() {
public static void main(String[] args) {
try {
// Open the image file
InputStream is = new BufferedInputStream(new FileInputStream("E:/a.doc"));
// Find the default service
DocFlavor flavor = DocFlavor.INPUT_STREAM.POSTSCRIPT;
PrintService service = PrintServiceLookup.lookupDefaultPrintService();
// 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);
// Wait for the print job to be done
// pjDone.waitForDone();
// It is now safe to close the input stream
is.close();
} catch (PrintException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}

This mean your printer did not support this DocFlavor.
Try to find what DocFlavor your printer support.
// Just check the default one
PrintService service = PrintServiceLookup.lookupDefaultPrintService();
DocFlavor[] flavors = service.getSupportedDocFlavors();
for (int i = 0; i < flavors.length; i++) {
System.out.println(flavors.toString());

Similar Messages

  • Printing Word Documents on HP Deskjet 5150

    I have a G4 flat panel iMac connected to a HP deskjet 5150 printer. When I try to print Word documents, it will only print a single page of multipage documents. If I want multiple copies of a single page document, it will only print one copy. All other applications print without problem.
    I have reinstalled the drivers and that has not solved the problem.
    Any help would be appreciated.
    iMac G4   Mac OS X (10.3.9)  

    Hi Georgia and others,
    I have a similar problem - but printing from Word to a HP DeskJet 960 printer.
    It dones not seem to be a problem with all documents here, but since I yesterday used several hours trying to figure out what caused the problem I want to share my experiences with you. I had the same problem with another document on the same printer some moths ago (but not on our Laser printers at my company office).
    I installed the newest printer driver from HP (several times) with no effect. After opening the document and saving it to a ".txt" document - without any formatting - the whole document got printed! This is not a real solution in most cases, as one loses all the formatting etc. But it indicated to me that the printer worked and communicated with word. Also it was possbile to print (other) documents without any problems to the same printer, at the same time.
    So have you tested different documents on your printer?
    I'm wondering if this indicate that the problem is hidden somewhere in something inside Word/Office and it's communication to the printer - as I have seem someone reporting similar problems with printing from Excel? (something with some "codes" in specific documents?).
    Also, I have seen an update from Apple on some issues with printing from Preview - so I was also wondering if the use of "Show quick Preview" in Word/Office does has something to do with this problem? Has anyone tried to de-select this feature before trying to print? (I deleted the problematic document and can not re-create the problem currently).

  • Adobe Pro - will not print word documents to pdf.. keeps crashing

    Hello,
    I have Acrobat Pro and when I try to print Word documents it says printing... and then crashes. The window to select the name of the pdf to print to never pops up. The Word program crashes and reopens. The print icon appears on the system tray and just says spooling.
    I am using Word 07.
    Acrobat Pro was working fine to print PDF's on this version of word for a few months then for some reason it just stopped.
    When I print PDF's from existing PDF's it works fine.
    I have tried to repair the program but it did not help.
    Any ideas?
    Thanks,
    Miguel

    If you are having problems creating a PDF, there are two steps you should do FIRST
    Go to the appropriate vendor web site and apply all updates to the program you are using (several recent messages have concerned problems with MS Office conversion, with the response that different versions of Office have different BUGS that must be fixed by a download from Microsoft - and MS Office products are not the only ones which may, from time to time, need to be updated to work properly)
    Apply all updates IN NUMBER ORDER
    Acrobat Update http://www.adobe.com/support/downloads/product.jsp?product=1&platform=Windows

  • Converting a PDF to a Word document that maintains formatting

    I am trying to convert a PDF to a Word .doc and it when I select the Export to Word Document option, the formatting goes crazy.  Is there a way to maintain the formatting from the .pdf  to .doc?

    Not really in Acrobat no. If the original document used proper tagging you'd have a better shot at it but those are rare.
    There are PDF to Word converters that do a better job available. Try Google and you'll get many options (can't vouch for any personally).

  • Acrobat Pro XI Will Not Print Word Document with a Rotated Table

    I have a MS Word document that is mostly text, but include a table that has been rotated in a text box to fit on the page.  When I try to print to PDF using Acrobat Pro XI, the document crashes at the page the table is on.
    I have tried several attempts to print using the Acrobat Printer, convert to PDF feature and trying to print just the page alone.  Acrobat will simply not print word document with a rotated table.
    Any idea how to fix this?
    Word 2013, Windows 7, Acrobat Pro XI 11.0.06

    In the full document, the print to PDF goes only as far as the table, then ends - not printing the table.  The remaining pages are not printed.
    For example, I have trimmed the file down to just the table page, and included links to it, and a copy of the PDF it generated.
    https://dl.dropboxusercontent.com/u/60543835/Forums/Table%20Sample_140903.docx
    https://dl.dropboxusercontent.com/u/60543835/Forums/Table%20Sample_140903.pdf
    The error message I now get when I try to print is: "There is not enough memory or disk space to repaginate or print this document."
    However, with the Task manager open, the memory never seems to get above half of the available (the graph bar fluctuates a little, but stays stable")
    The page prints to a regular HP or Xerox printer with no problems. 

  • I can print word documents but can not print email messages

    i can print word documents but can not print email messages
    I am using an officejet 4500 wireless on  Windows 7

    I called HP and after being on the phone for 1 1/2 hrs  They reinstalled my printer and I printed an alignment page without then I tried to print arouble  I was also able to scan a page to HP.      When I tried to print something from my email  it barely printed 2 faded lines and that was it  I openrd my word documents and was able to print a clear copy.  HP told me my cartrige was empty so I changed my cartridge with no results it was the same.  I use refill  CATRIDGES AND NEVER HAD ANY PROBLEMS but they told me they can ruin a printer.  I told them I would purchease new HP cartridges and they we agreed they would call me back on Monday to determine if my problems were solved with the new cartridges.  What I don't understand is how I can print documents but not emails.   HELP

  • Printing word document

    Hi
    Can any one help how to print multiple documents using java,
    can we print word document using java
    thanks in advance

    Hi there
    I have tried this code to print the word:But it display nothing.So i want to know that what's wrong with my code.Thanks for any suggestion.
    using RasterEdge.Imaging.Basic;
    using RasterEdge.Imaging.Basic.Core;
    using RasterEdge.Imaging.Basic.Codec;
    using RasterEdge.Imaging.MSWordDocx;
    namespace RE__Test
    public partial class Form1 : Form
    public Form1()
    InitializeComponent();
    public static string FolderName = "c:/";
    private void button1_Click(object sender, EventArgs e)
    RasterEdgeImaging Word = new RasterEdgeImaging();
    public void WordProcessorPrint();
    WordInputFile = (@"C:/1.docx");
    WordPageNumberStart = "1";
    WordPageNumberStop = "4";
    Printer = (@"C:/ HP Color LaserJet Pro M1213nf");
    Word. Word Processor Print(@"C:/1.docx", "0","4", @"C:/ HP Color LaserJet Pro M1213nf");

  • Pages won't print Word documents

    All of a sudden I can't seem to get Pages to print Word documents. Pages documents print fine, but if I send a Word document to the printer, the printer seems to start, but then never prints. I have an Epson Stylus C86. This problem only happens in Pages and only with Word documents.
    Any ideas?

    Since it only happens with Word docs, I'm wondering if it's a font issue. For the sake experimentation, try highlighting the entire doc, and change fonts, then try printing again.
    -Dennis

  • I recently tried to print a document to an hp printer, but received error 79 message. Can anyone assist me

    I recently tried to print a document to an hp printer, but received error 79 message. Can anyone assist me

    Google is your friend: Hp Error Code 79, Service Errors 79 Laser Printer Repair
    As long as you don’t mind your friend always reading over your shoulder.

  • I can no longer print any document in PDF format. Not sure why

    I can no longer print any document in PDF format. Not sure why? When I try to print, the document saves to my hard drive as a PDF and will not allow me to print? Never had this issue before. Any thoughts?

    Print to file is in the main print dialog (on Acrobat 9.x) as opposed to under Advanced

  • Print BDS document(in PDF format) from SAP R/3

    Hello ,
    I have a requirement to print BDS document(in PDF format) from SAP R/3 without user interaction.
    In simple way, if I execute the program - PDF document will get printed on local default printer.
    Please help me if anybody worked on similar requirement.
    Thank you very much,
    Liliya

    Hi Liliya,
    First you should create a smartform for BDS  Layout and give output parameter like this..
      wa_param-langu     = sy-langu.
      wa_param-no_dialog = 'X'.
      wa_param-getotf = 'X'.
      wa_param-DEVICE = '     '.                               " (here you can give the path of your printer)
      lv_output_options-tdnewid = 'X'.                      "Print parameters,
      lv_output_options-tddelete = space.                "Print parameters,
      lv_output_options-tdnoprev    = 'X' .
       lv_output_options-TDIMMED    = 'X' .               " it will give the immediate output of form in given output device
    I hope it will help you.....
    Enjoy...

  • HT1338 I'm trying to print a document fro safari and the print command is at the bottom of the page and not visible.  I can't move it up and the print command shortcut doesn't work.  How do I print this document.

    I'm trying to print a document from safari and the print command is at the bottom of the page and I can't move it up.  The print command shortcut doesn't work and I would like to know how I can print this document.

    Why do we have to install 2 add ins for something that should be built in? Please add this to the next version or an update to this one even. We should see the full path of a bookmark when we search for it. Show Parent Folder alone isn't enough if you have sub folders, so I installed Go Parent Folder as well in case of sub folders.

  • Printer will not print word documents or documents from internet however does a test print

    My printer will not print word documents or documents from the internet.  However it does complete a test print.  I have uninstalled and reinstalled printer.  I have disabled and enbled the firewall and have run the test doctor programme, which has been unable to identify any problems.  I have a HP deskjet 3050A all in one J611 series printer.

    Sorry that you are having a problem with printing word documents and internet. 
    Are you connected USB or wireless?
    You can try to download an alternative driver and check to see if that works. (Shane_R) has a great post on how to do so. 
    The deskjet 990c is usually the better one. 
    http://h30434.www3.hp.com/t5/Printer-All-in-One-So​ftware-Drivers-e-g-Windows-8/How-to-Assign-Alterna​...
    **Click the KUDOS star on the left to say 'Thanks'**
    Please mark a reply "ACCEPTED AS SOLUTION" if it solved your problem, so others can find it.

  • HT2506 I am trying to convert  word document to a PDF but only half the document accurately converts. Is there a way to fix this?

    I am trying to convert  word document to a PDF but only half the document accurately converts. Is there a way to fix this?

    I have found that complicated document structures causes Word to split the document into parts, but I've always gotten the whole thing, in multiple documents.
    However, with two pages, I can't imagine it is that complicated.
    Any odd fonts or paragraph styles?

  • I am trying to print keynote slides in handout format with notes.  The notes cutoff.  Is there a solution to this problem?

    I am trying to print keynote slides in handout format with notes.  The notes are cut-off.  Is there a solution to this problem?

    You can also turn off the automatic capitalization if you find it gets in the way too often: 
    Settings -> Keyboard -> Auto-Capitalization
    Regards.

Maybe you are looking for

  • Lose functionality in some reports when upgrading to Crystal XI

    Post Author: SMRAVZ CA Forum: Upgrading and Licensing Hello All, I was in the process of upgrading all my reports to crystal XI. As a results, some of the reports have seem to lose their functionality when run through my VB app. If I run the reports

  • Quad dual 20" displays or single 23" display?

    I have a Quad with the stock Nvidia Geforce 6600. I was originally thinking of a 23" HD display, but recently I was considering two 20" displays instead. I believe I coulf get two good quality 20" displays for the price of a single 23" display. What'

  • MacBook screen randomly gets very dark

    My MacBook is from 2007, so it is old and has its problems. I am currently in college and use my iPad primarily for school work. Thank God I got this iPad a few weeks ago because I did not know my computer would have such a huge problem!  When I turn

  • Business Content in BW-BPS

    Short question. Does Business Content (like planning areas and so on) exist for BW-BPS in BW 3.5 or is SEM installation required? And in that case how to review/activate it? Points will be awarded. / Christian

  • TS3212 errors occurred during installation

    errors occurred during installation.