By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,749 Members | 1,627 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,749 IT Pros & Developers. It's quick & easy.

Using "Prince" For XHTML/CSS Printing

P: n/a
Hi there

We've found a fantastic solution for generating PDF documents with fairly
complex XHTML and CSS. It does a great job (on all our tests so far...)

It's called "Prince" ( http://www.princexml.com/overview/ ) and the only
thing holding me back is the server license fee - US $3,800.

Has anyone used Prince? How do you like it? Worth the money spent?

Alternatively, has anyone here had any success in printing CSS-styled XHTML
to a PDF using any other (cheaper) method?

I've used FPDF and other server-language-based PDF solutions, but ideally
what I'm looking for is something to take *generated* XHTML files (and the
corresponding CSS) to produce PDF documents properly styled, up to CSS 2
spec.

Any thoughts/opinions?

Jun 18 '07 #1
Share this Question
Share on Google+
8 Replies


P: n/a
On 18 Jun, 17:57, Good Man <h...@letsgo.comwrote:
Alternatively, has anyone here had any success in printing CSS-styled XHTML
to a PDF using any other (cheaper) method?
No, that's impossible (for commercially practical purposes). However
if you can get in a step earlier and create XSL:FO instead of XHTML
+CSS (this is often very easy), then you can use Apache FOP to go from
XSL:FO to PDF.

I've no doubt the first step is solvable, as it's equivalent to
writing that part of a browser that evaluates CSS selectors and
applies rules to HTML elements. However in every practical case I've
needed to do this, I've found it easier to go a step earlier in the
CMS process and bind the CSS rules to the document elements directly
(this is the biggest difference between XHTML and XSL:FO).

Jun 18 '07 #2

P: n/a
Good Man wrote:
I've used FPDF and other server-language-based PDF solutions, but ideally
what I'm looking for is something to take *generated* XHTML files (and the
corresponding CSS) to produce PDF documents properly styled, up to CSS 2
spec.
You might want to post your question to comp.text.pdf.
Jun 18 '07 #3

P: n/a
Scott Bryce <sb****@scottbryce.comwrote in
news:TL******************************@comcast.com:
Good Man wrote:
>I've used FPDF and other server-language-based PDF solutions, but
ideally what I'm looking for is something to take *generated* XHTML
files (and the corresponding CSS) to produce PDF documents properly
styled, up to CSS 2 spec.

You might want to post your question to comp.text.pdf.
Thanks for the heads up!
Jun 18 '07 #4

P: n/a
Andy Dingley <di*****@codesmiths.comwrote in
news:11**********************@x35g2000prf.googlegr oups.com:
On 18 Jun, 17:57, Good Man <h...@letsgo.comwrote:
>Alternatively, has anyone here had any success in printing CSS-styled
XHTML to a PDF using any other (cheaper) method?

No, that's impossible (for commercially practical purposes). However
if you can get in a step earlier and create XSL:FO instead of XHTML
+CSS (this is often very easy), then you can use Apache FOP to go from
XSL:FO to PDF.
Thanks for the suggestions. I've found this site to help me along the way
if i go with this:

http://www.re.be/css2xslfo/

I can't help but feel a bit down on learning a new language to do what I
want to do... also, for some reason, XSLT seems like a step backwards in
2007, though im not sure that is accurate.

Thanks for the tips though.

Jun 18 '07 #5

P: n/a
Scripsit Andy Dingley:
On 18 Jun, 17:57, Good Man <h...@letsgo.comwrote:
>Alternatively, has anyone here had any success in printing
CSS-styled XHTML to a PDF using any other (cheaper) method?

No, that's impossible (for commercially practical purposes).
It depends (on the meaning of "that" and "practical", among other things).

I can view an HTML page (well, even XHTML, though that's pointless), with or
without a stylesheet, in a browser, then print it on a virtual printer,
which is actually a PDF file. I need software for that, but nice software
(both free software and affordable commercial software) is available for
that, e.g. PDFCreator and CutePDF.

I can't do batch processing of HTML pages that way, but neither do I want to
do that. If I do PDF, I want to check the result, and I may wish to make
some corrections before having it published or distributed.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Jun 18 '07 #6

P: n/a
"Jukka K. Korpela" <jk******@cs.tut.fiwrote in
news:zA********************@reader1.news.saunalaht i.fi:
Scripsit Andy Dingley:
>On 18 Jun, 17:57, Good Man <h...@letsgo.comwrote:
>>Alternatively, has anyone here had any success in printing
CSS-styled XHTML to a PDF using any other (cheaper) method?

No, that's impossible (for commercially practical purposes).

It depends (on the meaning of "that" and "practical", among other
things).
Just to jump in, that "Prince" product to which I referred does EXACTLY
this - send it valid XHTML, valid CSS and it will give back a PDF. It runs
on a server.

And the goal is to use these PDFs in commercial life... we're generating
fancy looking charts via PHP (ie: each one is customized), and the
resulting XHTML is quite lovely to look at via a browser and CSS.

We'd like to make this lovely chart a PDF without writing new code to do
it.
Jun 18 '07 #7

P: n/a
Mon, 18 Jun 2007 11:57:04 -0500 from Good Man <he***@letsgo.com>:
Alternatively, has anyone here had any success in printing CSS-styled XHTML
to a PDF using any other (cheaper) method?
CutePDF seems to work for me. You install it as a printer driver, and
then you can print *anything* to PDF.

Price: zero

Location: http://www.cutepdf.com/Products/CutePDF/writer.asp

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Why We Won't Help You:
http://diveintomark.org/archives/200..._wont_help_you
Jun 19 '07 #8

P: n/a
On 18 Jun, 21:06, "Jukka K. Korpela" <jkorp...@cs.tut.fiwrote:
I can view an HTML page (well, even XHTML, though that's pointless),
XHTML certainly isn't pointless here, because we're nowhere near the
Web as yet and so the practical restrictions on using it there don't
yet apply. As an internal format that works well with XML-based tools
(or that allows embedded namespaces), XHTML has a lot to commend it
here.

>in a browser, then print it on a virtual printer,
which is actually a PDF file. I need software for that, but nice software
(both free software and affordable commercial software) is available for
that, e.g. PDFCreator and CutePDF.
I don't know CutePDF, but I use PDFCreator a lot. I particularly like
it because it generates line-art diagrams in PDFs that are still
vector art rather than flattened to a bitmap (so they're a small
filesize and they're also still scalable).

However these "virtual printer" tools still can't transform HTML
directly, they also need a rendering engine (such as Gecko or a
packaged browser). I've not found a good batch-friendly solution to
this. Perhaps that's because I've not looked that hard -- I've always
been fortunate in being able to access an earlier stage of the process
and produce XSL:FO, which is then easier to render.

I can't do batch processing of HTML pages that way, but neither do I want to
do that. If I do PDF, I want to check the result, and I may wish to make
some corrections before having it published or distributed.
I automatically publish about 20 of these a day (database
documentation), of which typically 2 or 3 change per week. I want a
technically reliable process, but I can live with some editorial
issues.

Jun 19 '07 #9

This discussion thread is closed

Replies have been disabled for this discussion.