• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Solveed: FOP with WO error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Solveed: FOP with WO error


  • Subject: Solveed: FOP with WO error
  • From: Wolfram Stebel <email@hidden>
  • Date: Thu, 10 Mar 2005 14:51:05 +0100

> etwa so:
>
>          // render to PDF
>          try {
>              driver.run();
>          } catch (Exception exception) {
>              log.warn("PDF: render: " + exception);
>          }
> Grüße
>
> Fabian
>

As a summary for all:

The hint from Fabian did it:

    public void appendToResponse ( WOResponse response, WOContext context )
    {
        super.appendToResponse ( response, context );

        // parse FO tree
//        Document document = response.contentAsDOMDocument();
//        ByteArrayOutputStream out = new ByteArrayOutputStream();
//
//        Logger log = new ConsoleLogger ( ConsoleLogger.LEVEL_INFO );
//
//        Driver driver = new Driver();
//        driver.setLogger ( log );
//
//        MessageHandler.setScreenLogger ( log );
//
//        driver.setRenderer ( Driver.RENDER_PDF );

//  use instead*********
        InputSource foInput = new InputSource();

        foInput.setEncoding ( "ISO-8859-1" );   // utf-8

        foInput.setByteStream ( new
ByteArrayInputStream(response.content().bytes() ) );
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        Logger log = new ConsoleLogger ( ConsoleLogger.LEVEL_INFO );
        Driver driver = new Driver ( foInput, out );
        driver.setLogger ( log );
        MessageHandler.setScreenLogger ( log );
// end use instead*********

        driver.setOutputStream ( out );

        log.debug ( "Testlog" );  // geht nicht wegen Level?

        // render to PDF
        try
        {
//            driver.render ( document );
// use instead*********
            driver.run ();
        }
        catch ( Exception exception )
        {
            NSLog.err.appendln("PDF: render: " + exception);
        }

        // set the PDF content and header
        response.setContent ( new NSData ( out.toByteArray() ) );
        response.setHeader ( "application/pdf", "Content-Type" );
    }

At least:
I have had several problems with sample code of ravi mendish.

Wolfram


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Anyone seen this WAR deployment issue?
  • Next by Date: RE: WO JavaClient apps security
  • Previous by thread: Re: Anyone seen this WAR deployment issue?
  • Next by thread: Sort problem
  • Index(es):
    • Date
    • Thread