RE: StaticContentLayoutManager
Well, the actual layout for static content can obviously differ from page to page because of markers and page numbers. However, constructing a LM is expensive, and in the original code I wrote a new LM would have been created for each page if the FO didn't keep it, which would have cause unwanted overhead. For all other FOs generally only one LM is created. I'm not sure what's the status of LM creation now. Anybody out there profound in memory profiling? Or code inspection? J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Documentation woes
Hi all, I think there are still some problems with regard to our documentation. 1. There is a src/documentation/content/design/alt.design with some HTML files 2. There's also a src/documentation/content/xdocs/design/alt.design with some more XML files 3. Furthermore there is a docs/design/alt.design with even more files, apparently diagrams and figures. This keeps confusing me: is it forrest which forces these files to be scattered all over the directory structure? I'd think they could be a) better grouped together b) better separated from the other documentation files. In general, having both a docs and src/documentation is a permanent source of confusion for me. If possible, this should be cleaned up a bit: - Move docs/examples to examples. - Move docs/graphics somewhere into src/documentation/content (it is content after all, or isn't it?). - Somehow get rid of docs/xml-docs, in particular move docs/xml-docs/data into src/documentation/content. - Move docs/foschema somewhere else, perhaps to the toplevel like examples or to src/documentation/resources. - The docs/design/fo_impl could probably be deleted. Are there reasons to keep it? Further, why do we have two xml2pdf.xsl and, even more confusing, an additional FAQ in src/documentation/content/xdocs/dev which seems to be more or less the same as the regular FAQ? In fact, the complete src/documentation/content/xdocs/dev directory is a mystery to me. Also there are fo directories in src/documentation/content/xdocs and src/documentation/content/xdocs/dev. Are they supposed to be resources for download? I'd rather find a way to link into the examples directory. If this is all caused by Forrest, I'm disappointed with this tool. Having a foul mix of docs for HEAD and the maintenance code is bad enough, but having examples, downloadable ressources, graphics and SVG and finally the docs for another code branch scattered all over the place is too much for me. I'd be glad to hear comments. Ah, I've committed a validation task for the xdocs. This won't work without an Ant 1.5 optional.jar, and probably the path to the xml-forrest check out must be adjusted for others. I'm not proud of copying the whole forrest catalog.xcat (- another file extension I've reasons to object) into the build file, perhaps I should use an XSLT task to generate a task specific buildfile and use ant to call it. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Throwing derivatives of RuntimeException
On Saturday 04 January 2003 15:59, Jeremias Maerki wrote: Hi Joerg Oops! Sorry, I should have checked twice before committing to the wiki, of course its not the PS renderer but the TTFReader and PFMReader which throw CascadingRuntimeExceptions. I admit this makes the case less relevant. Also, never say never. I meant: Throw subclasses of RuntimeException with caution. There is a reason for the throws decl. Well it may be seen a bit devalued if every method throws a FOPException. Runtime exceptions should in general only be thrown by low-level, technical and widely used classes, where the user of the class can be reasonably expected to check the conditions causing runtime exceptions beforehand (i.e. being prudent enough to avoid them on average), and where a more specific exception would be seen misplaced in at least some contexts the class is used. Also, conditions for Runtime Exceptions should be *deterministic*, i.e. only depend on the context completely under the control of the user, preferably only dependent on the data passed to the routine throwing the exception. An IOException is *not* deterministic in this sense: someone else could have deleted the file the routine is asked to open in the meantime. Also, never should a non-runtime exception be caught and a runtime exception be thrown: (PFMReader.java) } catch (Exception e) { throw new CascadingRuntimeException(Error while serializing XML font metric file, e); There is always a certain tradeoff when designing which exceptions are thrown: - Unifying each and every exception into one class or into classes of a single inheritance tree keeps the throws decl short, but then this decl respective the exception types (class names) no longer carry much information. Duplicating existing exception types into said hierarchy (like FOPIOException, FOPFileNotFoundException...) is nowadays out of fashion (it was often seen in C++, because there was no common IOException there). With exception unification you are basically forced to cascade, and unwinding the exception cascade may make long and confusing log entries. - Throwing a lot of unrelated exceptions may cause throws decls to grow into unwieldy beings. Currently, there usually aren't that much unrelated inheritance trees of exceptions, however, using more and more libraries of different origin and design this can become an issue. - Throw a RuntimeException. Such exceptions don't need to be declared. This can be seen positive: the user *usually* should not be worried that something can go wrong. It can also be seen negative: the user is deprieved of the information that something can go wrong, and the compiler is silenced about this fact. So, if the input file is not found, what to do? 1. Nothing, just let the FileNotFoundException pass up. Add throws IOException. 2. Catch it and throw an IllegalArgumentException(wrong filename+...) (Ok, stretching credibility, but let's pass it for now). Add nothing to the throws decl. 3. Catch it and throw a FOPException(FO file not found+...). Pick one, formulate arguments why you picked it and formulate guidelines to make sure the same answer would be picked in similar situations (for some definition of similar). Also, make up more such examples :-) I'd like to go with a mixture of your first and third point. This means - Derive a FOPException from avalon.CascadingException. - Throw *only* java.lang.* exceptions or subclasses of FOPException. This means: - the throws decl features only FOPException (or a subclass) and java.lang.* exceptions - each time a method of a class not from a FOP package is called, every non-java.lang.* exception *must* be caught and either a FOPException (or a subclass) or a java.lang exception must be thrown. This seams to be a bit too stringent, probably some slack is called for: - Allow for SAXExceptions. - Allow for other Avalon exceptions, in particular other subclasses of CascadingException. Well, I'm not sure I'd like this, but using more and more Avalon libraries (or XML commons or whatever the project is currently called) might make this necessary. Could you describe your model of this mixture in more detail? J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Throwing derivatives of RuntimeException
On Saturday 04 January 2003 21:36, Jeremias Maerki wrote: I promise to fix these uglies as soon as my local FOP compiles again. I don't think it is more urgent than, lets say, turn the font readers into libraries which can be called both from the FOP core as well as from stand alone command line applications. [ exception unification / cascade ] I don't think they are confusing if you know the concept. They may get long, but they are s helpful sometimes. And I prefer a long log entry over an Exception of which I can't determine the origin. I just pulled a slightly credible disadvantage out of the blue so that this variant doesn't appear to have only advantages :-) It would obviously make sense to come up with a good set of clearly formulated guidelines for exception handling, but that is something that IMO has to be done in another context. I don't want to blow up our Style Guide too much, because too much doesn't get read. Provide a small sets of snappy DOs and DO NOTs and link to another, bigger document providing longer descriptions, rationales, background and terminology definitions. Something I started in the FAQ with some still dead links to classpath and url. I think it would make sense to bring this topic up in the community mailing list so all Java-addicted could come up with a nice, concise Wiki-page. Probably a good idea. I like the idea of a set of common, normative documentation which might be more reliable and better to manage and maintain than random links into the WWW. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Table Question
On Friday 03 January 2003 22:19, Jarrod Stenberg wrote: According to the recommendation a cell can exist as a child of a table-body as well as a table-row Yes, but only the latter is implemented and works. The error message should prevent bad surprises. I also noticed that the recent snapshot, 20030103052138, does not have this condition and related error. However, starts-row remains unused. The 0.20.5rc version comes from another branch than this snapshot. I'm a relative newbie to Java, but I am willing to hunt for a solution to this problem (what I view as a problem). Good luck! Problem is, I'm a newbie to working on Open Source code too. In what sense is this a problem? J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Footnote Problem
Hi all, is the footnote are supposed to span the whole page width even if the body region has columns? If so, adding a footnote would cause reshuffling of content of already filled columns, which in turn might push the FO causing the footnote onto the next page (another candidate for the anomalous layout wiki?). Apart from this, is this case similar enough to rebalancing in case a fo:block span=all is encountered? J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: FOP performance - frustrating.. help!!
On Friday 27 December 2002 22:57, Lee, Insoo wrote: [run] org.apache.xalan.xslt.Process -IN rates.xml -XSL rates_pdf.xsl -OUT rates.fo this step took about 1 minute... You seem to use a seriously underpowered machine, or you've complicated the transformation too much. I routinely transform 1MB files on moderatly modern hardware in less than 10s. Here is the lengthy my FO file... (only 1/3 of it.. since it's over 1MB) You should not send XML as mail content, it's mangled: extent=0.5cm//fo:simple-page-master/fo:layout-master-setfo:page-seq u ence master-reference=anypagefo:flow Also, it seems to be even more truncated. Compress the file and send it as attachment. I duplicating the rows to get roughly 1100 table rows, or 1.2MB, amounting to 23 pages. With FOP 0.20.5rc my 8 year old pentium 166MHz/64MB physical RAM took roughly 8.5 minutes to render it, the first 16 pages were rendered in less that 3 minutes, after which the physical RAM was full and swapping set in. No JVM memory overflow occured. Modern hardware with sufficient physical RAM and appropriate JVM settings should be faster at least by a factor of 10. The average page rendering time reported for FO documents similar in structure to yours is usually 0.5s to 1s. Again, you seem to use hardware which simply isn't up to the task. 1. Get FOP 0.20.5rc, which should be a bit faster than 0.20.4 2. Check the load on your machine. Kill unnecessary processes. 3. Get a guru to check your machine's configuration, in particular memory available to user tasks, process priorities and perhaps VM configuration and IO bandwidth. 4. Check whether your machine has enough physical RAM (256M is ok) 5. Check your JVM memory settings, the memory allocated to the JVM should not exceed the physical RAM, or your process will swap itself to death 6. Check the configuration of whatever environment your FOP embedding runs. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: just a thought
Oleg Tkachenko wrote It's probably not too late to consider some trivial optimization of fo tree in redesign code. In a typical fo document probably about 30% of elements have no children or have only one child (text node usually), so instead of eager protected ArrayList children = new ArrayList(); in FObj.java we can consider lazy polymorphic member protected Object children = null; 1) For no chidren case it remains to be null. 2) For 1 child case it is FONode object. 3) For children case it is ArrayList. This means some additional logic must be implmented at addChild() and getChildren() methods. I thought I posted this two weeks ago. I made some measurements with the FOP examples and a few other FO files an get roughly the following statistics: 45% no child (mostly text nodes, but also fo:page-number and fo:region-*) 40% one child (many blocks and basically all inline FOs in the examples) 10% 2-5 children 4% 6-9 children 1% more than 9 children. The FOText text node is the only subclass of FONode which is not a FObj. I considered moving the children vector to FObj and had it almost ready to commit but failed on a few issues which I think I have a solution now so that I can tackle this (in the maintenance branch) again. Constructing the children vector lazily is of course part of this. It is, however much more than just a null test in addChild(), because many FO classes access the children vector directly, every access has to be protected with a check for a null vector as well. Another thought in this regard: I was tempted to create an abstract FObjComposite which is the only one which can have children in the generic sense, and have FOs like fo:layout-master-set, fo:table and fo:page-number-citation no generic children at all (only typed children like fo:simple-page-master, fo:table-body etc. which are stored separately anyway, mostly in properly typed fields). The problem here is that this could interfere badly with extensibility. OTOH, what should be extension elements which are children of fo:layout-master-set, fo:table and fo:page-number-citation good for? I asked this already, without any response. One thing I'll do is to move the responsibility to add a FO as child from the FOTreeBuilder to the FOs itself. This cleans the odd hack in the FOTreeBuilder which adds a FO as child if it's not a fo:page-sequence, and avoids creating the children vector for the above-mentioned FOs unless an extension elements asks for being added. Regards J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Line breaking and Hyphenation
Hello all, I tracked down the bugs 10374, 2106 and 6042. The last bug was caused by a simple, easy to fix mistake in the hyphenation framework. The bug 10374 is unfortunately a duplicate of 2106, not 6042, and a bit more interesting. It is caused by the parser delivering character references as a separate character chunk, thereby creating multiple FOText children of the block (FObjMixed) for consecutive text. This interferes badly with line breaking and hyphenation. Take e#x78;tensible with room up to the l on the line. This is split into three FOText objects e #x78; tensible The text is delivered separately to the line layout algorithm. The e and X do not fill the line but also are not words and are appended to the pendingAreas vector. The tensible then overflows the line and is passed to the hyphenation, lets say it is hyphenated as tensi-ble. The tensi- is appended without flushing the pending areas, which are put first into the next line. I put a StringBuffer into FObjMixed to accumulate consecutive addCharacters() events. This fixes the problem with character references, but not efo:inlineX/fo:inlinetensible (also noted somewhere in bugzilla as problem) The second is to flush pendig areas in addWord(). This fixes the lost characters problem but *still* does not correctly hyphenate words split into inline FOs, only the chunk actually overflowing the line is considered for hyphenation. More problems I noted: - white space is handled inconsistently - line break detection relies on white space only - word detection for hyphenation relies on white space and wrongly assumes there is a white space before the word passed to doHyphenation() - the LinkSet is not considered for hyphenated word parts in addWord, and neither for page-number-citation nor fo:character - same for most of overlining, line through and vertical alignment - characters are copied to FOText, and then copied *twice* in LineArea.layout(), one purely for hyphenation. During Layout, character data is at least three times, possibly four times (parser buffer) in memory Questions: - Is it still worth to do major hacks in LineArea.java? - Should we consider using Unicode break properties for line break opportunity detection? - How should words for hyphenation be detected? - What happens to line breaks and word detection in case of * inline graphics and other definitely non-text inlines * inline foreign elements, like formulas * inline-containers containing blocks, especially blocks with text only - Are there script or language dependencies to consider for line break and word detection? - At which point should collapse-whitespace, linefeed-treatment etc. considered? Possibilities: * while creating FOText * while feeding it into the line area * during line area layout Considering white-space-collapse during FOText creation has some problems in case of successive spaces in different inline FO. There are additional issues with consecutive spaces which had been discussed here already, in particular how foo fo:inline text-decoration=underline bar/fo:inline should be handled. Will this result in two consecutive spaces, one of them underlined? Has this issue been resolved meanwhile? J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: documentation for the maintenance branch
Peter B. West [EMAIL PROTECTED] wrote: Obviously there is a need for some documention with normal releases. We don't need the design docs in the user releases, but all of the operational material, including the FAQs, is necessary. If we were to do source and compiled releases, the xml-docs could go into the source release, for generation by the user. Vice versa, the generated html (and pdf docs?) +1 on omitting the design doc completely in bin distributions. Should probably omit skin source and xsl too. I'm not sure about PDF, apparently there are not much requests for this format. What's larger: - PDF - xdocs + *2document.xsl + document2fo + build mechanism for building PDF (includes ant.jar?) - xdocs + full xsl + build mechanism for building PDF This may need some explanation: We have documents using a generic document.dtd and some documents liks FAQs which have to be transformed into document.dtd xdocs before the final skin document2html.xsl can be applied. When using ant for building, this requires either temporary files (current solution) or a custom task for the transformation pipelines (or Cocoon CLI) need to be included in binary releases (with the proviso above, that the design docs are not needed.) It looks as though reworking is needed in the build.xml to accommodate these distinctions. How does that sound? That's exactly what I'm currently doing, the HTML and the intermediate document-DTD files are produced in the build directory. Unfortunately, as I already noted, it's an all-or-nothing thing unless you are comfortable with broken doc builds for some time. If this is ok, I can commit the first half tomorrow... J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: test cases
Jeremias Maerki wrote: I think there is one: test. Keiron, was that you who created it in the first place? I must admit that I've never looked into this directory, yet. Does the stuff in there work? Ah, yes. There is also a docs/examples/tests which is empty and is used to hold the results produced by runtests.{sh|bat} from the examples. The (yet another) attempt at formalizing test descriptions by testsuite.dtd etc. is neat. I'll think about this a bit. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: embedded FOP from Document to PDF
Juergen Lippold [EMAIL PROTECTED] It would be nice to start the conversion directly with the org.w3c.dom.Document in memory and the XSL-File from harddisk. Look here for a code sample. You can pass whatever Source subclass you want to the transformer object, including a DOMSource. http://marc.theaimsgroup.com/?l=fop-userm=102011358525336w=2 J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: runtime ExceptionInInitializerError: first steps
Massimiliano Cuccia [EMAIL PROTECTED] wrote: Uncaught exception (java.lang.ExceptionInInitializerError) SVGElementMapping.setupSVG() SVGElementMapping.addToBuilder(TreeBuilder) ... Do you have Batik in the classpath? YES, it is. If so, it is the version taken from the FOP distribution? SURE!! ... I don't understand ... the code is simple and small I thing that something is missing ... some initialization ... any idea?? Ok. From the Java doc: java.lang.ExceptionInInitializerError: Signals that an unexpected exception has occurred in a static initializer. You stacktrace indicates this happens in org.apache.fop.svg.SVGElementMapping.setupSVG() The code is (comments trimmed) private static synchronized void setupSVG() { if(foObjs == null) { XMLResourceDescriptor.setXMLParserClassName(Driver.getParserClassName()); foObjs = new HashMap(); foObjs.put(svg, SVGElement.maker()); foObjs.put(rect, SVGObj.maker(rect)); ... lots of foObjs.put ... } } It uses the class org.apache.batik.util.XMLResourceDescriptor, which happens to have a static initializer: static { bundle = ResourceBundle.getBundle(RESOURCES, Locale.getDefault()); } This could cause the above mentioned exception, the other stuff doesn't seem to do this. Ergo: something went wrong during loading of the ressource. What's going wrong is hard to guess. Usually, it's a deployment problem. However, you seem to run an unusual JVM. Locale.getDefault() could return an unusual value, perhaps null. If this is the case, you're hosed, complain to the vendor of your JVM. I'm not familiar enough with the failure modes of RessourceBundle.getBundle() to hazard a guess what else could have happened. If you can run the stuff in a debugger, you might be able to deduce it yourself. Otherwise, I'd recommend downloading the source for Batik 1.1 (actually which *is* the version of Batik shipped with 0.20.3?) insert some printlns for debugging in the code and see what happens. Batik seems to be somewhat overzealous in early loading all kinds of stuff all over the place. Someone out there with enough positive standing with the Batik people to tell them to do something about this? J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Line breaks and other typographical stuff (was: Re: Latest FOP schema)
Self-followup: Peter B. West wrote: These cover such categories as Case, Numeric Value, Dashes, Line Breaking and Spaces. I found them online, the relevant URLs appear to be http://www.unicode.org/Public/UNIDATA/LineBreak.txt http://www.unicode.org/Public/UNIDATA/extracted/DerivedLineBreak.txt and for the interpretation of the codes http://www.unicode.org/Public/UNIDATA/PropertyValueAliases.txt (the lb section) I still think this area is somewhat unintuitive to browse. Does somebody know where there is a more elaborate explanation of the values used there, in particular whether there is a formal description how they are supposed to influence the actual line breaking? I don't want to rely on intuition here, it fails me much to often... Slightly related question: FOP appears to render the U+00A0 non breaking space always at full space width. Shouldn't the space also be used for justification purposes? There are, after all, non breaking spaces with a definite width available. Ooops, major blunder. I should check before posting. While there is a variety of spaces at U+2000 and following code points, as well as various additional spaces for some scripts, there is only the common U+00A0 non-breaking space, U+2007 figure space (whatever this is) and U+202F narrow non-breaking space available. This begs the question: how should arbitrary non-breaking spaces be expressed in XSLFO, and how often does this issue arise? I vaguely remember that the most often arising use case in common engliish was the space after an abbreviated title, and this is only available for space justification at the same level of fine tuning as character spacing (and it should be a slightly less wide than a full width space). Well, if we are at this, another typographical nastyness which comes to mind is an indented initial. This bothers me for quite some time now: How should this be expressed in XSLFO? In HTML, a floating table around the letter can be used, but this seems awkward and does not account for fine tuning like the outdent to account for serifs. Also, the automatic displacement of the next lines could be a problem. I think there is also a float necessary in XSLFO, perhaps with some adjustments to the width and with relative positioning for fine tuning. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: Latest FOP schema
Arved Sandstrom Arved_37@ wrote: I think the predominant opinion is (assume all of this fits on one page) - a normal block area (generated by the outer block) that contains: one or more line areas for level_0_text fills to position A; then a block area with one or more line areas for level_1_text positioned at A fills to position B; finally more line areas for more level_0_text positioned at B. Note that if your example had been fo:block level_0_text fills to position Afo:block level_1_text positioned at A fills to position B /fo:blockmore level_0_text positioned at B /fo:block then it would still be the same. As a side note, assuming western language and script and hyphenation off, if the example had been fo:block level_0_text fills to position Afo:blocklevel_1_text positioned at A fills to position B /fo:blockmore level_0_text positioned at B /fo:block it is probably illegal, according to 4.7.2, Point 3. I suppose it would be illegal to have a line break within the word Alevel_1_text here. The problem here is, where do I get the rules whether a line break is permitted somewhere for a certain language and script? And how is this supposed to deal with out of context stuff like product numbers or artificial DB keys or programming language identifiers containing underlines and dashes, and with non-breaking spaces, odd symbols, and character abuse (uppercase greek omega instead of Ohm sign)? Again, I suppose the burden has to be put on the user who has to ensure everything is correct, including changing the current language for quotes, nested if necessary, and specifying a language for product numbers and programming language ids. Umm, something looking like ..., ISBN fo:inline language=x-isbn0-201-48345-9/fo:inline... and the fo:inline language=x-Javaorg.apache.fop.render.pdf.Fontfo:inline class implements the fo:inline language=x-Javaorg.apache.fop.layout.FontMetricfo:inline interface ... This would eleminate some keep-together stuff, I guess, but most probably requires a mechanism to teach the processor line breaking rules for user defined languages. DumbQuestions - Is the interpretation reasonable? (I don't ask about correctness...:-) - Can the redesigned FOP deal with the Alevel_1_text above, I mean will it raise an error or warning? - Can/should FOP deal with user supplied word/line breaking rules? /DumbQuestions Note that the same applies to the recently heavily discussed problem of a block level element inside an fo:inline, according to 4.7.3, in particular point 3. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: pb FOP 0.20 and servlet
Jean-Fran?ois_Selber [EMAIL PROTECTED] wrote: fo:block fo:external-graphic src=url:http://titane.oxymel.com:8080/statsfeftt/StatsDepartement?typeStats =graph13mois height=3.41cm width=23.81cm/ /fo:block I think the url: prefix is redundant. Try src=http://titane.oxymel.com:8080/statsfeftt/StatsDepartement?typeStats=graph13mois; If you are curious, try also src=url:http://titane.oxymel.com:8080/statsfeftt/StatsDepartement?typeStats=graph13moisamp;e=.jpg; but that's for fun only :-). HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: fo:inline borders and bgcolor...
Tomas Espeleta [EMAIL PROTECTED] wrote: does fo:inline support backround-color, border-style and so on? None of the background-*, border-* and space-* properties have an effect on fo:inline in FOP 0.20.3. There are a few other features missing as well. I'm not aware of a workaround, in particular because fo:inline-container isn't implemented either. I'm using fop 0.23.3 Where did you get this? :-) If I'm right, is this iussue on the TODO-list ? The current effort will adress these issues in the long term, but it will take some time. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: development status
Nicola Ken Barozzi [EMAIL PROTECTED] wrote: Anyway, these forward references are a pain in the ass :-/ Very true. Imagine the worst case: Someone puts a (See page fo:page-number-citation ref-id=blurble/) into the text at page 1. The formatter has to allocate some space for the unknown number, lets say a n space. The referenced block happens to end up on page 99. The preallocated space is not sufficient, extending this space could cause reformatting of all pages, which is already bad. Furthermore, the reformatting could push the referenced block to page 100, thereby providing another problem. I have no idea how an interface able to deal with the problem above could look like. Have fun J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Colon character problematic in xsl:template match=StringContainingColon ??
Joe Sytniak [EMAIL PROTECTED] wrote: I am able to create XSL for normal transformations to HTML just fine. But in order to get XSLFO to work, I must change the names of the 'rs:data' and 'z:row' nodes to something that does not contain a colon charater (ie. rs-data z-row). Such changes should not be necessary. In what sense does XSLFO not work? What are the exact symptoms? Do you get an error message or unexpected results? Is the problem caused by the transformation or during formatting? Did you inspect the intermediate FO? Can you show the relevant parts of your XSLT and source XML (please trim the files down to the problematic parts)? XSLT questions are better asked on the XSL list [EMAIL PROTECTED] J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: Colon character problematic in xsl:template match=StringContainingColon ??
Marylynne Henry [EMAIL PROTECTED] wrote: Similarly, I am having problems with the '' character. Is there a way to escape this character when it appears in the text? Yes, there is a way, read the spec at http://www.w3.org/TR/REC-xml, one of the countless XML FAQs or get some XML for Dummies books. BTW the problem you seem to describe is quite unsimilar to that of the original poster. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: FAQ Answers please
alex [EMAIL PROTECTED] wrote: Firstly lets set up a mailing list for discussing Apache FAQs. I think it would be a Good Thing. I think public discussions relevant to the FOP FAQ could be held on this list, everything else by email. Or did you think of a discussion on how to do FAQs in general? AFAIK there is no official XML schema or DTD for FAQs, but we can come up with one. There is something called xdocs which is what most Apache documentation is written in. I am not sure if it is suitable for FAQs. There is a docs/xml-docs/fop/faq.xml, the structure of which, however, doesn't quite match neither the source nor the result of docs/xml-docs/stylesheets/faq2document. Nevertheless the structure given by the mentioned style sheet is not unreasonable. An interesting alternative would be DocBook qandaset. I wouldn't have trouble providing any of the formats. DocBook comes with markup for indexing, which is valuable for a FAQ. HOWEVER do we want the FAQ in the CVS tree? It means that it is a lot harder to add new answers. I don't think using CVS automatically makes it harder to update the FAQ. We just have to set up the publication process properly. Of course it's easier if just one person uses only the ressources at his disposal. Some possibilities: 1. Update the FAQ in the docs subdirectory. Of course, changes in the CVS should be mirrored by publishing the generated HTML on xml.apache.org/fop. Actually, who does this publishing currently? 2. Provide a separate branch or even a CVS project for the FAQ 3. No CVS. In either case, we will have to agree on responsibilities and set up an event mechanism so that the publicly visible FAQ is kept in sync with what's archived somewhere. I personally would like to work on the FAQ distributed with FOP and published on xml.apache.org/fop. The server is reliable, and we would have a FAQ in the distribution which is in sync with the distributed code. Questions: - Who is currently responsible for publishing FOP docs on xml.apache.org? - Whom and by which mechanism should i send the material or notifications about changes in the repository? Possible mechanisms: Email, FTP upload, CVS checkin. - Who will be responsible for transforming the XML source into the publishing format? - Where will the ultimate source be archived? (N/A in case of CVS) plugAnyone in London or nearby want some FOP consultancy?/plug I've some experience to sell as well... Regards J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: FAQ Answers please
Nicola Ken Barozzi [EMAIL PROTECTED] wrote: There is a new project in Apache called Forrest, that is redesigning the whole xml.apache.org site to become useful as a Sourceforge on steroids. We are at the beginning, and it would be cool if you join us there! Well, there are already GNUforge and PostNuke I hope you havn't fall prey to the NIH syndrome. Currently, there is a mailing list, forrest-dev and a CVS module xml.forrest Would it still be possible to use established mechanisms as long as forrest is not put into production? It would be nice if you could give a short note about the current state and how the forrest project will influence the publication of FOP docs in the future (to keep it on topic for this list :-). Regards J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: problems with keep-with-next
Stephen Bannasch [EMAIL PROTECTED] wrote: keep-with-next still doesn't work on 0.20.3 It is implemented only for table rows. The problem is very annoying when I have a figure with a title on one page and the image on the next. Put stuff that should be kept together in a one column blind table and use keep-with-next on the rows. Be careful, overdoing this could send FOP into an unterminating loop. Please post followup questions on fop-user. HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
URI resolving
Hi, i did some thinking about FOP interfaces and especially the URI resolving problem last weekend. In JAXP you can do some rather geeky things with the URIResolver: - implement caches - implement URL redirections - implement your own protocols for synthetic XML As an example for the latter, use a filelist:/foo/bar URL to produce a directory listing XML like filelist filebaz/file ... by looping over File(/foo/bar).list() and fire SAX events. This way you can XMLify all kind of odd external data and pump it into the transformation process without bothering with temporary files. This is possible because the URI resolving method returns a javax.transform.Source, you can provide your own implementation for an XMLReader and a sax.InputSource and put them into a javax.xml.transform.sax.SAXInputSource to get the effect described above (a more elaborate description is in the XSL list archive). In FOP, unfortunately, we have to deal with both XML sources mainly for SVG and binary sources for most other formats. Well, there's also PostScript which is a sort of character source. It would be interesting to keep the possibility for dynamically creating SVG or other XML based formats out of thin air by directly firing SAX events or by providing a DOM tree, while also having the ability to deal with non-XML formats. One solution could be a delegation model class XMLURIResolver { XMLURIResolver(BinaryStreamURIResolver bsur) { theBinaryStreamURIResolver=bsur; } Source resolve(String baseURI,String relURI) { return new SAXSource(getXMLReader(), theBinaryStreamURIResolver.resolve(baseURI,relURI)) } } The fo:externalGraphics handling code would somehow have to decide whether the graphics is XML and invoke theXMLURIResolver.resolve(), otherwise call theBinaryStreamURIResolver.resolve() directly. (It may be an idea to provide an additional layer for character sources like PostScript) I'm not quite sure how FOP decides how to handle a certain input for an external-graphic, i have faint memories that it first looks at the content-type attribute and if there is none, it tries to guess a content type from the URL. It may be an idea to give the user hooks for this two mappings as well (content-type - content handler and URL - content type). Does this sound reasonable? It would be interesting to see how JAXP will deal with XSLT 2.0, there is also the possibility to import non-XML data. There is another point: JAXP uses a factory pattern where the factory creates a transformer for a single use holding the compiled style sheet. The factory uses an URIResolver for resolving URIs encoutered in xsl:include and xsl:import elements in the style sheet. A transformer inherits the URIResolver form the factory, but it is possible to set another URIResolver for resolving URIs encountered during transformation. In FOP, the analogs are resolving URIs which are part of the configuration, like URIs pointig to font descriptions, and do not depend on the FO input, and URIs which are encountered while processing FO input. There are some arguments in favor of splitting resolving responsibilities in FOP in a similar way, in particular if a similar factory/processor pattern is choosen for the FOP API. The advantage of such a pattern would be that the factory instance could efficiently cache configuration data while still having a convenient way to override particular settings for individual processor runs. Regards J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: FAQ Answers please
Keiron Liddle [EMAIL PROTECTED] wrote: [rearranged] 2. Batik/SVG specific questions 2.1 SVG text rendered in bad quality, how to put SVG text as text into PDF This isn't quite true... Well, it is asked in this form frequently enough. But you are right your explanation should be added too. There are more issues to be explained, like the 1pt grid lines show differently and such. There are also serious omissions in other parts. Now that i have broadband access from home, i could take some serious shots at keeping the FAQ in a good shape if somebody supplied me with instructions for writing and publishing the material (DTD, additional conventions, whatever). More explicitely, i'm offering assistance in FAQ maintenance. There should be a decision whether i should assist alex and the external FAQ or provide for the FAQ at xml.apache.org/fop/faq Hopefully this will help everyone. After a short glance at recent traffic it seems to be a vain endeavour. There ought to be a law that the more inferior a solution is, the faster it spreads. :( Regards J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: FAQ Answers please
(Crossposted to both fop-dev and fop-user. fop-user subscribers, please post follow-ups to fop-dev) alex [EMAIL PROTECTED] wrote: Can anyone capture any important questions and answers which I should put into the FAQ? Well questions are easy, answers somewhat less: Here is my impression 1. FOP specific technical questions 1.1 Using FOP in a servlet. Apparently, the servlet example in the distribution is not sufficient, but still a frist answer. 1.2 Using FOP in a servlet with an XSLT transformation Many suboptimal answers are regulrly posted here and to the fop-user list. The canonical answers are, use XSLTInputHandler or TraxInputHandler if both XML and XSL are files, or a SAX event stream if some XML is generated on the fly or read from an network stream or such. Code can be copied from http://marc.theaimsgroup.com/?l=fop-devw=2r=1s=xsltinputhandlerq=b namely http://marc.theaimsgroup.com/?l=fop-devm=101232320408992w=2 and http://marc.theaimsgroup.com/?l=fop-devw=2r=1s=getContentHandlerq=b unfortunately, there are various neat snippets which would have to be combined in order to show all the possibilites. http://marc.theaimsgroup.com/?l=fop-devm=100583267306925w=2 http://marc.theaimsgroup.com/?l=fop-devm=100703832007931w=2 1.3 User supplied fonts While this is answered in the Docs, some expressive hints about what data are file names and what are file _URLs_ could be noted again. 1.4 Embedding fonts when run from a servlet The usual code how to get the settings from userconfig.xml, as for example seen at http://marc.theaimsgroup.com/?l=fop-devm=101421597727050w=2 This question needs to be indexed twice, obviously. 1.5 Complaints about: 1.5.1 files not found referenced in fo:external-graphics, user fonts etc. 1.5.2 MalformedURLException, especially URIs starting with (null) It should be explained o The file names are URIs. o Users should be encouraged to get familar with URI syntax (quote web ressources, at least the RFCs). o The correct syntax for file URIs is file:///some/path/file.ext (on localhost, the usual case). Emphasize the triple slash. o The resolution mechanism for relative URIs should be explained, especially the role of baseDir. o Note that XSL transformations and JAXP transformers have their own mechanism for resolving relative URIs, could be redirected to the XSLT FAQ http://www.dpawson.co.uk/xsl/xslfaq.html 1.6 Setting baseDir in userconfig.xml 1.7 Setting baseDir in a servlet environment Either via userconfig.xml or the Configuration, code at http://marc.theaimsgroup.com/?l=fop-devm=101354604124258w=2 1.8 New VFAQ: PNG images and other formats dont (no longer) work, Jimi library is missing Jimi is no longer in the distribution. Explain where to get it. 1.9 NoClassDefFound (Command line) Explain again how to set the CLASSPATH. Explain the usage of the batch files and that they have to be started in the correct directory. 1.10 NoClassDefFound (Servlet environment), getting FOP working for various servlet engines. Explain classpath issues, how jar files are gathered by various products, and possible conflicts with existing XML/XSLT libraries Subquestions o Tomcat 4 o Tomcat 3 o IBM Websphere Oh, i have this at hand: Put a copy of a working parser in some directory where WebSphere can access it, for example, if /usr/webapps/yourapp/servlets is the classpath for your servlets, copy the Xerces jar into it (any other direcotry would also be fine) Do not add the jar to the servlet classpath, but add it to the classpath of the application server which contains your web application. In the WebSphere administration console, click on the environment button in the general tab (i have a german version so you may see different names). Fill CLASSPATH in the varianble name box and /usr/webapps/yourapp/servlets/Xerces.jar (or whatever your complete path is) in the value box, press OK, then apply the change and restart the application server. o Others? The mail archive is not very responsive about this today. 1.11 Method not found Explain possible incompatibilites (XML parsers, XSLT engines, Batik). Refer to previous question. 1.12 FOP and multithreading FOP is not thread safe. Explain consequences. 1.13 FOP memory consumption (should be higher in the list). OutOfMemoryException. Mention redesign effords Suggest using multiple page sequences if possible 2. Batik/SVG specific questions 2.1 SVG text rendered in bad quality, how to put SVG text as text into PDF That's here http://marc.theaimsgroup.com/?l=fop-devm=100525846132084w=2 Refer also to how to use userconfig in servlets 2.2. Batik on headless servers Refer to Xvfb and PJA http://marc.theaimsgroup.com/?l=fop-devm=101481782018662w=2 2.3. FOP does not exit if a SVG
Re: Outputstream with PDF from FOP is going cutted
Steiner, Priska [EMAIL PROTECTED] wrote: I have a strange problem. I tried to generate with Fop0.20.2 a pdf. I would like for output an outputStream instead of a fileOutputStream. This works fine, but when I tried to insert this Stream as a byte[] in a DB, the content will be cutted. PDF may contain characters which DBs usually deem to be illegal in text fields (CHAR or VARCHAR), most notably ASCII NUL (U+). Try to store the PDF in as BLOB. Notepad will also truncate data copied from the clipboard at NUL characters. HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: FOP Interfaces
Keiron Liddle [EMAIL PROTECTED] wrote: XML input - various ways to supply FOP with the xsl:fo file I might be an idea to rely on JAXP 1.1 here. general options - base directory Make this base URI. Make sure your concept allows resolving those pesky url(#stuff) properties in embedded SVGs generated by a transformation, which may mean baseURI is not constant, or that you need more than one baseURI. AFAIK Batik doesn't provide for user supplied URI resolving code either, so it's probably necessary to talk to them. I want to note that several code pieces for resolving URLs and/or file locations are scattered all over FOP and Batik. Replacing them all with an URIResolver invocation would unify behaviour and remove redundancies. I'd also recommend to lift the default URIResolver implementation from Saxon, it seems to tolerate the usual abuse better than everything else i came across elsewere. Keep up the good work! J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Using Avalon/Logkit
Nicola Ken Barozzi [EMAIL PROTECTED] wrote: I've used Avalon framework in many projects, and IMHO it's not heavyweight. Ok, scratch the heavyweight. In order to clarify issues: I have to use FOP in an environment which already provides logging, configuration management and life cycle management. I don't want to look into another log file. I don't want to write more config files. (There is also the fact that said environment goes to great length to make augmenting already provided functionality as complicated as possible). I have already customized ErrorListeners, URIResolvers and such and i want to reuse the functionality in the most straightforward way possible. I don't want to write more customizations just for the Apache logkit. In particular, i don't want to learn how to write such customizations. I don't want to prevent anyone from providing a FOP embedding using logkit and avalon. I *want* however access to a core which doesn't rely on yet another toolkit for common functionality and fits as seemlessy as possible into a run time environment roughly equivalent to the JDK 1.4 API (with emphasis on JAXP 1.1). Regards J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: [PROPOSAL] linebreak
[EMAIL PROTECTED] (ewitness - Ben Fowler) wrote: [snip] Well, this is drifting off topic for this list... but see the very end of this message. And some remarks anyway: In the example The correct way to express procedure foo(); begin ... would be something like: fo:block fo:blockfoo();/fo:block fo:block margin-left=1em fo:blockbegin/fo:block ... I meant correct way to express the presentational aspects with XSLFO. There was no intention to feed this to a Pascal compiler. The use case was I have some Foo source code and want to include it in my printed manual If you want to have your specific (XML) data presented on a 2D area like paper sheets or a computer monitor screen, you probably have to 1. Assign some presentational semantic to your specific data elements like para or proc or record or author 2. Apply some commonly used concepts like kerning, space justification, word wrapping and such stuff XSL, both T and FO, attempts to make this possible, and XSLFO is the second part: a vocabulary for describing the presentation of stuff on a 2D area, perhaps splitted into a page stream (disregard audible properties, whose inclusion is just plain silly). Depending on your point of view, you can see either of the two steps or both together as the equivalent of typesetting. Which is why I say [RETURN] for end of paragraph - /p, and [SHIFT][RETURN] for end of line - br /; to make the easy way the right way. XSLFO does not assign semantics to FOs beyond what's necessary to get them layed out. It does not have a concept of paragraph, and the concept of line is not necessarily the same as what for example software manual writers or java compilers use. Note that there is no fo:line and no fo:para, just a fo:block, which is *not* a paragraph. Further note that HTML p has paragraph semantics, this means some space before and after by default. Also, in early HTML there was no possibility at all to restrict the, well, lets call it page width. Therefore you could not simply write psome line pnext line in order to get a managable line length, it would result in a line spacing making it unreadable. In FO, you could write fo:block space-before=3pt fo:block space-before=0some line/fo:block fo:block space-before=0next line/fo:block /fo:block if you want to have your content formatted this way. I can't see a need for a br equivalent in FO. Another note: in TeX, semantic markup and presentational aspects are mixed in a sometimes annoying way. LaTeX tried to go as pure semantic as resonable, but, unfortunately, you have sometimes a semantic too special to explicitely define an abstraction for it and therefore describe it by its presentation instead. FO, on the contrary, is as pure presentation as possible, taking only really widely used concepts into account and leave the rest to the first step mentioned at the beginning (no formatting of mathematical formulas in FO, no theorem numbering ...) Conclusion: If you want to write documents, use DocBook, not XSLFO. DocBook btw contains linebreak elements, probably for some reasons already mentioned, and apparently there are no difficulties to map them to FOs. In order to clean up the seemingly contradiction that FO also allows for interpretation of LF characters: If you have already properly marked up text for lines, you can transform it (probably easily) into FO blocks. If you pull in whitespace formatted data from a file or DB or something, you might want to have the FO processor respect the existing formatting rather than to analyze and properly transform the whole stuff. That's a quick hack to fill a gap. I already experienced some times that the result is not as good as it should be and someone still has to wade through the data and convert it to properly marked up (or at least properly structured) data (usually leading to hot debates about what *is* the structure behind the formatting?) Having said all that, FO still lacks stuff, but mostly related to the fact that pagination is a task of the FO processor and not known at the time FOs are generated, like: - elements to express conditional stuff on page breaks in other elements, like continued on next page or continued from previous page - conditions like if this element does not fit the current page, start it on a new page (not decisively solved by keep-together) or if NN percent of this element do not fit onto the current page, start a new page (some generalization of widows/orphans) Can one of the FOP developers comment on how easy/hard such stuff would be to implement as extension elements? Regards J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Using Avalon/Logkit Was: Re: [Understanding] Images [4]
Jeremias Maerki [EMAIL PROTECTED] wrote: By the way: What's the current agreement whether to use Avalon or not? I mean, we're already using LogKit (which is cool). No, it's not cool unless done properly. I don't think users who want only pure FO processing should be forced to use another heavyweigth framework and logkit. I rather imagine something like the following layered architecture: 1. FOP core. Processes XML, either as SAX event stream by supplying a content handler or by utilising the interface javax.xml.transform.Source, into a renderer specific result (probably a java.io.OutputStream, could even apply to a voice renderer :-) Do not rely on any hardcoded external files. Get configuration via a java.util.Properties object or other explicit methods. Use a FOP owned interface like javax.transform.ErrorListener for reporting errors and such, or perhaps even reuse ErrorListener (somewhat odd, though). Use a javax.transform.URIResolver or a similar FOP owned interface for resolving URIs (external graphics source, user font file...). 2. Intermediate layer with a class combining a transformer and a FO processor instance (optional) 3. Class for embedding into the framework. Provides implementations for the URIResolver and the ErrorListener, the latter redirecting to the logging toolkit. May read external, user writable configuration files. Uses framework for passing options and other parametrisations from the outside (command line, servlet request, applet parameter...) It may be an idea to use the factory pattern like javax.transform: abstract classe FOProcessorFactory { // get a new factory. factory may cache default properties for // processors, fonts,... static FOProcessorFactory newInstance(); // create a new processor. a FOProcessor instance is only good // for one run, like a Transformer abstract FOProcessor newFOProcessor(); abstract FOProcessor newFOProcessor(Renderer enumeration); // inherited to generated processors abstract void setErrorListener(ErrorListener); // inherited to generated processors. use also for example for // loading default fonts while creating a new processor instance abstract void setURIResolver(URIResolver); // set attributes, like font file URIs or even compiled font // classes abstract void setAttribute(String name, Object value) // perhaps a few shortcuts for transformations abstract void setTransformation(Source xsl); abstract void setTransformation(Templates); // various get methods omitted :-) } abstract class FOProcessor { abstract void setRenderer(Renderer enumeration); abstract void render(Source,OutputStream); abstract void setErrorListener(ErrorListener); abstract void setURIResolver(URIResolver); abstract void setAttribute(String name, Object value) // shortcuts abstract void setTransformation(Source xsl); abstract void setTransformation(Templates); // extra shortcut (makes no sense for the factory) abstract void setTransformation(Transformer); } If a transformation is set, the Source in render() is the original XML piped through the transformation. I'm not sure whether get/set/ clearParameter for the transformation should be added to FOProcessor, fortunately, no output properties are necessary. There could be all kind of embeddings or standalone applications provided based on this interfaces. AWT rendering may need some more thought, i have no experience how this works. I'm uneasy about creating renderer objects separately, but it may be necessary. Regards J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: [PROPOSAL] linebreak
[EMAIL PROTECTED] (ewitness - Ben Fowler) wrote: [snip] I don't mind admitting that as an outsider to the XML standard, this looks like a bad, even a really bad, idea. My reading of your commentary is Whitespace is sometimes respected, and only a langauge lawyer can tell you when. Well, in some sense you are right, there are a lot of really bad ideas hidden in this area. However, you have to see this in context. A *real* typesetter doesn't care about whitespace and line feeds, he thinks in paragraphs and columns and pages of flowing text, with various indentations and margins and such. TeX was practically written to support this view, and this is the default how FO processors work. The problem: not everybody is a typesetter, many people don't even know about how to set indents and hanging indents and margins and this stuff, but they have a space and an enter key sitting squarely on their keyboard. The correct way to express procedure foo(); begin dostuff:=false; end would be something like: fo:block fo:blockfoo();/fo:block fo:block margin-left=1em fo:blockbegin/fo:block fo:block margin-left=2em fo:blockdostuff:=false;/fo:block /fo:block fo:blockend/fo:block /fo:block /fo:block but chances are you'll get it space- or even (shudder!) tab-indented. (Take a postal address block for another, less IT-related example) [If i'd get a chance to correct the past, i probably kill the inventor of the tab character before he commits his crime :-] There is a lot of whitespace formatted data out there, and it is unlikely to disappear in the near future. In order to deal with realities, you can fine-tune how FO processors handle various forms of white space. Actually, it is encouraged to do so only locally. You might have noted that in HTML+CSS br actually *is* redundant, it is just heavily (ab)used because it produces predictable results without fumbling with gnarly CSS settings. Especially if you have to bring already whitespace formatted data online *quickly*. Typewriter habits are hard to get rid of, regardless how enraged professionals are about this. Regards J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: sax conflicts with tomcat-4.0.2-LE-jdk1.4
Jeremias Maerki [EMAIL PROTECTED] wrote: The only place where Xerces is directly imported is the PFMReader and TTFReader. Ok, Driver, when startet using the command line, uses Xerces by default, but nothing prevents you from using any JAXP parser with FOP. Stuff matching org.apache.x* in 0.20.2: ...Driver.java parserClassName = org.apache.xerces.parsers.SAXParser; ...PFMReader.java org.apache.xerces.dom.*; org.apache.xml.serialize.*; org.apache.xalan.xslt.*; ...TTFReader.java dto. ...fop.layout.hyphenation.PatternParser.java parserClassName = org.apache.xerces.parsers.SAXParser; ...fop.tools.anttasks.CompileXMLFiles.java parserClassName = org.apache.xerces.parsers.SAXParser; ...fop.tools.xslt.Xalan1Transform.java org.apache.xalan.xslt.*; ...fop.tools.xslt.XSLTransform.java Class.forName(org.apache.xalan.xslt.XSLTProcessor); I believe all this stuff could be replaced by JAXP 1.1 standard functionality. This means FOP could also be build with any JAXP 1.1 compatible XML/XSL library. This would also get rid of some unfortunate dependencies from Driver.getParserClassName() (why not use SAXParserFactory.newSAXParser().getXMLReader() instead and let the library handle all the annoying stuff? At the same time, validation could be switched off, gaining some performance in rare cases). I could try to prepare patches, however: - Is there a chance to get them into the maintenance branch? (there is a feature freeze pending, AFAIK) - Last time i tried i was not able to build FOP successfully, because of an odd ant incompatibility problem i didn't (and still don't) have time to resolve. This means i can only try basic compilation, someone else would have to finalize the patch. (Crossposted to fop-dev) Regards J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re[2]: Web site maintenance
Aleksandar Zivkovic [EMAIL PROTECTED] wrote: Region Start is defined to be always on the left side of the paper, which is ,in book production, not always true. This is not quite correct. Where the region-start appears, depends on the writing order. It is on the left side for the usual western writing order: left-right within a line, lines top-down. See http://www.w3.org/TR/xsl/slice6.html#fo_region-start Sometimes, start is on the outside side of the paper, and end is inside. Do you mean you want to have a side bar which is always on the outer edge of the book, for example right on odd pages and left on efen pages? This is a FAQ (though more often in connection to placing page numbers in the footer), see http://www.dpawson.co.uk/xsl/sect3/evenodd.html and http://www.dpawson.co.uk/xsl/sect3/headers.html#d239e48 You define two page masters which are then used alternately, and you can have two differently named start/end regions so that you can place different static content there. HTH J.PIetschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
FW: FOP section and page breaks
EXT-Reddy, Swathi A [EMAIL PROTECTED] wrote: Can someone please post a sample XSLT file that does the section breaks and page breaks depending on the XML file? I have a XML file that looks like this - PAGE number=1 /PAGE PAGE number=2 . Page breaks can be achieved by placing a break-before=page or a break-after=page attribute on a block level FO. There are a lot of different possibilities how to do this, what's appropriate heavily depends an your context. Here is one example which will work with the XML above: xsl:template match=PAGE fo:block break-after=page xsl:apply-templates/ /fo:block /xsl:template This will create a blank page after the last page, which could be easily avoided with some conditional processing. Another potential drawback is that the page numbers will be continuous and wont honor the number attributes on the XML elements. If you want to have the latter, you'll have to use page sequences: xsl:template match=PAGE fo:page-sequence master-reference=some-master initial-page-number={@number} xsl:apply-templates/ /fo:page-sequence /xsl:template Last point: i hope you know what you are doing by expressing the page structure in the XML. Are you sure the content of all XML PAGE elements will always fit on the physical pages as defined be the FO page masters? I can add SECTION tags to tell the XSL file where the section break is. What's your definition of a section? It could be quite different from mine. HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: fo file
[EMAIL PROTECTED] wrote: if you know what instructions do i need to create a pdf file from a xml and xsl file First try the FOP command line application, the instructions how to produce a PDF from a XML and XSL file are well documented there. Once you have working XSL code and want to integrate it in a web site, look for example at http://marc.theaimsgroup.com/?l=fop-devw=2r=1s=XSLTInputHandler%28q=b http://marc.theaimsgroup.com/?l=fop-userm=101281691429031w=2 There have a zillion of servlet code snippets been posted recently both on this and on the fop-user list which you also might want to explore using the archives above. J.Pietschman - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: Why do you use FOP instead of ...
Roland [EMAIL PROTECTED] wrote: Wrong! Look at iText http://www.lowagie.com/iText/ to see how simple their examples are. They build a complex table with just a few lines of java codes. Try doing the same with the XML/XSLT/XSL:FO approach and I guarantee you that the total outcome will be much more both in lines and complexity. I think to generate PDF with iText is as easy as generating XML from Java. XSLT is just a complicated language. You seem to assume that everyone wants to generates PDF form a Java program, using XML/XSLFO only as intermediate steps. In this case, you would have a point. However, it is possible that 1. The primary source is already XML (file or database), or you get XML from a source you can't control (for example a web service). 2. Apart from PDF, you have to present the same information in another format, in particular (X)HTML, perhaps and/or WML, VoiceXML, SVG ... I have to note we also generate source code in various programming languages as well as DDL and initial databease input from our XML using XSLT. If one of the above is true for a project, XSLT+FO can save some work and ease maintenance. If you have both, it's a very strong case for using XSLT+FO, other approaches are getting unmaintainable quickly. Regards J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Please help, even if it's just a reply that it can't be done
Scott Moore [EMAIL PROTECTED] wrote: I cross-posted this several days ago and didn't get a single reply. Before i get to the meat, a net.cop note: Use meaningful subjects, don't mention crossposting (even if it is justified in the first place), don't bother the gurus in the dev lists, there are user lists. Is the problem in my XSL-FO? Is the problem in my SVG? Is the problem with Batik? Is the problem with FOP? Well, ultimately the problem is caused by a somewhat unlucky choice of the SVG standards group... An I/O error occured while processing the URI 'file:D:/Projects/Dev/#PurpleToWhite' specified on the element circle The url(#PurpleToWhite) in your circle element is a relative URL which was resolved to the absolute URL in the error message above, which, as it apparently represents a directory, is not a good source for SVG gradients. The reason why you got the absolute URL above depends on how you invoked FOP and perhaps a few other circumstances. In any case it has to point to a valid SVG file (or at least XML). This may be somewhat problematic as you probably generate the SVG inline in the FO tree. You could try 1. Have a separate SVG file and use it with fo:external-graphics 2. Have a separate SVG which contains only the gradient (and perhaps other SVG stuff you want to reference) and point an absolute URL to it: fill=url(file:///c:/refstuff/grad.svg#PurpleToWhite) 3. Same as above but use a relative URL fill=url(grad.svg#PurpleToWhite) This may be easier to deploy. Put the file in D:/Projects/Dev. 4. Let the URL refer to some location where the gradient could be retrieved, for example if the SVG code is embedded in your XSL, try fill=url(my.xsl#PurpleToWhite). Don't know whether this works, or whether this is even supposed to work. Expect a performance hit in all cases. Ultimately, both FOP and especially Batik should be fixed to make your code work as expected, but this will not only take some time but also some efford by a standard committee in order to make the semantics of this kind of references in embedded SVG clearer. HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: Please help, even if it's just a reply that it can't be done
Scott Moore [EMAIL PROTECTED] wrote: Sorry about the subject line, but my previous subject SVG Problem with FOP got no replies. I read it but had real work to do. However, it still can't locate the gradient definition. It gives the following error An I/O error occured while processing the URL 'file:C:/Projects/Dev/Gradient.svg#PurpleToWhite' Try an absolute URL, with emphasis to the triple slash, as this is the correct form for file URLs. file:///C:/Projects/Dev/Gradient.svg#PurpleToWhite Check the location carefully. If this succeeds, you could try to set the baseDir configuration parameter to file:///C:/Projects/Dev/, search the FOP doc for how to do this (presumably in the userconfig.xml). The exception generated by Batik now identifies the correct file, but still can't seem to locate the gradient definition. The I/O-Error seems to indicate the generic problem of not getting some or all of the content of the file. Changing the content wont fix this. You may have to experiment a bit. For example, try access a small GIF from this directory as fo:external-graphic. If FOP gets an error with the GIF file, it's the directory or the URL syntax or something more general. If the GIF shows up, it's your SVG file, perhaps you should check well-formedness or SVG-validity or whatever. I really can't help much further, you'll have to solve the problem for yourself. HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: out of memory exception in java ?
Nick Winger [EMAIL PROTECTED] wrote: the footer is displayed is every page, but it overrides the text in the table... that means, the table doesn't stop at the region-after section... You have to declare the body region properly in your page-master so that it doesn't extend into the region-after. For example fo:simple-page-master master-name=content margin-top=6mm margin-bottom=0mm ... fo:region-body margin-top=25mm margin-bottom=20mm/ fo:region-after extent=15mm/ /fo:simple-page-master This means roughly -- page top ^ | margin-top of the page (6mm) v -- ^ | margin-top of region body (25mm) v -- ^ | region-body (size depends on page-height) v -x ^ - | margin-bottom of region body (20 mm) ^ | | region after (15mm) v v -x -- ^ | margin-bottom of the page (0mm) v -- page bottom The XSLFO spec has nicer graphics. other question: what is a page-sequence ? A sequence of pages. You can define static content for a page sequence to put into regions defined in the page-master(s) for that sequence. You can select a starting page number. The processor will generate a page, take text defined in the fo:flow in the sequence, put as much as possible/sensible onto the page, and if there is text left in the flow it will start another page until it runs aout of text. The XSLFO spec has a more detailed description of everything. can i have multiple page-sequences in one pdf file (fo-file) Yes. Be aware that a new page sequence always starts at the top of a new page. It is not uncommon to have different page sequences for TOCs, indexes, colophons, title pages, abstracts and some people create one for each chapter/appendix. This is also a strategy to reduce total memory consumption of FOP and the risk of running out of memory. because let's say i have 3 tables in one pdf file fo-file) and every page where there is a different table should have a different static-content flow-name=xsl-region-after ( every table a different footer... ) That's one of the most common reason to have several page sequences. Furthermore: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] wrote: fo:block font-size=10pt font-family=Arialn xsl:text___/xsl:text /fo:block Wouldn't you use fo:leader for generating rules? Also, it shouldn't be necessary to generate a footnote, fo:static-content flow-name=xsl-region-after fo:block fo:external-graphic src=stuff.jgp/ /fo:block /fo:static-content works just fine. I regularly put SVG into headers and footers. For laout, it may be easier to use a blind table rather than a weird combination of nested fo:inlines and fo:blocks. HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Barcode-line on a page....
[EMAIL PROTECTED] wrote: but one solution shows me many more problems... :( My margins must be set to 0 now (leftmargin) and that screws up my whote document. You can define margins on the body region, where the text flow goes. Define a region-start appropriately, where the static-content is placed. If you need marks alternatively on the left and right margin (for books), use repeatable-page-master-alternatives. There is more about this in the spec, for example at http://www.w3.org/TR/xsl/slice6.html#fo_simple-page-master Note: Reading and understanding specs is the price to pay for becoming a guru... HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: keep and break questions.
[EMAIL PROTECTED] wrote: i have some questions with the keep and break stuff... I tried to keep a fo:block together with this code: fo:block keep-together=allways This property is not yet fully supported. Even then the value should be always. but when i render my xsl xml to a pdf (through JAVA) the block is splitted over two pages. And i don't want it. the block excists out off a table who should be together Try to use keep-with-next or keep-with-previous on the table rows. It may also help to replace the block by a blind table and use keep-with-next there. You'll have to provide more input if you want to get more help for a workaround. Regards J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Unicode interpretation
Joerg Flotho [EMAIL PROTECTED] wrote: only if you use somewhat esoteric characters (for middle-european cultures) like special mathematical symbols. The copyright-symbol (x00A9) is interpreted correctly, I think because it's lower than 256. Second example: a left-arrow (x2190). In filename.fo it's displayed correctly. In the pdf it appears as an angle. It appears as NOT SIGN (x00ac). X00ac is the code point of the left arrow in the symbol font. I'm not sure why FOP does not switch to the correct font. Try fo:inline font-family=Symbol#x2190;/fo:inline as a workaround. The used font is Arial. Using Arial Unicode MS makes no difference.(Maybe the syntax wasn't correctly) Is white space allowed? White space is allowed. However: FOP must know about the fonts too. The standard distribution knows only about Helvetica, Courier, Times Symbol and Dingbats. See font.html from the distribution. If you want to use Arial Unicode, you have to install it in FOP. HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Euro sign
Martin Stricker [EMAIL PROTECTED] wrote: Patrick Andries wrote: Why do I see a bullet instead of a euro sign (EUR), when I simply compile the fonts.fo file found in the Fop-0.20-2 distribution (./docs/examples/fo)? You are using the wrong OS and fonts. :-( On Win2k the Euro sign is mapped to character code 128 (0x80). Another approach is to use the Unicode code point #x20ac; in one of the fonts which have an Euro symbol glyph (does not work if font-family is set to Symbol). FOP knows how to map this onto the character set specific code point. HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: How can I print using the servlet example ?
Anshuman [EMAIL PROTECTED] wrote: Well I know that I can get the pdf rendition to the browser and display the same using Acrobat. Then the client can use the print option of the Acrobat to print the document.But, in case I want to have a link to print the same without displaying the PDF to the client, how can I accomplish the same ? Any help is welcome... This topic has been recently discussed at length, even though it hasn't really anything to do with FOP or servlets (think about it...). If your clients use IEx, the following could be of help: http://marc.theaimsgroup.com/?l=fop-devm=101065988325115w=2 As for Netscape/Mozilla/other browsers, you probably have to use an applet or plugin which can start the Acrobat Reader, some hints about the latter http://marc.theaimsgroup.com/?l=fop-devm=100825257425328w=2 HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: embedding svg in xsl:fo generates nullpointer, help ...
Manuel Moons [EMAIL PROTECTED] wrote: I'm trying to put an svg in my xsl:fo document and then trying to generate a pdf document. But when doing this I get the following: ERROR 10106 [fop ] (): Could not set base URL for svg java.net.MalformedURLException: java.lang.NullPointerException This can happen for example if you feed FOP with a SAX stream. I fixed this with org.apache.fop.configuration.Configuration.put(baseDir, file:///foo/bar); somewhere before the invocation. The value supplied has to be a valid URL but it is never read unless you use internal references in your SVG. If you do the latter, you might be in trouble. It also seems that it starts on a new page every time I use an svg That's a completely different problem. Maybe your SVGs are too large. BTW giving width/height in px is unwise and may be the cause of the problem. HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: FOP-XSL:dynamic external graphics
Romain Bertucelli [EMAIL PROTECTED] wrote: I tried to the same thing with xsl:include href={concat($filepathValue,'anXSLFile.xsl')}/ [snip] Does anyone know if there is a way to do this ? You can't do this. Stylesheet includes can only use statically known URIs. Actually, you probably don't need to set the URI dynamically. The URI may be a relative URL. If all your style sheets reside in the same directory, simply write href=anXSLfile.xsl or such. More exhaustive: Generating PDF from XML using FOP is actually a two pass process. The first pass is the XSL transformation, where you apply an XSL stylesheet to the input XML to generate formatting objects, also an XML structure. The software doing the transformation is the XSLT processor, FOP comes with Xalan for this purpose. The result of the transformation is passed to the formatter, the FOP software itself, which produces the PDF. The distinction is relevant: xsl:input is an *instruction* for the XSLT processor, while fo:external-graphic src=URI/ is *generated* by the transformation and an instruction for the formatter. The URIs in the href respective src attribute are interpreted in different environments. For xsl:include it's the XSLT processor, which uses the base URI (the directory for files) of the stylesheet where the xsl:include instruction occurs for resolving relative URLs. The formatter may use something completely different, it may use the current directory for file URLs which may be something strange in a servlet environment, or it may use a configuration setting. With the knowledge of how relative URLs are resolved, you can get rid of any absolute filenames in your stylesheets. If you have to move between environments where absolute filenames change, a sensible organisation can save you work. Put all style sheets into one directory and use the filename as relative URL in xsl:include and xsl:import. Set the base directory for the formatter explicitely for example from a servlet configuration value and use relative URLs for images too. HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Unicode interpretation
Joerg Flotho [EMAIL PROTECTED] We have different versions of interpretations regarding unicode: [...] (hexadecimal or decimal seems to make no difference). That's by design :-) After passing XALAN some signs were interpreted wrong.(viewing in IE 5.0 as filename.fo) [...] I suppose some characters are displayed as unexpected glyphs on the screen. This may have rather different causes: - There is no appropriate font on the system for supplying information how those characters are rendered. - The software has difficulties with the encoding of the characters in a file and therefore interprets some characters as being other characters than originally meant. - There are typos in the character references in the XML source file. Your description doesn't make clear which of these apply, maybe even all toghether. 1. Make sure the character references (#160; and the like) in the source file are correct. 2. Check whether the fonts on all relevant machines can map the characters you use. In case of PDF, this may not only involve the machine where the PDF is generated but also the machines on which the PDF is viewed. FOP must know abou the fonts too. This should be relevant only if you use somewhat esoteric characters (for middle-european cultures) like special mathematical symbols. 3. Be sure that the encoding in the XML declaration at the beginning of your XML source file matches the actual encoding. This shouldn't be relevant if all characters which aren't US-ASCII are typed as character references (like #254;). If in doubt, check whether there are any non-ASCII characters in the file, and replace all you find by their corresponding character reference. German umlauts, non-breaking spaces and typographic quotes are not ASCII. If this doesn't help, produce a minimal XML file with a character reference whose rendering does not meet your expectations, like ?xml version=1.0? char#1234;/char and describe how you expect the character to be rendered and what you get, and perhaps what OS you run and what font you expect to be used for rendering the character (which should of course be installed). HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
FOP-XSL:dynamic external graphics
Rachael Blank [EMAIL PROTECTED] wrote: Is there a way I can dynamically display images based on an xml tag that I am given? [...] I thought something like this would work: fo:table-cell fo:block white-space-collapse=true xsl:variable name=filepathValue select=concat('file:../default/tra-app/images/',client/id,'logo.gif') / fo:external-graphic src=$filepathValue / Try fo:external-graphic src={$filepathValue}/ here. Attributes of literal elements are by default literal, this means, you generated literally fo:external-graphic src=$filepathValue/ in the output, which is of course not an URL. Enclosing stuff in {} makes it an attribute value template, the stuff within is evaluated as XPath expression. You may also have parts of an attribute be an AVT, like fo:external-graphic src=file:../default/tra-app/images/{client/id}logo.gif/ As a last hint, if every time you get mysterious errors for invalid attribute values, it pays off to invoke the XSLT transformation separately and examine the intermediate FO directly. HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Dictionary style pages
Edward Dowgiallo [EMAIL PROTECTED] wrote: The example (franklin_2pageseqs.fo) does not do what I am looking for. Although starting with page 7, it does alternate between odd and even masters, the page number is always on the right hand bottom. I want to know how to make it appear on right hand bottom for odd pages and left hand bottom for even pages. [...] Look into the FO section of the XSL FAQ. http://www.dpawson.co.uk/xsl/sect3/evenodd.html (URL changes on occasion) It's for aligning headers, but i'm sure you can adapt it to your problem. HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: Bleeding / Hyphenation issues
Darrel Riekhof [EMAIL PROTECTED] wrote: Could some expand on the paragraph below. What are the other relevant attribs? What/Where is the database for my language (English)? The relevant attributes are more or less described in chapter 7.9 of the spec (http://www.w3.org/TR/xsl/slice7.html#common-hyphenation-properties) In order to get hyphenation working, you probably have to set at least the language. Versions older than 0.19 had serious bugs, i use 0.20.2 without many problems, though there are still rahter unpleasant bugs (for example, words long enough to be hyphenated multiple times have problems, and hyphenation doesn't mix well with links and various font attribute changes). The datebases for hyphenation patterns are, quite obviously, in the hyph subdirectory of the FOP source distribution. Reading or changing these patterns requires some advanced knowledge, though. The values are compiled, therefore changes will only take effect after a rebuild of FOP. HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: encoding
[EMAIL PROTECTED] wrote I'm beginner in FOP. I have a problem with windows-1250 encoding, please help me. My source XML documents looks like this: [...] I use xsl-fo document to transform source document to plain text: ?xml version=1.0 encoding=windows-1250? xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform; xmlns:fo=http://www.w3.org/1999/XSL/Format; version=1.0 xsl:output encoding=windows-1250/ Producing anything with FOP using an XSL file is actually a two-stage process. In the first step FOP invokes an XSLT processor which applies the transformation rules written in the xsl:stylesheet. The result is then piped to the FO renderer which produces the output. The xsl:output statement controls the output of the first stage only. If it is possible to control the encoding produced by the FOP text renderer at all, it would have to be done using the fop.Options class or in the userconfig.xml file. I'm afraid you have to study the FOP documentation carefully, perhaps even the source code of the text renderer. You can produce text files directly with XSLT, without an intermediate FO stage, using the output method text. If your output is not overly complicated, and you don't need the FO formatting for other purposes (like rendering to PDF or PostScript) it may be easier to skip the FO generation. HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Bleeding / Hyphenation issues
Darrel Riekhof [EMAIL PROTECTED] wrote: We are having problems with our reports because FOP doesn't break on hyphens. Well, i tried fo:block hyphenate=true language=degoiue sk kalks aki aks kallk kajas kals siensalks yadadadadadada- dadadadadadadadadadadadadadadadadadadadadadadadaadadoijefgjsdgfj- sdgfewhtcahtuehtcmeiuthaoutcetet-awtvcawwctawtcw-cawwtawztcvz?/fo:block (without the line breaks imposed by the mail client) and FOP inserted a line feed after the first dash, without inserting an additional hyphen. It had apparently problems with finding another hyphenation point after this, this may be due to the nonsense-word which probably does not match any of the patterns in the database. If you have set the hyphenate property and other relevant attributes properly and you still have difficulties, try inserting a zero-width space or add some hyphenation patterns including a dash to the database for your language. HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Specific footer on the last page
Thierry Gounelle [EMAIL PROTECTED] wrote: Here is my problem: I have a document that may have 1 to N pages. I would like to print something on the footer of the last page (or at least on the bottom). This may be more tricky than it seems at a first glance. One possibility is to put the text into a footnote and refer to it from an otherwise empty block at the end of the text. Specify a character which does not render a visibly glyph as the footnote character, like a zero width space. You might have to customize the footnote separator as well. HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: Page Breaks
Hello, a form feed (\f, 0xC, ASCII FF, CTRL-L or #xC) is not a legal character in XML. Data containing it could/should be rejected. Also: Jim Urban [EMAIL PROTECTED] wrote: XSLT is under the control of our client. Then you can tell your clients to cope with it. Actually, doing something for certain specials characters in XSLT is a FAQ (usually emitting a BR/ on line feeds). Both the XSL-List archive and the XSL-FAQ have solutions that could be adapted to the problem at hand. Look at http://www.dpawson.co.uk/xsl/sect2/replace.html BTW could you guys *please* try to trim unnecessary quotations? HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: xpath
Maneshi Tuli [EMAIL PROTECTED] wrote: I want to count all rows for whom child col having attribute num='8' is not null [snip] Questions like this should be asked on the XSL list ([EMAIL PROTECTED]). Try count(row[col[not(@num='8')]]) This actually counts row elements with a col child which doesn't have a num attribete with the value 8. HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: HELP: PDF generation hangs
Vladimir Sneblic [EMAIL PROTECTED] wrote: I have a problem when I try to generate a PDF file from a FOP file that contains an SVG image. It doesn't matter if the image is inline or if it's stored as a separate file. My problem is that the PDF file gets generated but for some reason the java thread hangs, i.e. even though the work is finished it doesn't stop executing. Has anyone else encountered this problem? This is a well known problem with the Java runtime, which should be fixed in JDK 1.4 (along with a few other major annoynaces). What probably happens is that Batik uses AWT functionality for SVG rendering, which often (but not always) causes the graphics subsystem to create an additional thread, which will still run after the main thread expires. This may also depend on the platform and the underlying graphics system. A temporary fix is to add System.exit(0) to the main functions of applications which use FOP (or Batik). JDK 1.4 was still beta last time i checked, you may want to try it anyway. HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: servlet called thrice on IE 4.0
Savino, Matt C [EMAIL PROTECTED] wrote: I know this has been discussed here before, but I just wanted to ask in case anyone has discovered a solution. Basically I'm etting that problem where IE is calling the FOP servelt twice. It is said this is caused by IE trying to derive the content type form the URL first, then loading the content, thereby reading the MIME type supplied by the server, and loading again if it doesn't match (bad architecture...). Try to use an URL ending in .pdf, for example http://localhost:7001/resultview/ReportGenerator.jsp?counter=25ext=.pdf HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
SVG error question
Ulrich Mayring [EMAIL PROTECTED] wrote: I get this exception with fop: ... (xml): Could not set base URL for svg What is this URL and how can I set it? You probably have an SVG embedded in you FO which is generated on the fly, perhaps in a servlet. The error message is from Batik which tries to create a document reader for the SVG for navigation inside the SVG, even though there is no separate SVG document. I fixed this by inserting a line org.apache.fop.configuration.Configuration.put(baseDir, file:///some/random/name); before invoking the driver. The URL is never read in my case, if you use cross reference URLs in your SVG, like referencing fragments or shaders, things might be more complicated. HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: table-header with (Con't)
Jim Urban [EMAIL PROTECTED] wrote: Here is another thing I need to do. I have a single document which contains reports for multiple locations. I need to reset the page number on a location change. IE: Report contains 3 locations. The first location gets 3 pages, the second 2 pages and the third 4 pages. Currently FOP is generating Page 1 of 9, Page 2 of 9 etc. I need to generate Page 1 of 3, Page 2 of 3, Page 3 of 3, Page 1 of 2, Page 2 of 2, Page 1 of 4 etc. How do I go this? This has been recently discussed on this list. Create a page-flow for each report. Since you want to have the total page number for each page-flow referenced, you'll have to be careful choosing the identifier for the block used in the reference trick. If you generate the FO by XSLT, and your reports are wrapped in record elements in your source XML, you can use a code similar to: xsl:template match=report fo:page-sequence master-name=report initial-page-number=1 fo:static-content flow-name=xsl-region-after fo:block text-align=end xsl:textPage /xsl:text fo:page-number/ xsl:text of /xsl:text fo:page-number-citation ref-id=endofflow-{generate-id()}/ /fo:block /fo:static-content fo:flow flow-name=xsl-region-body xsl:apply-templates/ fo:block id=endofflow-{generate-id()}/ /fo:flow /fo:page-sequence /xsl:template HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE:Making PDFby combining different XML files???
sunitha nair [EMAIL PROTECTED] wrote In the commandline i'm using java -cp org.apache.fop.apps.Fop -xsl rajeev.xsl -xml rajeev.xml -pdf rajeev.pdf that is rajeev.xml is the final xml file which contain lot of chapter xml files.I need chapter files because i want to make pdf of individual chapter other than pdf of entire book as user demands. so my question is how i combine all that chapter files into a single xml file so that i can use the above command line and make the book pdf. as per the above commandline i'm inputting .xml and .xsl(eventhough using the xsl-fo tags). how i make pdf of a book ,if there are two chapter xml files...chapter1.xml chapter2.xml using fop with the There are several posibilities. A pure XSLT solution would be to create a control file rajeev.xml ?xml version=1.0 files filechapter1.xml/file filechapter2.xml/file /files then set up your XSL file rajeev.xsl roughly as follows: xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform; xmlns:fo=http://www.w3.org/1999/XSL/Format; xsl:template match=files fo:root !-- setup your page masters, page-sequence, static content etc. here -- fo:flow !-- get the content now -- xsl:apply-templates select=document(file,'.')/ /fo:flow /fo:root /xsl:template !-- templates from your XSL here -- /xsl:stylesheet then invoke FOP as you wrote in your mail. This will put all your chapters in the same flow, if you want to put chapter dependant info in the static content, you'll have to fiddle with it a bit. The core is the document(file,'.') part, which will pull in all the files named in your control file. Get more infos about it from any XSL book, the XSLT-FAQ http://www.dpawson.co.uk/xsl/ or the XSLT spec http://www.w3.org/TR/xslt If you have difficulties adapting the example code to your needs ou'll have to ask on the XSL list as this are not FO questions. same .xsl file for styling. I don't quite understand this. You don't have individual XSL files for each chapter, do you? HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: XML-file on an other webserver
Egmont Ritter [EMAIL PROTECTED] wrote: I must create a PDF-file with FOP. My XML-File is on another webserver. Can FOP handle this? Basically yes, if invoked from java code. The command line FOP application requires files. I tried it with a servlet running on the Tomcat-server but I became ^^^ use got. You don't ever want to become an error :-) (see http://dict.leo.org/?search=became) an error like file not found. [...] The error was: SystemId Unknown; Line 0; Column 0; File file:/d:/okprg/okweb/jakarta-tomcat/http:/pc-11-rittere:789/xml/fee.xml not found. You either invoked FOP from the command line or you tried something like new StreamSource(new File(http:/pc-11-rittere:789/xml/fee.xml)) in your Java code. Use new StreamSource(http://pc-11-rittere:789/xml/fee.xml;) instead, without creating a file. This is not a FOP but a Java question. HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Fop and external fonts
Eyermann Horst ICM Bocholt [EMAIL PROTECTED] wrote: I also did not manage to install a font, as the font I have is omseip.pfb (OMega SErif IPa), which I fail to convert to the format required by FOP. [...] - should I try another font (which one) There are several TrueType IPA fonts out there, both commercial and free. Try Google for IPA font. HTH J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Antwort: post-processing info
Yury Rabiankou wrote: Maybe somebody could give me some hints how to do the following: 1. After PDF is created, I want to find out for every pdf page what original content is there, I mean I want to know, that from the beginning of the original xml file until some position in it, content went to the 1st page of pdf document, then content until another position in original xml went to the 2nd page and so on. 2. I would like to generate pdf file with only selected pages included (or page range). Hello Yury, this are both very odd requirements. Why do you think you'll need it this way? In general, the answer is you can't at both accounts. Your specific context may allow some tricks to achieve it, but it is difficult to take a shot at it without further knowledge. HTH Joerg Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Antwort: post-processing info
Let's say I have xml document. I've generated its pdf version and I've have printed it. After some time the original xml document is changed, then I generate its pdf version again. But now I want to print only pdf pages, that were changed and I want to do it automatically. If you are looking for the changed content only, you can try to implement a diff algorithm for you xml and create change marks in the pdf, then write a tool, perhaps based on xpdf (http://www.foolabs.com/xpdf/) which prints only the pages with change marks. In general, the problem the way you formulated it is difficult to solve, as small changes in the XML source may change the content of a lot of pages in the PDF. HTH Joerg Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Antwort: page numbering problem...
Hi wali, I creat a PDF document which have reports for different customers. One document can contain many reports. Now I want to mark the pages for reports individually. i.e. ... Every new report starts at new page. and every report can consist of different number of pages. Create a page sequence for each report. If you are creating the FO via XSLT, and if you have the reports in individual XML elements (here called report), you can use something like xsl:template match=report fo:page-sequence master-name=report initial-page-number=1 fo:static-content flow-name=xsl-region-before xsl:textReport /xsl:text xsl:value-of select=title /fo:static-content fo:static-content flow-name=xsl-region-after fo:blockfo:leader leader-pattern=rule leader-length =max//fo:block fo:block text-align=endxsl:textPage /xsl:textfo:page-number//fo:block /fo:static-content fo:flow flow-name=xsl-region-body xsl:apply-templates/ /fo:flow /fo:page-sequence /xsl:template Tailor this to your needs. Of course you'll have to define a page master report (you may have different page masters for the title page, the TOC, appendices etc.) HTH Joerg Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Antwort: XML parser question
Willie Wu wrote: Is it possible to configure FOP to use a XML parser other than Xerces? In my existing app, I'm already using Crimson, which I want to reuse for FOP. Yes, it is possible. It's a little bit arcane, though: you'll have to set the javax.xml.parsers.SAXParserFactory service to the full classname of your parser factory implementation class. You can set the service by creating a META-INF/services directory in your classpath (may be in a jar file) and create a file with the name javax.xml.parsers.SAXParserFactory and with the aforementioned class name as the only content. There may be other ways, ask a local guru. I'm not sure whether crimson comes already with a parser factory implementation, ask a local guru. Check your crimson distribition whether the precompiled jar already contains such a file in the META-INF/services directory, if so, you'll only need to put this jar into the classpath instead of the Xerces jar. Be sure to place it before the Xalan and the FOP jar. HTH Joerg Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Antwort: Calling FOP with strings rather than filenames
Hi, Bob, you can do it but FOP isn't exactly optimized for your problem. You'll have to do the following steps: 1. Create an XSL transformer factory: TransformerFactory tfactory = TransformerFactory.newInstance(); 2. Create a transformer with your XSL string source: Transformer transformer = tfactory.newTransformer( new StreamSource(new StringReader(xslString))); 3. Create a FOP driver, set any parameters you want. Driver driver=new Driver(); driver.setRenderer(Driver.RENDER_PDF); driver.setOutputStream(outStream); 4. Invoke the transform() method of the transformer, supplying the XML string as a source and the FOP driver as the result: transformer.transform(new StreamSource( new StringReader(xmlString)), new SAXResult(driver.getContentHandler)); Look at java.xml.transform (from the Xalan or j2ee distribution) for details about creating and invoking Transformers and dealing with ErrorListener stuff. BTW you can save a great deal of memory and processor capacity if you can get your program parts to communicate via SAX events instead of strings. You'll need a FOP 0.20.2 distribution for doing the above. All untested, as i'm using something more convoluted due to FOP 0.20.1 legacy. HTH anyway. Joerg Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Antwort: RE: Antwort: Making a native win32 binary out of FOP
[EMAIL PROTECTED] wrote There appears to be a way to package the MS JVM together with some Java classes into an .exe. Does Saxon actually package MS JMV, I've understood that saxon.exe still required MS JMV to be installed into your system? Oops, you are right, the MS JVM has already to be installed. This should not be a problem for most MS-Systems, except perhaps some batches of XP. Joerg Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Antwort: Why XSL FO
Someone wrote: Can anyone help me in knowing that why XSL cannot be written to translate the xml to PDF. Why XSL FO is the approach to create the PDF. Golly, you *are* persistent. XSLFO processors have the task to layout your text structure as described by XSL FOs onto pages. That's a much more complex task than most people are aware of. Now anyone kindly tell me Can I write xsl's to create my xmls directly to PDF 1.1 or higher. You can, at least in principle. Get the PDF spec http://partners.adobe.com/asn/developer/acrosdk/docs/PDFRef.pdf and go ahead. Be warned: it's no fun at all unless you're actually trying to achieve something very simple (fixed width fonts, page and font sizes known in advance etc.) It's likely to be messy in XSL even then. You won't get *any* help from either this or the XSL list on PDF specific questions. You may look at the FOP sources or at a TEX-distribution (http://www.tug.org) to get an impression what difficulties you might encounter. HTH Joerg Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Antwort: Fop speed improvements
Hi all, I'm generating a pdf from a servlet and although it's very easy to use, it's VERY slow and causes the browser to raise a timeout exception. I'm using a Pentium III 500 + 500 Mb + jdk1.3 machine and it takes 5 minutes to get a 2 pages document with no graphics, just one big table with 5 columns... Am I doing something wrong or fop is not ready for real-life ? FOP is not generally slow but under certain circumstances. Try to use the FOP command line application to render your PDF and watch the output. If you get lots of overflows, indicated by a or an INFO: line, you'll have to fiddle with column widths and maybe hyphenation to make this go away. You may also want to check keep-together attributes and such stuff that could cause FOP to iterate. If you could publish your FO file, preferably trimmed down to the a small part which is still slow, this would help to analyze the situation in more detail. (Please don't send a Megabyte file to the list!) HTH Joerg Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Antwort: Making a native win32 binary out of FOP
There appears to be a way to package the MS JVM together with some Java classes into an .exe. Mr. Kay (http://saxon.sourceforge.net/) does this for his Saxon XSLT processor. Maybe he is willing to help (he is also very busy, so be patient) Freundliche Gruesse Joerg Pietschmann ___ Zuercher Kantonalbank LIS4K / Geschaeftshaus Hard E Tel. +41 (0)1 275 85 03 Fax +41 (0)1 272 79 12 Briefe an: Postfach, 8010 Zuerich E-Mail:[EMAIL PROTECTED] Internet: http://www.zkb.ch Thomas KæregaardAn: [EMAIL PROTECTED] thk@vigilantKopie: e.com Thema: Making a native win32 binary out of FOP 10.10.01 10:19 Bitte antworten an fop-dev Hi List. I would like to distribute FOP with my application, but I don't want to force people to install 5,4 MB worth of JRE. Do any of you have experience regarding translation of FOP into an .exe-file (+ some .dll's probably) that will run directly from a win32 platform? Some sort of Java-win32 wrapper is acceptable, as long as it doesn't force us to install the JRE. Thanks in advance. - Thomas Kæregaard, Denmark - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Antwort: Performance
Joe Batt [EMAIL PROTECTED] wrote: Joerg, What did you mean by this -- FOP is not generally slow but under certain circumstances. Try to use the FOP command line application to render your PDF and watch the output. If you get lots of overflows, indicated by a or an INFO: line, you'll have to fiddle with column widths and maybe hyphenation to make this go away. You may also want to check keep-together attributes and such stuff that could cause FOP to iterate. -- I had no idea that all those ''s meant something. It's documented somewhere. If '' appears, it means that the processor encountered difficulties while laying out a page and that your output might look ugly or at least not as you planned. What do you mean by overflows? What do you mean by 'cause FOP to iterate'? Simplified and from hazy memory: A FO processor reads the FO input, then it tries to determine where on the pages which text and graphics has to be placed. In order to achieve this, the text and graphics is placed in little boxes, and constraints for their size and position are determined from the structure and attributes of the FO in the source. It may be somewhat difficult or even impossible to determine the size of a box around a particular text snippet. For example, if you have a table with a column 20pt wide, and a cell in this column with averyveryveryveryveryveryloongword, which, when rendered, is wider than the column width. This is called overflow. There are other overflows possible when the processor places tentatively a text box at a certain place, and finally discovers the text doesn't fit the box, for example a table cell which is placed near the bottom of a page and which contains a block with a lot of text. Rather then breaking the page in the middle of the block, it is spilled over to the next page. There are situations where you can make it very difficult for the processor, for example by including a graphic higher than the page body. Because it won't fit ever, the processor tries to spill it onto the next page until it runs out of memory... I'm seeing a 30-100 page table generated in 5-15 minutes and frequently running out of memory even though I set the heap size to 1GB. I had this symptom too when i started. Check whether you generate table cells which are approaching the height of a page, either by having a lot of text in it or by including a lot of space. FOP appears to be unable to split table cells, probably because it requires the content of a table cell wrapped in a single fo:block (some comments from the developers?) You could try: - Enable hyphenation: fo:block hyphenate=true language=en or something. This will fit more characters on a line and may thereby reduce table cell height. - Split long texts over multiple rows, thereby ease the task of FOP to fit the cells onto a page. Not exactly easy to solve in general, but your data may permit a simple solution (for example if long texts appear only in a certain column). If you really have difficulties and you cannot hire a more advanced expert, you'll probably have to study the XSL-FO specification and the FOP documentation in detail by yourself in order to get further hints. And, well, FOP is not exactly programmed to use as little space as possible. Stuff is copied a lot and often still hangs around in memory long after it isn't needed anymore, though this improved with 0.20's stream rendering. Joerg Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Antwort: ERROR: The entity eacute was referenced, but not declared.
It depends where you use it. The file where it is contained in must have a DOCUMENT declaration which contains or refers to a proper entity declaration. This may be inconvenient (though not impossible) in the XSL file, you may use the numeric representation (for example #xE9;) in this case. HTH Joerg Pietschmann |+--- || MEMMADI Said | || said.memmadi-renexter@re| || nault.com | || | || 10.10.01 16:11 | || Bitte antworten an | || fop-dev | || | |+--- | | | | An: [EMAIL PROTECTED] | | Kopie: [EMAIL PROTECTED] | | Thema: ERROR: The entity eacute was referenced, but not declared. | | Hi, Whre I must declare eacute ? xml file or xsl file ? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
FOP in WebSphere and some general notes (Was: Re: Using FOP in Servlet)
Karen Lease wrote: Configuration.put(baseDir, SOMEURLSTRING); Thanks. I meanwhile figured it out that i could use SOMEURLSTRING=file:+xslFileName Some other notes on FOP 0.20.2 in general and using in in an IBM WebSphere Server in particular (including problems actually caused by Batik): - IBM has their own Logging mechanism (though it's primitive). Using LogKit is of no real use for me, it just forces me to put logkit.jar in the classpath which noticable increases startup time (invconvenient in development only, but i *am* developing...). Could you use an lightweight interface which belongs to a FOP package, and an default implementation which dispates to an LogKit logger? Something like the ErrorListener class in JAXP. I could then provide my own implementation to the interface without having to pull in the whole LogKit. This would also make for an much better separation of the libraries, there would be just one class in FOP which uses LogKit stuff in the delegation and setup routines. - Something similar goes for the avalon framework. I thought i could avoid putting the jar in the classpath by not using the Driver class, but it still goes in by a remarkably twisted way: somewhere during SVG rendering in Batik a batik.bridge.BridgeContext is created, which quite unnecessarily creates a (Batik) DocumentLoader (there is no document because FOP gets the XML already as SAX event stream), which in turn gets a XML Parser name from the SVGUserAgent supplied by FOP which gets it from the fop.apps.Driver class. While the primary fault is in Batik which should create stuff more lazily (you may forward this complaint!), i don't think the fop.apps.Driver should act both as central repository for configuration settings and be an Avalon loggable at the same time. In fact i'd like to have an interface to FOP which resembles slightly more the XSLT TransformerFactory/ Transformer interfaces, with setting parameters using a Parameters object like Java Mail mixed in. The framework stuff including setting up a LogKit logger and and all that could be build around that. If this catches your curiosity, ask me to write up a more complete specification. - There is a unfortunate problem with Batik and the IBM class loaders. In Websphere, there is an ApplicationServer, a JVM running in its own OS process, which can contain several WebApps. Each WebApp may have its own classpath settings. At first i added batik.jar (and all other jars) to the WebApp specific classpath. Several Batik classes have static class variables which register some stuff in the AWT run time at class load time. If there is more than one WebAbb using Batik, directly or indirectly, the first WebApp has no problems, but the WebApp coming second gets errors roughly like instance NNN of class name exists. I got around this by adding the jars to the ApplicationServer classpath, where they really belong (but this is awkward without permission to mangle the server startup files). Some minor points: - In fop.apps.Driver, the _areaTree variable and related imports and statements appear to be defunct and can probably be deleted. - FOP gets a null pointer exception if there is no default namespace and an element without a namespace prefix slipped into the input. This is because in fop/fo/FOTreeBuilder.java Line 218: HashMap table = (HashMap)fobjTable.get(uri); fobjMaker = (FObj.Maker)table.get(localName); table is null. I believe this also happens always if the namespace URI is not recognized. - The PixelToMM factor (0.35277...) is repeated remarkably often in the source. Regards J. Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Using FOP in Servlet
Hello, i use FOP in a servlet together with the Saxon XSL processor. I implemented the communication between the processors as a SAX event stream. The following code snippet was developed with FOP 0.20.1, i think with 0.20.2 i could use the Driver again but i don't want to bother with this yet. Transformer transformer=getTransformer(xslFile); // setup FOP org.apache.fop.system.BufferManager bufferManager =new org.apache.fop.system.BufferManager(); org.apache.fop.fo.FOTreeBuilder treeBuilder =new org.apache.fop.fo.FOTreeBuilder(); treeBuilder.setBufferManager(bufferManager); org.apache.fop.fo.ElementMapping mapping; mapping=(org.apache.fop.fo.ElementMapping)Class.forName( org.apache.fop.fo.StandardElementMapping).newInstance(); mapping.addToBuilder(treeBuilder); [ more mapping code lifted from Driver.java snipped ] org.apache.fop.apps.StreamRenderer streamRenderer = new org.apache.fop.apps.StreamRenderer(out, new org.apache.fop.render.pdf.PDFRenderer()); treeBuilder.setStreamRenderer(streamRenderer); [ setting up log snipped - a nightmare! ] // the transformer gets its input data wia a customized XMLReader // from the servlet parameters transformer.transform(new SAXSource(new DocXMLReader(), new DocServletParameterInputSource(req)), new SAXResult(treeBuilder)); byte[] content = out.toByteArray(); res.setContentType(application/pdf); res.setContentLength(content.length); res.getOutputStream().write(content); res.getOutputStream().flush(); The problem i want help about is the exception [ERROR]: Could not set base URL for svg java.net.MalformedURLException: no protocol: at java.net.URL.init(URL.java:473) at java.net.URL.init(URL.java:376) at java.net.URL.init(URL.java:330) at org.apache.fop.svg.SVGElement.layout(SVGElement.java:143) at org.apache.fop.fo.flow.InstreamForeignObject.layout(InstreamForeignObject.java:198) at org.apache.fop.fo.flow.Block.layout(Block.java:259) Fortunately, the file renders fine, the missing information is aparently not needed. The SVG is defined in the XSL file. How do i set the base URL for the SVG element, just in order to pacifiy the software? Should i use a real file name (for example the name of the XSL file) or is it sufficient to use ? J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]