Look at the WOComponent API ......

you can call generateResponse() to get a WOResponse, and then call contentString() on the WOResponse to get the HTML.

The result may have relative URLs in which case you may have to grab the context (WOComponent.context()) and tell it to generate full URLs .... WOContext._generateCompleteURLs.

BTW, it is very beneficial to really study the javadoc API for WOComponent, WOResponse, WORequest, WOMessage, WOContext ..... there is a lot of goodies in there ... and also some useful private methods that are worth looking at. Also check out Project WOnder's subclasses of some of these for more educational benefits ;-)

HTH, Kieran


On Jan 4, 2009, at 10:22 AM, Jeff Schmitz wrote:

I downloaded the example flying saucer stuff and got it to run, but I'm having trouble figuring out how to wrap this up in a component. Since I am generating a WOComponent that I want to transform to a pdf, I'm unsure how to send that finished component (i.e. html file) to the pdf renderer for further processing. Do I need to somehow write my WOComponent to a file where the renderer can see it? Or is there a way to divert it to the renderer directly? i.e. How can I get a serialized version of a WOComponent for further processing instead of just sending it back to the user? Or am I off on the wrong path somehow?

Thanks,
Jeff
On Dec 11, 2008, at 3:57 AM, John Corrigan wrote:

On 10/12/2008, at 1:31 AM, Sherry Tirko wrote:

Hi All,

I'm wondering if anyone knows if there is a pdf generator out there for WO sites or even a converter for WO Components. I'd like to take a form and make a pdf version for printing.

Thanks,
Sherry


Another option may be "The Flying Saucer Project" - An XML/XHTML/ CSS 2.1 Renderer, 100% Java, open-source (LGPL).
http://xhtmlrenderer.dev.java.net/

This seems a little less known but I've had good success with it (no affiliation). Converts any XHTML + CSS 2.1 compliant input to other formats, usually PDF but apparently can do Swing no less. Passes ACID 2 and has some CSS 3 support. It uses iText internally for PDF output.

I'm using the latest pre-release without issue (R8pre2 as of Jan 08). Make sure the input validates as XHTML (for the most part, it's not as strict as http://validator.w3.org/).

WebStart demo app:
https://xhtmlrenderer.dev.java.net/r7/demos.html

Fonts:
It needs to be told about custom fonts (ie. those not available in the JRE).

Example usage (with fonts):
As a starting point a small example project in plain Java is attached (see readme).


Sláinte
John


<Example_FlyingSaucerXHTMLRenderer.tgz>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/jeffandmonica%40mac.com

This email sent to jeffandmon...@mac.com

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/kieran_lists%40mac.com

This email sent to kieran_li...@mac.com

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to