HTH,
Art
From: "Fotis Jannidis"
To: fop-dev@xml.apache.org
Date: Wed, 27 Dec 2000 12:11:14 +0100
Subject: Timelines
See the list at the end for all missing formatting objects and
properties to reach basic conformance. Actually, some properties,
we are listing as implemented, are also not completely supported,
because some property values are not allowed/used.
> I'd like to get as much comment as possible from committers and developers and
> users about where and how you think FOP should be headed in the next 6 months.
I think, if we have basic conformance in the next 3-6 months, we are
making good progress. A monthly release seems a good idea to me.
The work which has to be done for the Fop 1.0 release includes
changing the basic layout classes to really implement all rules and
constraints of stacking blocks and line areas, p.e. handling of
reference areas (Karen has pointed out these problems).
Fotis
Todo for basic conformance:
1.One category of tasks will be to implement missing formatting
objects.
fo:declarations
fo:multi-case
fo:table-and-caption
fo:wrapper
2. Properties
a) CHANGED
space-after.optimum (Incomplete)
space-before.optimum (Incomplete)
keep-with-next (Changed)
b) NEW
alignment-adjust
alignment-baseline
baseline-shift
block-progression-dimension
border-after-precedence
border-before-precedence
border-end-precedence
border-start-precedence
clip
content-type
direction
display-align
dominant-baseline
font-variant
format
grouping-separator
grouping-size
inline-progression-dimension
keep-with-next
keep-with-previous
letter-value
line-stacking-strategy
number-columns-repeated
number-columns-spanned
number-rows-spanned
orphans
overflow
reference-orientation
relative-align
role
source-document
space-after (full)
space-before (full)
space-end
space-start
visibility
widows
writing-mode
z-index
.
We developed a fix for FOP going out of memory, and submitted it, and I believe it is now committed. The way to invoke it is FOP -buf buffer_file fo_file pdf_file. Meaning another parm buffer has been added to the list of command options where FOp will create this file and junk whatever is un-necessarily stored in memory.
The way it has been done is, the contents of the XSL:FO are stored twice in
memory!! It is stored as FO:Text and as the text in WordArea. The first
parts been done, where the FO Tree will not have the contents in memory. Iam
working on the second part, and some preliminary results show that FOP works
much better if a bit of memory management is done by the programmer and not
leave it to the JVM.
regards
seshadri
regards
seshadri
FOP-Support fop-support@mindfiresolutions.com
-Xms64M -Xmx320M
Regards,
Mike
ist: fop-dev Subject: New XSL working draft published From: Max Froumentin mf@w3.org Date: 2000-10-18 16:06:06 The W3C Working Group on XSL has just released a new working draft of the XSL specification. It is available at: http://www.w3.org/TR/WD-xsl This version supersedes the previous draft released on March 27. The working group is issuing this interim public draft as it sets out a number of changes made in response to comments received on the Last Call draft. Discussion is invited and comments can be sent to the editors at xsl-editors@w3.org Max Froumentin W3C Staff Contact for XSL
This link should take you to the book reviews which mention xsl
Why isn't this property accepted? I'm using FOP 0.16.
Another related question: if specifying a reference-orientation of '90' do I then still have to specify the following attributes: "page-height", "21cm", "29.7cm"?, to force A4 landscape?
Thanks, Dirk Versavel
What I previously did was to load up the (almost) FO file with a DOM parser and feed the DOM object to FOP. To get this working lately we had to take the DOM object, serialise it to an XML file in memory, and then use a SAX Parser on that serialised XML. The SAX Parser is then fed to FOP.
I thought I had included this in the html documentation, but somehow I missed it.
fotis.jannidis
See here http://xml.apache.org/fop/fonts.html to find out how to add fonts to FOP and how to embedd them into the target PDF. Currently, FOP supports embedding of TrueType and Adobe PostScript Type 1 fonts.
Jeremias Märki, July 2001
Subject: Re: fop with internet explorer
From: "Alex Sanderson"
Date: 2000-12-01 16:47:25
I have had heaps of trouble with this problem. IE seems to interpret it when it feels like it. Occassionally, not at all, generally the first time you load the page but not after that. There are several problems I have found. With a small pdf returned from a servlet IE would be perfectly happy but would call the servlet three times. I sent a cache control saying to cache the file for up to fifteen seconds and then it is quite happy. This does not work for larger pdf's that take longer to generate. I have been playing around with sending the http headers at different times but basically it does not work very well. My final solution was to save the pdf to disk and do a browser redirect to it. I now check the pdf when someone asks for it and if the pdf is more recent that the data that it is based on I just serve the pdf straight off the disk. Saves a lot of processor time to.
Alex
From Art: I saw streaming PDFs mentioned in a recent e-mail. I do not know if what I am about to say will be relevant to the original topic, but I thought that I would relate the information anyway. I had been having a problem in my environment where PDFs generated dynamically by FOP running in a servlet were not rendered properly in M$ IE 5. It was discovered that large PDFs (> 8k) displayed properly, but small ones did not display at all. Further discussion on the list suggested that IE requires that either the content-length be set or the data sent HTTP chunked. I do not like having to store a potentially quite large PDF just so that I can find out how big it is to set the header. So I tried implementing an HTTP Chunked OutputStream. This was not too difficult to do and it kind of works, except that in my testing I found that even with the chunked output, small (< 8k) PDFs STILL DO NOT DISPLAY IN IE5! I then changed the chunked output stream to use an 8k buffer to build the chunks. If the output is closed before the buffer is filled the first time then I just set the content-length header and send the contents of the buffer non-chunked. If there is more output after the buffer has been filled then the data is sent chunked. So far this seems to be working, but I have not tested it rigorously. I also understand that since this requires HTTP 1.1 it may not work in the general case. I present this information in the hopes that it will be helpful to someone. I do not think that FOP should attempt to include chunked output capability. It should write to a stream - the stream implementation determined by the external application. For anyone interested in doing the same thing, there are a few chunked stream implementations out there - or you could write your own. My implementation is kind of limited and not well tested, so I am not willing to make it available at this point. Maybe I will reconsider after I have done more testing - but at the moment I am preoccupied with migrating my application to XalanJ2 from XalanJ1 and have not been able to look at FOP or output related things for a while. FYI, Art
The way to handle this is to add a line like
shell=c:\command.com /e:1024 /p
to your config.sys, and reboot. This increases space available for your environment variables (classpath, path, etc). You can crank the '1024' up to something else like 2048 or 4096 (and I've been known to use 8192).
Regards,
Arved Sandstrom
If you get *a lot* of > followed by memory errors then you may have an object (eg an image) which is too big for the page.
If you are using servlets then all your fop libraries should be in your .../webapps/yourfopdir/WEB-INF/lib
From: GALLO Jean-Claude
try link
<xsl:variable name="URL">
... compute the mail address ...
</xsl:variable>
<fo:basic-link external-destination="mailto:{$URL}">
... compute the visible text of the link
</fo:basic-link>
<xsl:if test="not(following-sibling::TEXT)">...</xsl:if> (this really took me quite a while :-)
Christian
Yep that's easy just include somewhere at the end of your .FO a ID-TAG for example <fo:block id="endofdoc"></fo:block> Then you can use a <fo:page-number-citation ref-id="endofdoc"/> And voila it should work Your sincerly, J.D.
If you're working on a Unix box use Acrobat Reader (I'm using version 4.05) to convert the PDF to Postscript. The command line could look like this:
acroread -toPostScript -fast -level2 -size a4
Command lines for other version will differ.
The other possibility is to use Ghostscript. This works for Windows and
Unix boxes.
Jeremias Märki
And of course to the developers of FOP an even bigger Thankyou.
here is a code snippet from or servlet:
java.io.File xmlFile = new java.io.File(xmlFileName);
java.io.File xslFile = new java.io.File(xslFileName);
ByteArrayOutputStream out = new ByteArrayOutputStream();
Driver driver = new Driver();
driver.setRenderer(Driver.RENDER_PDF);
InputHandler inputHandler = new XSLTInputHandler(xmlFile, xslFile);
org.xml.sax.XMLReader parser = inputHandler.getParser();
driver.buildFOTree(parser, inputHandler.getInputSource());
driver.format();
driver.setOutputStream(out);
driver.render();
response.setContentType("application/pdf");
byte[] content = out.toByteArray();
response.setContentLength(content.length);
response.getOutputStream().write(content);
response.getOutputStream().flush();
Hope this helps.
Regards,
_______________________________________
Erik Rehrmann - IOn AG
rehrmann@ion.ag
I've added PDF Bookmarking to CVS just now. The changes in the layout and
rendering objects weren't as intrusive as I had thought earlier, so this
should be a stable change. There's an example in
docs/examples/fo/pdfoutline.fo.
Note that you need to use the -d flag to cvs update because a new
extensions directory was added.
To use this, you need to add a namespace entry for
http://xml.apache.org/fop/extensions on the root element, and then
provide outlines inside the root object (but outside any page-sequences or
other formatting objects). Here's an example of an outline entry:
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:fox="http://xml.apache.org/fop/extensions">
<fox:outline internal-destination="sec3">
<fox:label>Running FOP</fox:label>
<fox:outline internal-destination="sec3-1">
<fox:label>Prerequisites</fox:label>
</fox:outline>
<fox:outline>
</fo:root>
It works similarly to a basic-link. There is also an
external-destination property, but it isn't supported currently.
-Kelly
--
Kelly A. Campbell Software Engineer
<camk@merlotxml.org> ChannelPoint, Inc.
<camk@channelpoint.com> Colorado Springs, Co.
http://www.lowagie.com/iText/ I have not used this library so cannot give a proper opinion on it yet.
IBM: Generate reports from databases w/ fop http://www-106.ibm.com/developerworks/library/x-dbrep/?dwzone=xml
There are several good tutorials available from IBM and the like, on XSL using FOP. Some are dated.
I am told that this should work for the page break <fo:block break-before='page' keep-with-previous='auto' />
In theory you should be able to register with the site and add any info yourself except I seem to have broken that facility - new users don't have permission to add questions :-(
Alex
Hi, you can set the background-color in differents fo so for example: 1) background color in all the body -> <fo:region-body ... background-color=".."> 2) background color inside a block -> <fo:block ... background-color=".."> 3) background color inside a part of a line (inline) -> <fo:inline ... background-color=".."> Fabio
If you're working on a Unix box use Acrobat Reader (I'm using version 4.05) to convert the PDF to Postscript. The command line could look like this:
acroread -toPostScript -fast -level2 -size a4
Command lines for other version will differ.
The other possibility is to use Ghostscript. This works for Windows and
Unix boxes.
Jeremias Märki
From: Art Welch Subject: PCLRenderer - Here at last Date: Tue, 13 Mar 2001 15:05:50 -0500 The PCLRenderer has finally been submitted to the Apache FOP project. As I had mentioned previously, I created an abstract base class "PrintRenderer" that serves as a common base for print type renderers (maybe other renderers as well). The PrintRenderer may help to prevent some duplication of code in the various renderers. So far the PDF, PCL, and TXT renderers extend from this base class. The PCL renderer allows direct printing of FOs to printers supporting PCL 5 (Printer Control Language level 5).
Art Welch
Giannetti, Fabio" <Fabio_Giannetti@hplb.hpl.hp.com>
Subject: Word 2000 html output into content and style
Date: Tue, 20 Mar 2001 11:41:16 -0000
Hello,
I'm Fabio Giannetti and I have developed an experimental java
application that separate a Word 2000 html output into content and style
The transformation process will generate and xml file for the content and an
xsl-t file for the style. When the style is applied to the content you get
an FO file.
At this stage you can also use FOP to generate a PDF file.
The application is free and I will appreciate, comments, suggestions on
future developments and obviusly bugs.
If you want to try it visit the web site :
http://www-uk.hpl.hp.com/people/fabgia/wh2fo/wh2fo.html
I hope that this kind of applications can grow the use of XSL-FO providing
an easy way to create content that is ready to transform into FO.
Yours sincerely,
Fabio Giannetti
You are welcome to browse our web-site which contains more details at http://www.mindfiresolutions.com/fopservices.html. Requests for bug-fixes can be posted to fop-support@mindfiresolutions.com . They will taken up on a priority basis. If there are any queries, pls do fwd them to us.
Seshadri G
FOP Open Src Support
mindfire solutions.
> Does FOP support UNICODE? I guess you are asking at least these things: Q: Can you do XSLT and create an FO file with unicode characters in it? A: Dunno - Depends on your XSL/XSLT implementation rather than FOP per-se Q: Can FOP read an FO file with unicode characters in it? A: Dunno - Depends on your parser I guess rather than FOP. Petr Andrs points out: All conformant implementations should support UTF-8 and UTF-16. I had no trouble with xalan/xerces supplied with FOP Q: Can you display a PDF file with unicode characters in it? A Dunno - I guess it depends on the fonts used in the PDF. Petr Andrs points out: Yes, you have to use latest Acrobat Reader (4.05) and unicoded truetype fonts (like these downloable from microsoft) and latest version of FOP (not work with 0.17). However bug 1105 prevents displaying of some fonts.
You may need to use the current CVS version of FOP because there have be a
couple of bugfixes in the TrueType font embedding code to support some of
these barcode fonts since 0.18.1 was released last week.
-Kelly
(Remember to check the mail list archives for discussion about this - Alex)
Sending bug reports and feature requests to the list is a welcome and important contribution to developing Fop.
Read also the archive of the discussion list fop-dev to get an idea of the issues being discussed. http://marc.theaimsgroup.com/?l=fop-dev&r=1&w=2
It is called 'fop-user@xml.apache.org'.
Subscribe by posting to 'fop-user-subscribe@xml.apache.org'. Subject line and body is irrelevant. You'll get the typical ezmlm response, that you also reply to, and then you are in.
Pricing starts at $10,000 per server CPU license, declining for volume purchases or multi-processor clusters. Please send mail to info@reportlab.com for licensing terms and additional information.
> >I have done this and I'm sure you can do it too - the only trick is that > >you'll have to write an XSLT to convert the Xhtml into fo > > Would that XSLT be reusable for any HTML page? > > Anyone here written a general XSTL that will convert any XHTML page to XLFO? > > > - you may also have > >to convert the html to xhtml, probably by hand.The download code for an article on www.xml.com at http://www.xml.com/pub/a/2001/01/24/xsl-fo/index.html?page=2 includes a stylesheet that converts many html tags to Fo, as the following except from the end of the article indicates: "You can get all the files (ZIP or TGZ) used in these articles, including an XSL file that handles more aspects of converting HTML to FO, and that was used to convert these articles to PDF format." The articles are well worth reading in their own right. The stylesheet, doubly so. Best, Steve Hoenisch shoenish@rcn.com
HTH,
Art (art_w AT eastpoint.com )
A good tutorial on FO is at http://www.ibiblio.org/xml/books/bible/updates/15.html Dave Pawson has some XSLFO coverage at: http://www.dpawson.co.uk/xsl/sect3.html Including a "gentle introduction". Cocoon uses FOP in a servlet environment: http://xml.apache.org/cocoon/index.html There is a chapter of Brett McLaughlin's book (Java and XML) about using Cocoon, FO, and FOP, online at: http://www.oreilly.com/catalog/javaxml/chapter/ch09.html Max www.siliconpublishing.org/
A good tutorial on FO is at http://www.ibiblio.org/xml/books/bible2/chapters/ch18.html
Dave Pawson has some XSLFO coverage at: http://www.dpawson.co.uk/xsl/sect3/xsl-fo.html
Including a "gentle introduction".
Cocoon uses FOP in a servlet environment: http://xml.apache.org/cocoon/index.html and http://xml.apache.org/cocoon2/index.html (version 2)
There is a chapter of Brett McLaughlin's book (Java and XML) about using Cocoon, FO, and FOP, online at: http://www.oreilly.com/catalog/javaxml/chapter/ch09.html
Max
www.siliconpublishing.org/
> I 'd like to convert a .RTF file to .FO file. > Is there a program doing it ?There are a few programs called "rtf2xml" on the web (see http://www.google.com/search?q=rtf2xml), but I didn't test any of them yet.
It might be your first step: convert RTF to XML, then use XSL to generate XSL:FO.
You could also use upCast (commercial product, http://www.infinity-loop.de/) for the RTF-to-XML conversion step, it does a job of making sense out of RTF.
-- Bertrand Delacrétaz, www.codeconsult.ch
-- web technologies consultant - OO, Java, XML, C++
Fabio
just put a <fo:page-number-citation ref-id="page_endofdoc" /> to the text you want to access and in the table_of_content write: <fo:page-number-citation ref-id="page_endofdoc" />
Dunno. However what I do is
<fo:block>
<fo:leader leader-pattern="rule"
space-before.optimum="8pt"
space-after.optimum="8pt"/>
</fo:block>
| i'm a beginner in xml and xsl-fo. i've seen the FAQ and found that FOP | does not support certain encoding. can anybody here explain what these | encodings are: windows-1252, ISO-8859-1, UTF-8, UTF-16. and does that
| mean the XSL stylesheet has to make explicit the encoding in order to | transform a document of a certain language into pdf?In order to define encoding for FOP parser.
Hope this short info is what were you asking for...
Roman
We wasted quite a bit of time on some pdf-generating library we found which was non-standards-compliant and involved out of process calls to get pdf viewer up, temporary files, and general system-dependent ugliness which always went wrong: the FOP way is a lot easier!
Alistair Hopkins" www.berthengron.co.uk
> > I have a XSL stylesheet, say foo.xsl, and dynamically
> > generated xml files,
> > say foo.xml. Now I want to create a PDF document which works fine via
> > command line parameters fop -xml foo.xml -xsl foo.xsl -pdf foo.pdf.
> >
> > How do I generate the pdf document within my application?
> > If tried
> >
> > org.apache.fop.apps.Driver driver = new Driver(new
> > org.xml.sax.InputSource(new FileInputStream("foo.xml")), new
> > FileOutputStream("foo.pdf");
> > driver.setRenderer(driver.RENDER_PDF);
> > driver.run();
> >
> > But where do I say to use the foo.xsl?
> >
> > Any help is greatly appreciated,
I think you need something like this:
Driver driver = new Driver();
driver.setRenderer(Driver.RENDER_PDF);
InputHandler inputHandler = new XSLTInputHandler(xmlFile, xslFile);
XMLReader parser = inputHandler.getParser();
driver.buildFOTree(parser, inputHandler);
driver.format();
driver.setOutputStream(new FileOutputStream(outFile));
driver.render();
Answer by Keiron Liddle
Alternative tools include:
html-doc , is an open src effort that converts html to pdf, and paginates quite well. try it out. get it from http://www.easysw.com/htmldoc/ regards seshadri
> does anyone know how to make fop transform a th (like in 4th) in
> order to put it as superscript with a small font (in good ol'LateX it
> would go like $4^{th}$)?
You might try
4<fo:inline font-size="7pt" line-height='8pt' vertical-align="super" >th</fo:inline>
It's priced at USD$275 and is available at http://big.faceless.org/products/pdf (Information supplied by a member of this company so you have to take it with a pinch of salt and do your own evaluation - AlexMc - FAQ maintainer).
If you want to convert you particular format into pdf with fop then you need to somehow convert your format into XSL:FO (or XML which an XSL stylesheet can be applied to).
(Answer supplied by Keiron Liddle. Thanks)
Those stylesheets are definitely worth using, but they are immature, not even close to being as ready as the DocBook HTML stylesheets. If you use a formatter other than FOP you will soon find out which DocBook constructs lead to problematic FO (that is, it's not FOP's fault). A lot of them are not core elements, and so you can avoid them for now; for the ones that are, the most useful contribution is to assist Norm Walsh and help out with the FO stylesheets.
Some DocBook elements, when acted on by the FO stylesheets, turn out good FO, but FOP doesn't handle it well, or at all. I'd argue that there is less of this situation than one might think. And you can always check by using other formatters.
Arved Sandstrom
The following article was posted by Elliotte Rusty Harold to the fop-dev
mailing list. Elliotte has given permission for the article to be included
in this FAQ but would like to draw your attention to the fact that it was
written in July 2001 and may become out of date as the software mentioned
improves.
In case you didn't realise Elliotte Rusty Harold has written several useful
books which you can find out more about at the URLs below.
---------------------------------------------------------------------
Date: Tue, 31 Jul 2001 09:24:51 -0400
From: Elliotte Rusty Harold elharo AT metalab.unc.edu
Subject: XSL-FO Engine comparisons
I've been spending a lot of time lately with Docbook and XSL-FO as part
of the ongoing development of my next book, Processing XML with Java. To
that end, I've been putting the various XSL-FO engines on the market
through their paces. I'm trying to find one that will actually let me
produce the complete, finished book from my Docbook source code and Norm
Walsh's XSLT-to-XSL-FO stylesheet. I thought I'd share my experiences
here.
So far, I've experimented with four different XSL-FO processors: the
Apache XML Project's FOP, Sebastian Rahtz's PassiveTeX, the Antenna
House XSL Formatter 1.1E, and RenderX's XEP. Two are implemented in
Java, one in native Windows code, and one in TeX. FOP and PassiveTeX are
open source. Antenna House and XEP are payware. Here are my experiences
with each:
FOP
FOP was the first XSL-FO engine and is certainly the most popular. It's
open source and far easier to install than PassiveTeX, the other open
source alternative. However, of the ones I was able to actually test it
produced by far the worst output. It had the most annoying formatting
troubles. For example, it ate all the blank lines in my source code
examples and put extra indentation at the front of the first line of
each example. I've noticed that probably more than half of the bug
reports on the Docbook-APPS mailing list about the Docbook XSL-FO
stylesheets can actually be attributed to bugs in FOP. FOP is improving
rapidly -- one major bug I noted in footnote handling was fixed in the
last couple of weeks while I was performing my tests -- but it's clearly
not even an alpha quality release yet. A lot of work needs to be done
before FOP can be recommended for more than experimentation.
XEP
I was unable to get XEP to run. It was totally non-functional, and did
not produce any output. I know some other people have gotten it to run
-- the PDF version of the XSL specification was produced with XEP.
However, it simply did not work for me at all. However good the XEP
engine may be at converting XSL-FO documents to PDF, its horrible user
interface and incomprehensible installation procedure eliminated it from
my consideration.
PassiveTeX
PassiveTex did a very good job formatting most of my document. There
were a few issues involving improperly scaled images, but those were
easily fixed by adding some width attributes to my source XML document.
Once that was done, the only major bug was a failure to properly
calculate page numbers in the table of contents. There was also one
quirky instance where the first bullet point in a list was not indented
quite right, but this didn't seem to occur in other bulleted lists.
The downside to PassiveTeX is that it depends on a "decent modern TeX
setup"; and TeX is invariably a nightmare. If my Linux distribution
hadn't included TeX by default, I would have been lost. As it is, I
consider myself lucky to have been able to get PassiveTeX running; and
it still fails one time out of every two. This is probably due to TeX's
unusual multipass architecture. You sometimes have to run TeX a second
time to get the links and cross-references right. In my case, the first
pass succeeds but the second pass invariably fails. Thus I never get
proper cross-references to page numbers in the table of contents and
elsewhere. Otherwise, the output produced is quite attractive
Antenna House XSL Formatter
The Antenna House XSL Formatter produced very attractive output, on a
par with that generated by PassiveTeX and much better than FOP's. I
noticed no major flaws or cosmetic bugs. Antenna House also claims
they're the only formatter able to handle mixed writing-modes such as
"tb-rl" for Chinese/Japanese/Korean, though I didn't test that.
Most importantly, Antenna House had by far the easiest installation and
the nicest user interface of all the formatters tested. More work is
still needed, but at least I could conceive of giving this formatter to
a non-programmer end-user. The others all have effectively non-existent
user interfaces, and horrible installation procedures. The Antenna house
formatter was the only one of the four that took me less than an hour
from download to first use.
The downside to this otherwise excellent engine is that it's Windows
only and based on Windows graphics primitives rather than PostScript or
PDF. It displays on the screen very nicely, and prints nicely too.
However, it does not produce a PDF document that I can send to my editor
or a typesetter.
Bottom line: none of the formatters are yet suitable for producing a
finished product. Ñone of them can replace TeX or QuarkXPress. You might
be able to publish a simple book with these, but you'd have to design
your book and style sheet so that you avoided the bugs and unimplemented
features of the processor. Antenna House probably produces the most
polished output, and I'd use it if all I wanted to do was print out a
document from my laser printer. However, since I need PDF files I can
send to my editors and download to a typesetter, my choice for the time
being is PassiveTeX.
--
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo@metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| The XML Bible, 2nd Edition (Hungry Minds, 2001) |
| http://www.ibiblio.org/xml/books/bible2/ |
| http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.ibiblio.org/xml/ |
+----------------------------------+---------------------------------+
To preserve the line-break formatting you can use the white-space-collapse ="false" option of fo:block. For example: <fo:block start-indent="72pt + 12pt">java_lang_Throwable<fo:block space-before="0.6em" space-after="0.6em" white-space="pre" white-space-collapse="false" wrap-option="wrap" background-color="#e0e0e0" font-family="monospace" line-height="106%" end-indent="24pt" start-indent ="72pt" font-size="72%"> Line one Line two Line three </fo:block> Answer supplied by Ian Larner - thanks Ian.
To preserve the line-break formatting you can use the white-space-collapse="false" option of fo:block. For example: <fo:block start-indent="72pt + 12pt">java_lang_Throwable<fo:block space-before="0.6em" space-after="0.6em" white-space="pre" white-space-collapse="false" wrap-option="wrap" background-color="#e0e0e0" font-family="monospace" line-height="106%" end-indent="24pt" start-indent ="72pt" font-size="72%"> Line one Line two Line three </fo:block> Answer supplied by Ian Larner - thanks Ian.
java org.apache.fop.apps.Fop file.fo file.pdf
Driver driver = new Driver(); driver.setRenderer(Driver.RENDER_PDF); InputHandler inputHandler = new XSLTInputHandler(xmlFile, xslFile); XMLReader parser = inputHandler.getParser(); driver.setOutputStream(new FileOutputStream(outFile)); driver.render(parser, inputHandler.getInputSource());
(Jeremias Maerki, Aug 2001)
(Info from Bertrand Delacretaz bdelacretaz codeconsult.ch)
Q: Why isn't there a Windows .zip version of Fop on the download site?
A: To save diskspace on the Fop download site. This is practical for two reasons:
1. For a Java project, the zip archive and the tar.gz archive would contain exactly the same content. So one of the two is superfluous if each format can be unarchived on every platform that mattered.
2. It is indeed the case that each format can be unarchived on every platform that mattered. One can easily unzip an zip archive on Linux, thanks to the GNU zip/unzip programs. One can also gunzip and untar a tar.gz archive on Windows, thanks to the GNU tar program and Cygwin (or WinZip, or even PKZIP, if one is so inclined).
Since tar.gz archives is always smaller than zip archives, (at least for archives the size of the Fop project), it is natural to choose tar.gz as the only archive format on the Fop download site.
This format causes little to no problems for the various UNIX platforms. Some UNIX flavor's tar command is incompatible with the GNU tar command for pathnames longer than 100 characters. The problem is easily remedied by downloading GNU tar from http://www.gnu.org/software/tar .
For Windows NT/2000/etc. platforms, just drag the tar.gz archive and drop it into the WinZip ( http://www.winzip.com, $29) or PKZIP for Windows (http://www.pkware.com, $29) window.
A better solution would be to download the free software Cygwin (http://cygwin.com) and get the GNU tar program as part of the suite. Cygwin is free software in the genuine FSF sense. The suite you download will include not only GNU tar, but also many of the other GNU utilities (bash, gcc, etc.). The command line syntax of GNU tar is very similar the the JDK's jar command. To unarchive Fop-0.20.1-bin.tar.gz, for example, one runs:
tar zxvf Fop-0.20.1-bin.tar.gz
[I don't use MacOS, but surely there must be a port of GNU tar for it, right?]
(Until this is either added to the web site, or the FAQ, we can always point to the mail archive for new zip archive queries.)
-- Weiqi Gao weiqigao@networkusa.net
(Editor's Note: This has been reported as not working but you can try it anyway) You have to specify the display-align property to the region body ... <fo:simple-page-master page-width="210mm" master-name="myPage" page-height="297mm"> <fo:region-body display-align="center"/> </fo:simple-page-master> So everything inside that page (or sequence of the same page) will be rendered in the middle. Fabio Fabio_Giannetti hplb.hpl.hp.com
Actually that doesn't seem to work Is there somebody who has a working solution for centering a table horizontal within a page, that is not: <fo:simple-page-master page-width="210mm" master-name="myPage" page-height="297mm"> <fo:region-body display-align="center"/> </fo:simple-page-master> (thx fabio) or <... margin-left="auto" margin-right="auto"> (thx adrian) thx to all, who tried to help. regards! matze
>I want to pass the pdf file created by fop to a java pdf viewer within
>an application. Can anyone recommend a viewer that can be embedded in a
>java app
The acrobat viewer bean distributed by Adobe ~works~ -- but not, I think,
without doing some work yourself. We had to drop down to a lower level of
interface from the top level "bean", use primitives to convert a PDF to an
Image and then render the image ourselves on a panel w/ our own menus,
editor kit and the like.
The relevant Adobe classes are (taken from our imports)
import com.adobe.acrobat.PDFDocument;
import com.adobe.acrobat.sidecar.FloatPoint ;
import com.adobe.acrobat.sidecar.AffineTransform ;
If you want the gory details, fee free to contact me off-list
and I'll send 'em along. Our implementation requires
Swing and Java2D.
' Best,
-Ralph LaChance
Answer from James Richardson" james.richardson@ABigGermanBank.com OK, the problem is that weblogic contains in its classpath some XML parser stuff. (Off topic, but why anybody ever decided that using a single static method to get an XML parser (which one you get only controlled by the classpath is totally beyond me. It might work fine in some cases, but since everybody and their dog started writing specialised versions the whole thing has turned into a classpath nightmare. Forget it if you want dynamic classpaths - Webapp, anyone?) So, to fix this, you have to include the FOP versions in the system CLASSPATH BEFORE the weblogic ones. You then need to set up the type of parser in the system property. (Again, this is a bad idea conceptually, IMHO) So, to get the thing running, I have the following: CLASSPATH=$WL_HOME:$WL_HOME/classes:$WL_HOME/lib/weblogic_sp.jar:$WL_HOME/lib/weblogic.jar:$WL_HOME/xmlx.jar LOCAL_CLASSPATH=$LOCAL_LIBDIR/xalan-2.0.0.jar:$LOCAL_LIBDIR/batik.jar:$LOCAL_LIBDIR/fop.jar:$LOCAL_LIBDIR/avalon-fr amework-4.0.jar:$LOCAL_LIBDIR/logkit-1.0b4.jar: JAVA_CMD_LINE="$JAVA_HOME/bin/java $JAVA_OPTIONS -classpath $LOCAL_CLASSPATH:$CLASSPATH (weblogic stuff here) -Dorg.xml.sax.driver=org.apache.xerces.parsers.SAXParser weblogic.Server $JAVA_CMD_LINE However, YMMV.... Other warning(s): Due to the (by design) limitations of the java classloader, you will have to make sure that any extensions that you write to FOP/XSL are also in the system classpath, and I pity you if you want to do any of this in an EJB.... I reckon I will spin the whole PDF rendering thing off as a Jini service and be done with the whole classpath problem. You will also need to be aware of limitations of FOP wrt headless servers. (It won't work) (Actually, any program that requres a graphics context will have problems.) You may want to look at PJA as a way around this. (Alternatively, VNC will also work). In terms of the programs etc to write, the examples work fine..... Cheers James rakesh.n.chauhan wrote: > > > Hi James, > > I am facing problem compiling and deploying , xml xsl to pdf using fop > on weblogic 6.1. > Would you please send me following please, > > [1] a sample stand alone java code generating pdf using xml and xsl file > [2] a servlet generating pdf using xml and xsl file on weblogic 6.x > > Please help with whatever knowledge you have. > > Thanks and regards. > > Rakesh >