you can print pdfs from within java, assuming have xml and xsl use the
follwoing

(i found they do not print exactly like adobe does though, so in some cases
it
might not be what you need)

public class PrintFop
{
  // -xml xmlinputfile.xml
  // -xsl xslinputfile.xsl
  // output to printer
  // input -> {"-xml", "somexmlfile.xml", "-xsl", "somexslfile.xsl",
"-print"}
  public PrintFop(String[] args)
  {
    CommandLineOptions options = null;
    try
    {
      options = new CommandLineOptions(args);
      Starter starter = options.getStarter();
      starter.run();
    }
    catch (FOPException e)
    {
      e.printStackTrace();
      MessageHandler.errorln("" + e.getMessage());
            if (options != null) {
              if (options.isDebugMode().booleanValue()) {
                e.printStackTrace();
              }
              if (options.outfile != null) {
                options.outfile.delete();
              }
            }
            System.exit(2);
        } catch (java.io.FileNotFoundException e) {
            MessageHandler.errorln("" + e.getMessage());
            if (options != null) {
              if (options.isDebugMode().booleanValue()) {
                e.printStackTrace();
              }
              if (options.outfile != null) {
                options.outfile.delete();
              }
            }
            System.exit(1);
        }
  }
  public static void main(String[] args) {
    String myArgs [] = {"-xml", "C:\\tmp\\test.xml",
                        "-xsl", "C:\\tmp\\test.xsl",
                        "-print"};
    new PrintFop(myArgs);
  }
}
-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] Behalf Of Jon Trauntvein
Sent: Thursday, April 01, 2004 10:47 PM
To: [EMAIL PROTECTED]
Subject: Re: Print PDF !!!


Chris Bowditch <[EMAIL PROTECTED]> writes:

> Eric Chow wrote:
> 
> > Hello,
> > 
> > I can embedded FOP in my program to produce PDF in runtime(based on the
> > instruction).
> > 
> > But, is there any way to directly print out the PDF with FOP api ???
> 
> If you want to directly print your document from FOP output, then I
suggest 
> you use the Postscript generator instead of PDF. You can then just stream
your 
> postscript to your printer.
> 
> There is no way to directly print a PDF from java. You can shell out to 
> Acrobat server to print a PDF, but thats slow and expensive way of doing
it.


If you don't have a postscript printer, you could alternatively shell
out to ghostscript in order to convert ps/pdf to your printer's native
language. 

Regards,

Jon Trauntvein


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to