Simple SVG path doesn't render at all with FOP 1.0

2012-12-19 Thread Abel Braaksma
Hi List,

I'm trying to get an SVG logo on a pageusing fo:instream-foreign-object,
but all I got was total nothingness. So I trimmed down the example and
after some experimenting, I got it working with svg:rect, but as soon as
a svg:path turned up, it didn't get rendered.

Does anybody know of this issue? Or am I simply missing something? I'm
using FOP 1.0 with Batik 1.7.From a long time ago I remember I had
something similar and that I needed to setup a viewport or coordinates
translation or something, but I can't find the example I had back then.

This is a rectangle drawn by svg:path, which doesn't work:

   svg xmlns=http://www.w3.org/2000/svg;
  width=40px height=40px
  path style=stroke:black; stroke-width:2; fill:red
 d=M 20 390 L 80 390 L 80 410 L 20 410 Z /
   /svg

Any helpis appreciated,

Thanks,
Abel Braaksma


Re: fop turorial

2010-11-22 Thread Abel Braaksma

Hi LuxInteg,

For converting docbook, you shouldn't use FOP, but an XSLT processor. 
Consider XSLT 2.0, for instance with Saxon 9 (open source version 
available, very stable, continously maintained and updated). This part 
of the process should convert the XML to XSL-FO. Search for books by 
Tennison, she wrote excellent tutorial books on XSLT. For reference, 
there's only one and it's rather good: XSLT 2.0 and XPath 2.0 
Programmer's Reference by Michael Kay.


For converting XSL-FO to PDF or HTML, you can use FOP, which is only 
capable of dealing with XSL-FO. For learning XSL-FO there are some books 
available, try Amazon.


One step you already took: becoming a member of the FOP list. In 
addition, consider becoming a member of the XSL mailing list as well, 
this includes XSL-FO.


Kind regards,
Abel Braaksma


On 22-11-2010 1:10, luxInteg wrote:

Greetings,

I want to learn to use fop.  My fiirst tutorial would be a) to convert
dockbook files  xxx.doobbook  to html aand b) to pdf
  I would be grateful for  some advice

sincerely

luxInteg

-
To unsubscribe, e-mail:fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail:fop-users-h...@xmlgraphics.apache.org




Re: fop beginners tutorial

2010-11-22 Thread Abel Braaksma
This is a copy of the mail sent an hour ago by the user luxInteg, 
title fop turorial. Please use one name and don't repeat your 
requests. Be patient, we're all volunteers.



Abel


On 22-11-2010 2:23, bv wrote:

Dear All,

I want to learn to use fop.  My fiirst tutorial would be
a)to convert dockbook files
xxx.doobbook  to html and
b) to pdf

  I would be grateful for  some advice

sincerely
bv

-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org




Re: fop turorial

2010-11-22 Thread Abel Braaksma

Hi LuxInteg,

For converting docbook, you shouldn't use FOP, but an XSLT processor. 
Consider XSLT 2.0, for instance with Saxon 9 (open source version 
available, very stable, continously maintained and updated). This part 
of the process should convert the XML to XSL-FO. Search for books by 
Tennison, she wrote excellent tutorial books on XSLT. For reference, 
there's only one and it's rather good: XSLT 2.0 and XPath 2.0 
Programmer's Reference by Michael Kay.


For converting XSL-FO to PDF or HTML, you can use FOP, which is only 
capable of dealing with XSL-FO. For learning XSL-FO there are some books 
available, try Amazon.


One step you already took: becoming a member of the FOP list. In 
addition, consider becoming a member of the XSL mailing list as well, 
this includes XSL-FO.


Kind regards,
Abel Braaksma


On 22-11-2010 1:10, luxInteg wrote:

Greetings,

I want to learn to use fop.  My fiirst tutorial would be a) to convert
dockbook files  xxx.doobbook  to html aand b) to pdf
  I would be grateful for  some advice

sincerely

luxInteg

-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org




Re: fop turorial

2010-11-22 Thread Abel Braaksma

Please don't send it CC to me, just send it to the FOP list.

No idea why you add gnome to the discussion, is it a joke? If not: it 
has nothing to do with any of the subjects here, afaik. Search in Google 
for xslt list (without quotes) and visit the first result: Mulberry 
Technologies hosts the XSLT/XSL-FO list and there's only one such on the 
internet.


Abel



On 22-11-2010 16:24, bv wrote:

On Monday 22 November 2010 11:07:06 Abel Braaksma wrote:


One step you already took: becoming a member of the FOP list. In
addition, consider becoming a member of the XSL mailing list as well,
this includes XSL-FO.

A quick search shows there are quite a few such lists  I found the one for
'gnome'  but since I am not using  gnome  I am   wondering if its not too
gnome-centric.  So I would be grateful if you could suggest the recomended
(generic)  one  with url  please.


sincerely
luxInteg

-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org




-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



Re: Looking for help, including consulting, with font selection

2010-01-04 Thread Abel Braaksma
I'm under the impression that Benson means selection strategy based on 
availability. Suppose the A is available in Candara, but the other 
letters/symbols are not, and the needed font selection strategy is 
character by character then the result must be similar to what you 
wrote, but automatically so. According to 
http://xmlgraphics.apache.org/fop/trunk/fonts.html#selection this is not 
implemented yet.


Note that auto (which is implemented) means the selection criterion 
is implementation defined. For FOP that means (afaik) that word 
boundaries and element boundaries work and that the largest portion of 
a text or word that's available in a particular font will be chosen. In 
the example above, the Gothic font will be used, because that has the 
largest part of the word/text.


Changing to character-by-character means that each character is 
considered individually.


Naturally, if Candara would contain all capital letters only, choosing 
character-by-character in the following:


  fo:inline  font-family=Caldara, 'Century 
Gothic'A=E3=81=82/fo:inline


then the rendering with character-by-character would be equivalent with 
the following:


  fo:inline  font-family=CaldaraA/fo:inline
  fo:inline  font-family='Century Gothic'=/fo:inline
  fo:inline  font-family=CaldaraE/fo:inline
  fo:inline  font-family='Century Gothic'3=81=82/fo:inline

Obviously, either this or the original example from Benson cannot be 
achieved with current means (unless you add some rather prolific XSLT 
2.0 preprocessing, i.e., give it a list of fonts and do the selection 
strategy in the earlier processing step, using some home-brewed 
extension functions, which could be a possible alternative while waiting 
for the implementation).


Cheers,
Abel


Jason Harrop wrote:

I don't have a font called MS Gothic on my XP / Word 2007 PC, so
i've used Century Gothic instead, but subject to that, and assuming
the relevant fonts are available, isn't this just:

fo:block
fo:inline  font-family=CandaraA/fo:inline
fo:inline  font-family=Century Gothic=E3=81=82/fo:inline
/fo:block

with a config such as:

fop version=1.0
strict-configurationtrue/strict-configuration
renderers
renderer mime=application/pdf
fonts
font embed-url=file:/C:/WINDOWS/FONTS/CANDARA.TTF
font-triplet name=Candara style=normal
weight=normal/
/font
font embed-url=file:/C:/WINDOWS/FONTS/GOTHIC.TTF
font-triplet name=Century Gothic style=normal
weight=normal/
/font
/fonts
/renderer
/renderers
/fop

cheers .. Jason


  


-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



Re: Looking for help, including consulting, with font selection

2010-01-04 Thread Abel Braaksma
Can you clarify? Because that's precisely what I wrote. Perhaps we have 
some misunderstanding on what the font-selection-strategy means and/or 
what picked means (who picks what by what criteria?).


Can you provide a simple input (XML) output (XSL-FO) example that 
currently renders incorrectly, but which is a little bit more elaborate 
then the A=E3=81=82 string example? I.e., how would you deal with the 
selection of the font and what do you expect FOP to do for you?


Benson Margulies wrote:

We don't want to specify fonts char-by-char, we want them picked.

On Mon, Jan 4, 2010 at 7:35 AM, Abel Braaksma abel.onl...@xs4all.nl wrote:
  

I'm under the impression that Benson means selection strategy based on
availability. Suppose the A is available in Candara, but the other
letters/symbols are not, and the needed font selection strategy is
character by character then the result must be similar to what you wrote,
but automatically so. According to
http://xmlgraphics.apache.org/fop/trunk/fonts.html#selection this is not
implemented yet.

Note that auto (which is implemented) means the selection criterion is
implementation defined. For FOP that means (afaik) that word boundaries and
element boundaries work and that the largest portion of a text or word
that's available in a particular font will be chosen. In the example above,
the Gothic font will be used, because that has the largest part of the
word/text.

Changing to character-by-character means that each character is considered
individually.

Naturally, if Candara would contain all capital letters only, choosing
character-by-character in the following:

 fo:inline  font-family=Caldara, 'Century Gothic'A=E3=81=82/fo:inline

then the rendering with character-by-character would be equivalent with the
following:

 fo:inline  font-family=CaldaraA/fo:inline
 fo:inline  font-family='Century Gothic'=/fo:inline
 fo:inline  font-family=CaldaraE/fo:inline
 fo:inline  font-family='Century Gothic'3=81=82/fo:inline

Obviously, either this or the original example from Benson cannot be
achieved with current means (unless you add some rather prolific XSLT 2.0
preprocessing, i.e., give it a list of fonts and do the selection strategy
in the earlier processing step, using some home-brewed extension functions,
which could be a possible alternative while waiting for the implementation).

Cheers,
Abel


Jason Harrop wrote:


I don't have a font called MS Gothic on my XP / Word 2007 PC, so
i've used Century Gothic instead, but subject to that, and assuming
the relevant fonts are available, isn't this just:

   fo:block
   fo:inline  font-family=CandaraA/fo:inline
   fo:inline  font-family=Century
Gothic=E3=81=82/fo:inline
   /fo:block

with a config such as:

fop version=1.0
   strict-configurationtrue/strict-configuration
   renderers
   renderer mime=application/pdf
   fonts
   font embed-url=file:/C:/WINDOWS/FONTS/CANDARA.TTF
   font-triplet name=Candara style=normal
weight=normal/
   /font
   font embed-url=file:/C:/WINDOWS/FONTS/GOTHIC.TTF
   font-triplet name=Century Gothic style=normal
weight=normal/
   /font
   /fonts
   /renderer
   /renderers
/fop

cheers .. Jason



  

-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org





-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



  


-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



Re: Looking for help, including consulting, with font selection

2010-01-04 Thread Abel Braaksma
To recap: apparently the problem was that for individual letters not 
available in a font, the wrong selection was made, resulting in the 
question mark (for missing letter) appearing.


While this was apparently fixed, note that character-by-character is 
still not supported. Meaning, in AXB, where X is a Japanese (or other) 
character not available in font Candara (or other), but available in MS 
PMincho, it will still display as a question mark. Change it to A X B 
and it should work.


If your only issue is with Japanese text, this can easily be solved in 
the XSLT step (using codepoints ranges), in case you have this type of 
exceptional cases in your text.


Good to know that the issue is solved, Pascal.

-- Abel --

Pascal Sancho wrote:

Hi Benson,

What you need is implemented in FOP TRUNK.
See [1] for further details.

I'll close the bug since I cannot reproduce it in FOP TRUNK, but you 
feel free to reopen.


[1] 
http://xmlgraphics.apache.org/fop/trunk/fonts.html#truetype-collections-metrics 



Pascal

Benson Margulies a écrit :

Please see bz https://issues.apache.org/bugzilla/show_bug.cgi?id=48481.

On Mon, Jan 4, 2010 at 7:46 AM, Abel Braaksma abel.onl...@xs4all.nl 
wrote:
 
Can you clarify? Because that's precisely what I wrote. Perhaps we 
have some

misunderstanding on what the font-selection-strategy means and/or what
picked means (who picks what by what criteria?).

Can you provide a simple input (XML) output (XSL-FO) example that 
currently

renders incorrectly, but which is a little bit more elaborate then the
A=E3=81=82 string example? I.e., how would you deal with the 
selection of

the font and what do you expect FOP to do for you?

Benson Margulies wrote:
 


-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



Re: Looking for help, including consulting, with font selection

2010-01-04 Thread Abel Braaksma
Am I correct in understanding that list that character-by-character is 
indeed not supported?


I'm not sure what change was responsible for fixing this particular 
issue though, doesn't seem to be mentioned...


Pascal Sancho wrote:
The URL given in my previous mail was a bit out of topic: this was 
about TTC fonts usage.

Here is the good one: list of changes in font subsystem.
http://xmlgraphics.apache.org/fop/changes.html#Changes+to+the+Font+Subsystem 



Pascal

Pascal Sancho a écrit :

Hi Benson,

What you need is implemented in FOP TRUNK.
See [1] for further details.

I'll close the bug since I cannot reproduce it in FOP TRUNK, but you
feel free to reopen.

[1]
http://xmlgraphics.apache.org/fop/trunk/fonts.html#truetype-collections-metrics 



Pascal

Benson Margulies a écrit :
 

Please see bz https://issues.apache.org/bugzilla/show_bug.cgi?id=48481.




-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



Re: Looking for help, including consulting, with font selection

2010-01-04 Thread Abel Braaksma
It concludes what was said. And Pascal's remark is about the issue that 
was solved. But you try it with FOP Trunk and decide whether it is 
sufficiently solved. If not, provide a reproducible example 
(reproducible with the latest build) .


My talk about character-by-character is a known issue and is unrelated 
to your bug report and is sufficiently covered on other places.


Benson Margulies wrote:

Does this add up to a reason to reopen the bz?

On Mon, Jan 4, 2010 at 11:19 AM, Pascal Sancho pascal.san...@takoma.fr wrote:
  

Abel Braaksma a écrit :


To recap: apparently the problem was that for individual letters not
available in a font, the wrong selection was made, resulting in the
question mark (for missing letter) appearing.

  

No, FOP replaces missing characters # character. I suspect a wrong
character selection


While this was apparently fixed, note that character-by-character is
still not supported. Meaning, in AXB, where X is a Japanese (or other)
character not available in font Candara (or other), but available in MS
PMincho, it will still display as a question mark. Change it to A X B
and it should work.

If your only issue is with Japanese text, this can easily be solved in
the XSLT step (using codepoints ranges), in case you have this type of
exceptional cases in your text.

Good to know that the issue is solved, Pascal.

-- Abel --
  

Pascal

-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org





-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



  


-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



Re: Table paging

2008-07-16 Thread Abel Braaksma

Max,

Please do not cross-post equal messages to different lists, as many of 
us are members of both. This message is also found on the xsl-list of 
Mulberry Tech (where I just requested some more explanation and I 
suggest to continue the discussion there).


Cheers,
-- Abel --

Max wrote:

Hi there I'm new to this list. *waves*
I'm using fop 0.95beta and jdk 1.4. I have some html style table code 
which is transformed into xsl:fo using xslt. That all works fine, 
except I'm trying to fill the left column before the right column and 
both of them before the data spills onto the next page. I can change 
the way xml is generated if necessary and I can change the xslt too. I 
imagine that changing the xslt is the way to go.


Max



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Problem with Asian Language fonts

2008-07-09 Thread Abel Braaksma

Rakesh Kumar S wrote:

Thanks a lot John...
it worked fine...

Now should i do this conversion every time ...
Because XML stores this as amp; but i need this as  while converting as PDF


XML does not store anything (XML is a meta language and does not have 
actions on its own). Your problem is either when you store it to the 
database (you say that you escape the data) or when you retrieve it back 
(using Castor, as you stated in your original question). At some point, 
you have a character, say € (euro symbol), it gets escaped to #128;, 
which gets escaped to amp;#128; (a second escape which is not proper). 
It may even be escaped one more time, storing it in the database as 
amp;amp;#128;.


To get out of this mess do the following:

1. Always check your data using a text editor (DO NOT USE A BROWSER TO 
VIEW XML!)

2. Make sure you do not escape at all anymore (!!!)
3. Before storing it in the database, use XSLT (or a tool) to store the 
XML as XML with encoding US-ASCII, this will effectively escape all 
higher characters (above ASCII 127).
4. When retrieving it from the database, either do nothing (use the XML 
with the encoding US-ASCII should be just fine to Apache FOP or any 
other XML capable process), or transform it to XML with encoding UTF-8 
for readability. Most (XSLT/tool) processors will remove the entities to 
their UTF-8 character counterparts, but they are not required to do so!


Regardless: do not escape by hand, only use XML tools and set the 
encoding to something your database can store. That way, you do not have 
to worry about silly double / triple up or down conversions.


HTH,

Cheers,
-- Abel --

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: counting items with nonempty content (except html)

2008-06-10 Thread Abel Braaksma


Hi Maxmus,

answer below:


maxmus wrote:
Hallo, 
I have the following situation:


i want to count all items in an XML file with the following properties:
attribute1 has a certain value and attribute2 is not empty.

xsl:variable name=num select=count(//[EMAIL PROTECTED] = 'value1' and
normalize-space(@attribute2)!=''])/
...
xsl:if test=$num gt; 0xsl:value-of select=@attribute2//xsl:if
..

the code works fine but there is one exeption:
if attribute2 contains only html tags (e.g.
attribute2=lt;bgt;lt;/bgt;),
then normalize-space(@attribute2) returns true,
but xsl:value-of select=@attribute2/ of course gives .
  


No, this is not of course. In fact, it is the opposite. The 
@attribute2 of your source contains a character string, not HTML tags 
(note that XSLT cannot see tags, it only sees nodes, and inside an 
attribute that are never nodes).


Obviously, the character string seems to contain, once unescaped, a part 
of HTML (or XML for that matter). So, the string is full, i.e., non-empty.



For several reasons, I have to use this structure and I can't change the XML
file.
  


That's a bummer, because putting HTML stringized into attributes is bad 
design. It leaves you no way to check for validity of the content and 
makes parsing hard, if not very hard or sometimes next to impossible (as 
you are finding out).



So is there any possibility to count all tags with the property
attribute1 has a certain value and attribute2 does not RETURN empty (if
displayed).?


No. You're talking of the transformation phase here, not the formatting 
phase. There's no way the transformation phase (which comes way before 
the formatting phase) can know up front that a particular character 
string would display empty.


And what is empty? Is that a bunch of br /br /? Or is that 
p160;/p? Or is that img src=notfoundsource / or is that div 
style=display:noneSome text here/div?


Though it might seem a trivial question (give me all elements that 
won't be visible) it is very hard to resolve, even if you would have 
the power of JavaScript and browser extensions at your fingertips, which 
you don't, because you are using XSLT.


What you might do, though I can't really recommend it, is parse the 
content of the HTML-strings with an XSLT extension (for one, Saxon has 
saxon-parse(), which parses a string containing XML) and then do your 
math on the resulting node set. But then it would still be far from trivial.


Bottom line is: you are trying to do something seemingly simple which is 
notoriously hard to solve and XSLT is the wrong place to do that. It 
should be changed at the source and not later on.


Btw: what's your use case that you want to strip stringized HTML that 
would 'return' empty, i.e., render invisible or spaces only? If you 
render it, it won't be visible, if you strip it, it won't be visible, so 
what's the catch?


Good luck,
-- Abel

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: FOP 0.20 Memory Leak?

2008-03-27 Thread Abel Braaksma

Jason Timmins wrote:


N-no, the problem is not with FOP, the problem is that I need to produce
documents really quickly for high-volume PS printers. My .NET app produces
the raw XML and uses Saxon to create the XLS and FOP to turn it into PS. The
problem is that if I fire up the Java VM for Saxon and then again for FOP,
document creation takes 7 seconds (way too slow.) If I turn those two
packages into .NET assemblies and avoid the start-up delays of the Java VM,
document creation times fall to 2 seconds as everything is in the same .NET
execution environment.

If you can tell me how to keep Saxon and FOP running whilst I push large
amounts of XML documents through them, I'd gladly give it a try.
  


You are making things way too complicated for yourself. FOP is a Java 
app, Saxon is a Java app (it is available as .NET but that's an 
automated port, not a .NET optimized version). Having two Java apps and 
calling them from IKVM makes things both slow and complicated at the 
same time. Unless there's a compelling need for you to use .NET for your 
transformations (you mention using IIS) why not call both Saxon and FOP 
by code? It's plain and simple, even when you have limited knowledge of 
Java. And you don't need to exit the JVM anymore. This has two main 
benefits: you gain speed (perhaps a lot!) and your application becomes 
easier.


And while your at it, you might as well upgrade to a newer version of 
FOP, since yours is really ancient.



Which is why I'm asking. It might be Saxon or something in IKVM that leaks.
  


Or you just do not destroy your objects IIS + .NET is known for its 
late garbage collection, but when references stay open, it won't garbage 
collect at all.


  

Does .NET not have good tools to track down memory leaks?



Not that I'm aware of. The problem is complicated by it running as a web app
in IIS. It's the IIS worker process that grows until it get's too big and is
recycled.
  


There are a zillion tools to track down memory leaks (try google, both 
free and commercial). But why trying the hard way when you can solve 
things easily by switching gears?


HTH,
Cheers,
-- Abel Braaksma

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: FOP 0.20 Memory Leak?

2008-03-27 Thread Abel Braaksma

Jason Timmins wrote:


I don't know how to do that but, if you're telling me I can call Java
methods straight from .NET without the delays associated with starting-up
the Java VM, then I'd gladly try that.
  


There're samples of how to set up a simple web service that can do the 
trick. There are several ways to set this up, the easiest already 
mentioned by Jeremias Maerki.



The only reason I have to use Saxon is that Microsoft don't have an XSLT v2
implementation. They seem focused on their LINQ technology at the moment so
the word is 'no XSLT v2 for now.'
  


There are two alternatives to Saxon (though I do believe that Saxon is 
the most mature currently): AltovaXML free commandline xslt2 processor 
and Colin's Gestalt XSLT 2.0 processor, open source, built with Eiffel. 
In my experience, the latter has the shortest startup time when run as 
an executable. But embedding an executable inside a web app can be hard 
and non-trivial to do correctly.


That said, Saxon is the only one that comes natively as a .NET processor.

Your story about MS not doing XSLT 2.0 is not right. They have spread 
the word about half a year back that they started development for an 
XSLT 2.0 processor. It is only a matter of time. In Michael Kay's words, 
it takes about 1 to 2 years to built a stable processor, depending on 
the team and the money available of course (meaning: it won't be there 
tomorrow).


It's plain and simple, even when you have limited 
knowledge of 
Java. And you don't need to exit the JVM anymore. This has two main 
benefits: you gain speed (perhaps a lot!) and your 
application becomes easier.



No doubt but I have to stay with .NET as the rest of the site is .NET-based.
  


Without wanting to sound harsh: that's really not a good reason to stick 
to a certain technique, you're locking yourself in, keeping the better 
options out. Using a technique that best suits its purpose or that's 
best at a certain job is a much more viable option then trying to bend 
the iron by hands...


  
And while your at it, you might as well upgrade to a newer version of 
FOP, since yours is really ancient.



Ahh, well, I've been holding-off upgrading because my XSL design tool,
XSLFastm uses FOP 0.20.5 to render to PDF as a preview. I thought it only
logical to stick with 0.20.5 until XSLFast switches to using the latest
version of FOP. I can't have my development tool showing one thing and what
gets printed being something different. That's one headache I can live
without.

Also, in my current environment I'd have to translate FOP 0.9X into a .NET
assembly and I'm not looking forward to that.

  


If you change your mind on that last subject: I just spoke to XSLFast's 
Jens Thiemann, you may have heard of him, and he assured me that it is 
only days before they will start shipping a new version with full 
support for FOP 0.93 and up. And if you contact him directly using 
[EMAIL PROTECTED], he can give you an early copy of the product.




Oh man, if only it were that simple. I've never written code the cleans
itself up so well as this app! I 'dispose' of every object and data
structure I use. I can say with reasonable certainty, it's not crappy code
in my .NET world. :-)
  


Well, that's good to hear. Of course, any .NET application uses external 
libraries, so if it isn't your code for sure, it can be something else. 
In the past I've successfully used DevPartner by Compuware (then 
Numega). I don't want to sing the praises of DevPartner here as then I 
should make a sound comparison to other products as well. However, I 
mention it because it gives very good per-object, per reference analysis 
of what's been kept in memory (and a lot more, like how long each method 
takes, how often it's called etc) and how much memory each object takes.


But it doesn't come free, worse yet, I don't believe it is very cheap... 
yet it can save you tons of hours of work which makes such a product 
worthwhile (or any of its competitors of course).


Hope these hints help you a bit further,

Cheers,
-- Abel Braaksma

PS: you can check the Saxon list for some mentioning of memory leaks. 
There aren't many and most are fixed, but it may give you a hint. Make 
sure to use the utter latest edition of Saxon as it is constantly 
improved for performance and bugs.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Printing issue

2008-01-25 Thread Abel Braaksma

[EMAIL PROTECTED] wrote:


There are some command line pdf printing tools available commercially. 
And also some java api. But I dont find any open source or some sort 
of free tool for this.


I am specifically looking for some tool which does not require any 
user intervention. It should not show any popup or dialouge boxes. It 
should happen silently in the background.




If you are on Windows, you can try this tool: 
http://www.geocities.com/dosprint. It is not free, but for $40 it won't 
make you go bankrupt, I hope ;)


HTH,
Cheers,
-- Abel Braaksma

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Vertical text

2008-01-24 Thread Abel Braaksma

Andreas Delmelle wrote:


The most clever way I can think of in pure XSL-FO to mimic that would 
be to inject linefeed-characters in the stylesheet, so it generates FO 
like:


fo:block 
linefeed-treatment=preservel#x0A;i#x0A;k#x0A;e#x0A;#x0A;t#x0A;h#x0A;i#x0A;s#x0A;./fo:block 




Should work nicely.
Another trick might be to make an fo:block sufficiently small and just 
add spaces between the letters.


-- Abel Braaksma

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Help! URI for fo:external-graphic in web service

2008-01-07 Thread Abel Braaksma

Jerome Munchenberg wrote:

Abel,

Thanks for such a comprehensive response! Much appreciated.

In the end it all got too hard, and after much experimentation, I
embedded the GIF in the XSL-FO using BASE64 encoding.

  fo:external-graphic
width=70mm
content-height=scale-to-fit
content-width=scale-to-fit
src=data:image/gif;base64,R0lGODlhhAl...
  .../

Worked a treat...


Nice to hear that. I wouldn't consider data: URIs to be easy (getting 
the GIF encoded is usually the hardest part as you cannot do that with 
straight XSLT), but if it works for you that's good ;)


Note that not all XSL-FO processors will support the data: scheme (but 
that can actually be true for just about any scheme, though currently 
http and file are supported by all of them) as it is much less common 
than http: and file:.


Cheers,
-- Abel Braaksma

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Help! URI for fo:external-graphic in web service

2008-01-06 Thread Abel Braaksma

Jerome Munchenberg wrote:

Hello,

I am developing a web service which returns a PDF generated by FOP
(fop-0.94) which must include an image. The web service is deployed as
an EAR to a WebLogic server, and the image to be inserted into the PDF
is contained within this EAR.
  


You might try the JAR scheme, but I am not sure whether that scales well 
to a EAR. Another option is to use the real filepath (you can get the 
real unpacked EAR location through your web application server 
interface, I believe), or a relative path (often it is quite easy to get 
the WEB-INF directory and go from there).


If all fails, the next easiest thing to do is to use the public URI 
which would also be accessible from your website to retrieve that same 
file. It is probably best to use localhost as server to prevent an extra 
server roundtrip.


If you don't like any of these scenarios because of their lack of 
scalability, start using Catalogs (see OASIS website) and use a 
URIResolver (possibly with a specific scheme) to resolve the catalogs 
unambiguously regardless the platform / system / paths your services are 
running on.



How do I correctly access the image embedded in the EAR? I have been
able to use a file file path when testing on my own box, but this is
obviously unsuitable for other environments!
  


You were lucky that it worked, because if a file path is allowed, than 
that's a bug in the FOP implementation: XSL-FO prescribes that only a 
URI is allowed. To go from a filepath to a URI you should rewrite it 
something like file:///c:/project/scr/certificate.gif (note the 
forward slashes!).



src=C:\Project\src\au\com\aaa\services\certificate.gif


HTH,
Cheers,
-- Abel Braaksma


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Empty pdf more than 100k?

2007-12-06 Thread Abel Braaksma
Not sure whether this is applicable or not, but I have used Multivalent 
(http://multivalent.sourceforge.net/) in the past for re-ordering pages 
(from one-up to two-up etc) and often was surprised at the output being 
increasingly smaller, without loss of quality. Often I used it to assess 
whether a certain PDF could be made smaller at all and when the change 
was significant, I sometimes added it to the process.


You can use Multivalent just for decreasing / compacting file size of 
PDF. Test it to see if it works for you. The outcome may be of help for 
the programmers too, to know whether it is possible at all and to what 
level to decrease the size.


Cheers,
-- Abel Braaksma

Jeremias Maerki wrote:

I haven't done any experiments to prove it, but I suspect it has to do
with the table border painting. We've improved table border quality a
lot in 0.94 which causes increased size of the page content. If I take
one of the pages in between which have a large table the page content
size is three times as big in 0.94 as in 0.20.5:
page 13: 0.20.5: 5515 bytes, 0.94: 17012 bytes

I'm surprised at the amount of the increase. But I'm afraid I cannot do
anything about that for the moment.

On 05.12.2007 15:15:22 hammo wrote:
  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tools for reverse FOP?

2007-11-01 Thread Abel Braaksma

siegfried wrote:


Are there any tools that will accept a PDF and produce XML? Might this 
be a feature of FOP someday?


Thanks,

Siegfried



That's highly improbable, because PDF is a non-structured format and 
going from non-structured to structured is a daunting (and often 
theoretically and practically impossible) task.


There are tools that extract the text from PDF and there are tools that 
extract the images from PDF. And some create Word (iirc) and/or RTF with 
layout. Going from RTF to XSL-FO is then rather easy (rtf is text 
based), but it will get extremely bloated (check out the RTF when you 
have all options set, the RTF is will get huge already for a couple of 
pages!). Much of this has to do with the precise positioning inside pdf. 
Still many objects or properties cannot be extracted at all (borders, 
backgrounds, alpha channels, overlays, partially embedded fonts).


I don't see a reason why FOP would do such a thing (if PDF can be 
treated as input, than Word, RTF, TIFF, BMP etc should also be 
considered, I guess, which makes it next to impossible), it is such a 
specialized task (compare OCR) that other tools are better suited.


Hope this answers your question,

Cheers,
-- Abel Braaksma

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: The entity nbsp was referenced, but not declared.

2007-10-16 Thread Abel Braaksma

Murali Krishna wrote:

Hi Abel,
Thanks for reply.I've include the Doctype that you have prescribed and 
make

the html and xsl document well formed .The xalan commend processed the
file.But the generated fo file is a corrupted one and does not include 
any

xsl styling and when input to the FOP it generated a exception as
follows:Please find the attached xsl and html files used.
[Fatal Error] raj_test.fo:12:13: Content is not allowed in prolog.
javax.xml.transform.TransformerException: org.xml.sax.SAXParseException:
Content is not allowed in prolog.


Whenever you see that message, something is seriously wrong. It means, 
usually, that there's content which is not a comment, not a PI, and not 
an xml declaration before the root opening tag.


Though XSL requires XML as input, you can create any output (and only 
with XSLT 2.0 you can force a certain output format with validation, but 
you are using XSLT 1.0).


I didn't look through your XSL file yesterday. Considering the 
complexity, I assume you didn't make this XSL file yourself? But the 
stylesheet creator seems to have some misunderstanding on what XML 
Entities are for and when you need them and when not. The endless entity 
declarations inside the xsl:text are useless, they serve no purpose. 
Once you process a file with and XSLT processor, the processor will make 
sure the output XML will be valid UTF-8, containing all entities as 
characters.


Your input XML is still not _valid_ XML (don't you yet use an XML 
editor? It will save you a *lot* of trouble!), but it is well-formed and 
as such will be processed by the XSL processor.


However, since we converted it to XHTML and used its doctype, the 
namespace of the html nodes is http://www.w3.org/1999/xhtml; (this is 
either implicitly, by the doctype DTD, or explicitly, by setting it 
manually). Since the XSLT stylesheet does not use any namespace, you 
will have to declare it and use it. Unfortunately, you will have to add 
your chosen prefix to each and every XPath (this is an XSLT 1.0 feat, 
in XSLT 2.0, you don't need to anymore with xpath-default-namespace).


So you have basically three solutions:
 1. set the namespace in the XSLT so that it can find the matching elements
 2. remove the namespace in the XML source (by removing the XHTML 
declaration), but this means you will have to add the entity 
declarations manually
 3. like (1) but then with XSLT 2.0, just add xpath-default-namespace 
to the root stylesheet element.


I tried (3) and it works. Like I said in an earlier post, your awkward 
nbsp; scattered all over the place will not give you pretty PDF.


The output you saw (the corrupted output) was from the default 
template of the XSLT stylesheet (because no template matching rule 
satisfied), the one that is always there, even when you do not declare 
any template yourself. This is a very basic FAQ. Follow the link I gave 
you earlier and read around in the FAQ, or find some tutorial. I 
personally find Jeni Tenisson's books rather good as an introduction to 
XSLT.


HTH,
Cheers,
-- Abel Braaksma

PS: general XSLT questions are still best asked on the XSL list. This 
list is for FOP. You will find the people on the XSL list very helpful, 
esp. if you first visit the FAQ before posting.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: The entity nbsp was referenced, but not declared.

2007-10-15 Thread Abel Braaksma

Hi Murali,

You're mixing a couple of things up. For any input to be processed with 
an XSLT stylesheet, it must first of all by XML (that is: well-formed 
XML). If it it isn't well-formed, it cannot be processed (regardless of 
the application: any application that says it works with XML will only 
do so if it is well-formed).


Your input doesn't comply to the well-formed rules. The opening tag is 
not closed. The entities are not declared (it doesn't matter that they 
are inside a text block in some XSLT file, that is useless and won't 
make a source file compliant). One way to make the entities declared is 
by adding an html doctype. The best match, in your case, seems XHTML 
Transitional. Once you've declared it, you'll see that your XML (html) 
has some other oddities that make it invalid (i.e., a table tag inside 
a p tag, the html tag not closed, the head tag missing a title 
tag).


!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;

If you would choose something else than XHTML (i.e., one of the older 
html variants), it is a lot harder to also make the document XML 
well-formed.


Once you get the source straightened out, you can try to process it with 
an XSLT processor (and possibly also an XSL-FO processor after that).


If you do not have the possibility to alter the source, then there are 
tools around that make an educated guess at what the errant designer of 
the HTML might have wanted and transforms it into XHTML on the fly. 
These tools (I forgot the name at the moment) try to mimic the behavior 
of popular browsers in interpreting any input and always outputting 
something (but this is of course a path that may very well lead to 
unpleasant surprises).


If you have question regarding XSLT or XSL-FO I can advice you to try 
the excellent XSLT list at http://www.mulberrytech.com/xsl/xsl-list/. 
This list is more appropriate for Apache FOP related questions.


HTH,
Cheers,
-- Abel Braaksma



Murali Krishna wrote:

Hi,
I am trying to to transform HtML to FO file using xalan but while 
transforming i am getting this following  exception:-
Exception in thread main java.lang.RuntimeException: The entity 
nbsp  was referenced, but not declared.
 
Actually the HTML file is generated by an editor .and contains lots 
and lots of nbsp;
 
In the XSL file ,   lt;!ENTITY nbsp;   amp;#160;gt;  is 
already declared  within the xsl:text tags .So, what should I do 
now.Please  help! HTML and xsl files are attached with this mail.
 
Thanks in anticipation,
 
Murali Krishna 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Chinese characters in Times New Roman?

2007-10-10 Thread Abel Braaksma

J.Pietschmann wrote:

mblee wrote:

Is it possible to display chinese characters in Times New Roman font?  I
have been successful using arial unicode.


The usual arial unicode font contains glyphs for almost
all Chinese characters. If you find a Times New Roman font
with Chinese glyphs, then yes, it is possible to to display
chinese characters in Times New Roman font.
And if the reason you ask is because you'd like to have a choice, the 
free Code 2000 font contains even more (chinese) glyphs. And wasn't 
Everson also a font containing Chinese? Hmm, perhaps only hiragana/katakana.


Cheers,
-- Abel Braaksma

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: unparsed-text

2007-10-06 Thread Abel Braaksma

Raphael Parree wrote:

Abel,

Thanks for you reply. Indeed there are many other reasons why I am moving to
XSLT2.0...

I was thinking along the same lines as you...I also came to the conclusion
that the receiving SAXResult cannot parse the text I added. Using copy-of
escapes my fo file, so it unfortunately comes out the same way.


Very weird, to say the least. Any FO file is an XML file. The document() 
function can only handle XML documents. Using xsl:copy-of will copy 
exactly what is input. Can you give a snippet of how this about.fo file 
looks like? If it isn't XML the document() function will choke, but if 
it is XML and it contains, say, some CDATA element with content that 
looks like XML, than it is stringized XML, which cannot 
(straightforwardly) be interpreted as XML.


To find out, simply paste a part (or whole) of your about.fo file here 
and we'll have a look



 Perhaps the
xsl:character-map might solve this, I however do not see yet how I would use
that in conjunction with the copy-of...something to look into. What
obviously works is to save the result of the transformation as text (to a
StreamResult), and then use a SAXParser to parse the whole thing again to
FOP's SAX handler.
  


That wouldn't be the 'XML' or 'XSLT' way to do things and it will become 
awkward in the long run and with maintenance. Just paste your whole 
about.fo here and we'll see what can be done.


Cheers,
-- Abel Braaksma


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [ANN] Apache FOP 0.94 Released

2007-08-24 Thread Abel Braaksma
Congratulations to ya all! This is great news, I (and many with me, I am 
sure) eagerly awaited this release.


Particularly: the collapsing border model and the line breaking are of 
major importance for us, thanks a bunch!


Cheers to your excellent coding team,

-- Abel Braaksma

Vincent Hennebert wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

The Apache XML Graphics team is pleased to announce the release of
Apache FOP version 0.94.

This is the second production-level release after the big re-design
effort. It includes many bug fixes and new features, the most important
being:
- - auto-detection of the fonts installed on the system; the XML metrics
  generation is now optional;
- - support for the collapsing-border model in tables;
- - internal links in PDF now point to the exact location, and not to the
  top of the page;
- - support for UAX#14 type line breaking. This annex of the Unicode
  standard specifies rules for breaking text into lines depending on the
  language used.

The complete list of changes is available at
http://xmlgraphics.apache.org/fop/0.94/changes_0.94.html

FOP 0.94 implements the XSL-FO 1.1 recommendation to a high degree of
compliance. See the compliance page for a detailed overview:
http://xmlgraphics.apache.org/fop/compliance.html

For download information, see the following page:
http://xmlgraphics.apache.org/fop/download.html

For the XML Graphics team,
Vincent Hennebert
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGz0j4oHLU0ENYxYQRAmKVAJ9tE23zHcfjuaagjV8EGyRgrRYI+gCgiyDl
0bw8zrCWMvC3nbQeoKygo84=
=Xmgr
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OutOfMemory problem

2007-08-16 Thread Abel Braaksma

Hi Nicolas,

Use the -Xmx and -Xms startup options of the Java JVM to increase the 
heap size.


Note that in your code snippet below you do not take into account the 
encoding. This may result in encoding problems because Java chooses the 
default encoding based on system properties and that is not always UTF-8 
(and maybe your xml is not even in UTF-8). Make it explicit based on the 
encoding used in xml to avoid hard-to-track problems.


Cheers,
-- Abel Braaksma


Nicolas Baumann wrote:

hello,

I'm having a problem with a large xml flow with fop, generating an OutOfMemory 
exception.

i'm currently doing this :
Source src = new StreamSource(new ByteArrayInputStream(xml.toByteArray()));

what should I do to optimize memory ?

Thanks,
Nicolas.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Unable to create font metric file of Arial Unicode MS with fop 0.93

2007-08-16 Thread Abel Braaksma

xuan ngo wrote:

I doubt that my file is corrupted. I'm able to the
font in MS Word. The modified date on the font file is
January 12, 1999, 8:59:20 AM.

I did try with other font and it is processing without
error.

Do you know of other fonts that are supporting
unicode?


Yes. Try wikipedia, search for unicode. This will bring you to 
http://en.wikipedia.org/wiki/Unicode_typefaces#List_of_Unicode_fonts


Note that supporting unicode is *always* just a part of Unicode. The 
standard encompasses a whopping 98K+ characters and the font that has 
most glyphs as of this writing is the free Code2000 (51K+ chars) closely 
followed by Microsoft's New Gulim (46K+ chars), which is part of Office.


You'll probably need a font-analysis tool to find out whether your file 
is really corrupted or not. It doesn't say much that an application can 
access certain glyphs. Font metrics file creation accesses *all* 
characters/glyphs and any mistake in the file may cause it to crash.


Anyway, I do not know enough about the internals of TTF to help you 
found out whether the problem is in there or somewhere else.


Cheers,
-- Abel Braaksma

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: zero width space alternative for Arial

2007-08-15 Thread Abel Braaksma

Hi Matthias,

The best thing you can do here is to switch to a font that has it. There
are free fonts around that you can use, or Arial MS Unicode, if you can
afford it (or if you have MS Office). All you need to do is in your
preprocess (XSLT I guess) to tokenize your strings and to replace '_'
with some inline block with the ZWS symbol in it (in XSLT 2.0 this is
very easy with the tokenize() function, in XSLT 1.0 you need recursive
templates)

Maybe it is even easier to create empty inline blocks, where FOP will
break (as it sees it as a word-end) but I don't know if that will work.

Putting your whole document to Arial Unicode is probably the easiest.

Cheers,
-- Abel

Matthias Müller wrote:

Hi,

Since Arial doesn't support the zero width space symbol #x200b; i need another 
way to control line breaking. Hyphenation doesn't work here since i use 
TEXT_LIKE_THIS

;-)

Any ideas?




  Wissenswertes zum Thema PC, Zubehör oder Programme. BE A BETTER 
INTERNET-GURU!  www.yahoo.de/clever

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




  




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Unable to create font metric file of Arial Unicode MS with fop 0.93

2007-08-15 Thread Abel Braaksma
From the error, it seems that the converter is trying to read beyond 
the end of the file. Are you sure the TTF file is not corrupted? My 
ARIALUNI.TTF file is 23.275.812 bytes in size (but that doesn't say 
much, I don't know how to find out which version I have) and yours seems 
bigger.


Can you try the same command with another font on your system? Do you 
get the same error?


Cheers,
-- Abel Braaksma


xuan ngo wrote:

I was using my old metric file(fop 0.25) with fop 0.93
but fop 0.93 asked me to regenerate the metric file.
So I tried to generate the metric file for Arial
Unicode MS with fop 0.93 but it gives the error below.

Did I do something wrong?

Command executed:
==
java -cp
build\fop.jar;lib\avalon-framework-4.2.0.jar;lib\xalan-2.7.0.jar;lib\xercesImpl-2.7.1.jar;lib\xml-apis-1.3.02.jar;lib\commons-logging-1.0.4.jar;lib\commons-io-1.1.jar
org.apache.fop.fonts.apps.TTFReader
C:\WINDOWS\Fonts\ARIALUNI.TTF Arialuni.xml

Error Message returned:
==
Parsing font...
Reading C:\WINDOWS\Fonts\ARIALUNI.TTF...
Number of glyphs in font: 51180
Error while building XML font metrics file.
java.io.EOFException: Reached EOF, file size=24131012
offset=24131012



  Get news delivered with the All new Yahoo! Mail.  Enjoy RSS feeds right 
on your Mail page. Start today at http://mrd.mail.yahoo.com/try_beta?.intl=ca


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: merge PDF files with FOP??

2007-08-14 Thread Abel Braaksma
Not sure whether FOP can do it, it is surely not designed to do stuff 
like that (FOP is an XSL-FO processor that transforms XSL-FO documents 
into a variety of other formats (if it could include PDF, or RTF or Word 
or whatever, it must also be capable of converting these formats to any 
of the other output formats).


May I suggest you lookup the excellent MultiValent 
(http://sourceforge.net/projects/multivalent/) or the PDF Split and 
Merge (http://sourceforge.net/projects/pdfsam/). I've only use the first 
(excellent product, download the stable version though), the second 
seems promising.


Cheers,
-- Abel Braaksma


//

Sidi Mohamed Idrissi Yaghir wrote:

hello mailing list,

i´m making my first experiences with FOP and i have the folowing 
question:
Is it possible to edit a pdf file with FOP or to merge it with an 
other pdf file (or a piece of it), that is not created with FOP?


thnx

Simo


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: xml with html in it - pdf issue

2007-08-02 Thread Abel Braaksma

Manuel Mall wrote:
Firstly you have HTML embedded as text in your XML. This is why all the 
HTML tags are escaped with the lt; and gt; entities. This means your 
stylesheet will not process these as normal tags but sees them simply 
as text.
  


Your best bet will be: attack the problem at the source: it is 
considered (very) bad practice to use escaped XML inside XML (which is 
basically what this is about). It has many many drawbacks. If you can 
instruct your source system to construct XML with bits of HTML without 
escaping it, you will be much closer to an easy and manageable solution.


I can't tell you how to get the comment text unescaped into your XML as 
that depends on how the XML is constructed in your environment.
  


Change the processor to be Saxon 8.9 and use saxon:evaluate(). But (see 
above), this is dangerous and not recommended. Even more so if you, as 
Manuel says, cannot guarantee that the HTML is 100% well-formed XML once 
unescaped.



Cheers,
-- Abel Braaksma

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: word too large for a table cell

2007-08-02 Thread Abel Braaksma
Look for the thread of around 19/7 this month with the title Force word 
wrap that discusses the same issue. In a nutshell: either use Soft 
Hyphens (SHY) or use Zero Width Space (ZWS) depending on whether you 
want to see a hyphen when it breaks or not. Make sure your font supports 
them (SHY is supported by all I believe).


Nicolas Baumann wrote:

Hello,

When a word is too large for a table cell, it overlaps on the next cell.
How do I avoid this ?
I'm using fop 0.93.

Thanks,
Nicolas.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: specials characters such as Œ

2007-08-02 Thread Abel Braaksma

Nicolas Baumann wrote:

Hello,

I need to include special characters such as Πin the XML file given to the FOP 
processor. My XML is encoded with ISO-8859-1, which supports most characters 
but not Œ. 


No, ISO-8859-1 supports almost no characters but the very basic ones, in 
fact, less then one percent of all characters (and can express less then 
1 percent of all scripts in full). Unicode supports many characters and 
some will even claim 'most', but that is debatable.


To support non Latin-1 (which is a nickname for ISO-8859-1) characters 
you should move to a more extended encoding. The recommended and de 
facto choice should then always be any of the Unicode encodings.


Since it seems to me that most of your characters come from Latin-1, for 
compatibility reasons and for smaller data footprint, I recommend you 
choose the UTF-8 encoding.


To do so, act as follows:
1. Choose any editor that supports this encoding (any serious editor will)
2. Change the encoding attribute
3. Use whatever tool you like to insert these characters (i.e., windows 
charmap)

4. Save the file
5. Transform the file using your fav processor, it will automatically 
recognize the new format.


Of course, any codepoints you use must be available in the font you use. 
You can find that out by simply creating a codepoints chart, by using 
the charmap in windows, or by going to the support page of your favorite 
font.


Alternatively, you can choose to use numeric or named entities (this is 
the way that XML supports codepoints not available in the current 
encoding). If you use named entities, make sure they are resolvable 
through your Document Type.


Cheers,
-- Abel Braaksma

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Forced Word Wrap

2007-07-19 Thread Abel Braaksma (online)
One thing to consider as a resolution might be to use XSLT to insert
soft hyphens on places where you would like the word to be broken.
In XSLT 2.0 this is easiest, like so:

!-- replace all comma's with a comma and a SHY --
xsl:sequence select=replace(., ',', ',#xAD;') /

In XSLT 1.0 you'll need a recursive template to do the replacements.

Whether you can use some feature of xsl-fo to achieve the same
effect, I don't know.

Cheers,
-- Abel Braaksma

PS: rereading your question reveals that you don't want a hyphen.
Use the same trick but then with a zero width space (U+200B). Check
that your font supports the ZWSP.

 Hi Everybody,

 I have multiple table-cells with String like that 01,02,03,04,05
 ..., they don't fit to the limited width of the cell. So there's no
 chance to hyphenate this like a normal word. Is there a way to force
 a word wrap? Do i need to write a hyphenate pattern instead?

 BTW, i use FOP.093 with Cocoon




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: AW: Forced Word Wrap

2007-07-19 Thread Abel Braaksma (online)

 I replace the comma with the zero width space:
 xsl:value-of select=replace('1,2,3,4,5,6', ',' ,'#x200B;')/

 my result is - as expected:
 fo:block wrap-option=wrap hyphenate=true
 language=de1,​2,​3,​4,​5,​6/fo:block


No, this is not as expected. If you cut and paste your value-of
correctly, and if you are using XSLT 2.0 (1.0 would throw an error),
then your output would not include the comma's anymore.


 On the pdf output the line is wrapped, but the numbers are on top of
 each other.

Sounds like a bug to me. Can you provide a (smallest possible)
snippet of working XSL-FO and explain in natural language where the
ZWSP are supposed to be (the mailer messes them up) then we can test
it here as well.

Can you try it with normal spaces (U+20) to see what it looks like
then?

Cheers,
-- Abel


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Not able generate parse html from xml using XSL Fo

2007-05-30 Thread Abel Braaksma (online)
 Hi,
 I am using an xml file which has the below tag
 AddInfolt;fo:block font-style=quot;italicquot;gt;URGENT!
 Please note that comments have changed. Please review
 thoroughly.lt;/fo:blockgt; /AddInfo

this is XML with quoted XML inside. The XSL-FO parser will never see
the block inside AddInfo (it is just text). Why have you mixed XML
with quoted XSL-FO?


And an xsl fo which is of the below form

 fo:block   text-align=justify   line-height=20pt
 space-after.optimum=7pt
   xsl:value-of select=AddInfo disable-output-escaping=yes/
 /fo:block

This should select the AddInfo element and take the string value.
Using d-o-e won't help here, I think, to 'unescape' the text.


  The  XSL Output.html is below
 fo:block font-style=italicURGENT! Please note that comments have
 changed. Please review thoroughly./fo:block

No. To me it seems that this is what you see when you view it in an
XML renderer (like when you view your output in a browser), but this
part is actually lt;fo:block etc (if you view it in a browser, try
viewing the source instead).


   I use org.apache.fop.apps.XSLTInputHandler  to input the xml and
 xsl file and set driver render to pdfformat to generate pdf

 But the parser does not seems to be parsing the fo:block font-style
 in the XML file .

It cannot, there is no fo:block instruction with font-style
attribute, see above, it is escaped.

 fo:block font-style=italicURGENT! Please note that comments have
 changed. Please review thoroughly./fo:block
  But I expect that the italic should be applied to the text

No.


 The xml would generated dynamically with different attributes of
 fo:block or html tags
 How could I use these dynamically generated  xml tags which has an
 fo:block or html tag that is parsed and converted to a pdf using xsl
 fo

The simple solution should be: let your XSLT do what it should do:
generate XSL-FO. Let your system design be what it should be:
separated content from layout; meaning: remove the xsl-fo like
stringized XML from your input XML file. Then all will be easy.

If you really MUST use this 'embedded' XSL-FO information, you
should consider using an extension function that allows re-parsing
of a string that contains XML-like text. Saxon provides such an
extension function in its XSLT parser. Not sure of others though.

No need to try to get the XSL-FO renderer to do what you want, you
will have to tackle this in an earlier stage and generate correct
XSL-FO.

HTH,
Cheers,
-- Abel Braaksma


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: AW: Generate Black and White PDF's

2007-04-23 Thread Abel Braaksma

Matthias Müller wrote:

hi again ;-)

Ok, maybe i didn't expressed my needs correctly.
At the moment i generate PDF files using FOP. This PDF files are colored.
What i need now is a way to tell my FOP Serializer to make the same 
output in gray scales, WITHOUT changing the color properties of each 
colored block.

Got Me ;-)


So, basically, you want the same as what happens when you print anything 
that has colored to a gray-scale printer, right? What you need is two 
FOP files, of course, and you XSLT process (I assume you use XSLT for 
getting your FOP files, but I can't tell for sure of course) is best 
split in two phases (or, if you can use the exslt:node-set extension in 
xslt 1.0, or if you use xslt 2.0, you can use temporary trees), where 
the first phase is your colored transform and the second phase 
calculates the gray scales from this (using, of course, an modified 
identity transformation that only changes the attributes with color 
information).


Google a bit around and you will find plenty of algorithms for getting 
from color to gray scale.


An idea to get the all properties that have color information:

xsl:template match=@*[starts-with(., 'rgb(') or starts-with(., '#') or 
starts-with('cmyk(')] 

  xsl:attribute name={name()}
 xsl:call-template name=color-to-bw
xsl:with-param name=color-value select=. /
 /xsl:call-template
   /xsl:attribute
/xsl:template


Good luck coding!

-- Abel Braaksma

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Differences in Chineese output between fop 0.20.5 and fop trunk

2007-04-19 Thread Abel Braaksma

J.Pietschmann wrote:

Manuel Mall wrote:
I am in no way an expert in Asian scripts but I believe Chinese is 
typically written top to bottom.


That's classical Chinese. Nowadays rl-tb is commonly used.

J.PIetschmann


Commonly depends on where you are. In Macau, Hongkong and Taiwan, 
Traditional Chinese, top-to-bottom, right-to-left is still most common 
in books, newspapers (declining, often combining l-r and t-b texts in 
one paper), comics etc. Additionally, Japanese is invariably written 
top-to-bottom on address labels and in comics (see any Manga comic). 
About all Asian scripts are written top to bottom on spines of books. 
Traditional Mongolian (Manchu and the likes) is always written 
top-to-bottom left-to-right (but Manchu is rare). Japanese business 
cards tend to be both top-to-bottom (Japanese text) and left-to-right 
(English version).


I don't agree that rl-tb is commonly used, not even for Simplified 
Chinese: the majority of Simplified Chinese (which is the language in 
mainland China since 1950) texts are left-to-right and top-to-bottom. 
Only when combined with Arabic or Hebrew texts, right-to-left is used, 
i.e., it follows the host writing direction.


Cheers,
-- Abel Braaksma

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Creating multiple pdf files.

2007-04-03 Thread Abel Braaksma

Pascal Sancho wrote:

Hi Johan,

IMHO, you have 2 alternatives:

 1/ a preprocess stage that splits your XML, before the XSLT transformation.

That can be made using DOM + XPATH expression.
  


The OP already seems to be using XSLT to get XSL-FO. If he/she can 
switch to XSLT 2.0, you can use xsl:result-document ... / which will 
get you multiple XSL-FO documents in one XSLT transformation process. 
The rest is trivial.


-- Abel

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to use fo:page-number/ in xsl:if? Eg. if page == 1.

2007-03-18 Thread Abel Braaksma

Andreas L Delmelle wrote:



I've tried a lot of googling, but even seemingly on-point posts such as
http://www.dpawson.co.uk/xsl/sect3/N8703.html


Hmm, that last one is very dubious to say the least...

It says the same as you do, yet in other words: The page layout is 
carried out by the formatter, hence the page number is not available at 
the transform stage. The xslt example in that last post if of the OP, 
not from D. Tolpin who answered (but its html format is a bit unclear, yes).


-- Abel

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



linefeed-treatment=preserve and orphans/windows do not work as expected

2007-03-15 Thread Abel Braaksma

Hi Fop-users!

I believe this is a bug (perhaps I should better post it to fop-dev?). 
Personally, I do not need this feature, I tend to avoid 
linefeed-treatment altogether, I consider them evil ;)


The orphans and windows control is ignored completely when 
linefeed-treatment is set to preserve, even the default setting of 2 
is ignored, leaving one line on the next page instead of the expected 
two. To illustrate this behavior, here's a little 2inch square page:


fo:root xmlns:fo=http://www.w3.org/1999/XSL/Format;
   fo:layout-master-set
   fo:simple-page-master
   master-name=test-page-master page-width=2in
   page-height=2in
   fo:region-body margin=0.35in/
   /fo:simple-page-master
   /fo:layout-master-set
   fo:page-sequence
   master-reference=test-page-master
   fo:flow flow-name=xsl-region-body
   fo:block widows=2 orphans=2
linefeed-treatment=preserveNeque
   porro quisquam
   est qui dolorem
   ipsum quia
   dolor sit amet,
   consectetur,
   adipisci velit.../fo:block
   /fo:flow
   /fo:page-sequence
/fo:root


The last line, adipisci velit... is placed on its own on the next 
page. Expected are the last two lines (even when widows/orhpans were not 
set).


I tested with FOP 0.93.

Cheers,
-- Abel

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: 'border-collapse=collapse' support in fop-0.93

2007-03-15 Thread Abel Braaksma

Benjamin Schupp wrote:
I am facing a problem with the 'border-collapse=collapse' property on 
fo:tables - it seems to be ignored. Is it supported in the current 
0.93 release at all? I could not find any definite answers.


On the compliance page it is stated as collapsed table model is not yet 
completed:

http://xmlgraphics.apache.org/fop/compliance.html#fo-property-border-collapse

Unfortunately, the implementation is far from trivial...

-- Abel Braaksma

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Trying to use saxon:while and saxon:assign tin FOP

2007-03-13 Thread Abel Braaksma

Johan Johansson wrote:

Hi!

Trying to use saxon:assign and while in fop, but i recive this:
(dont know if saxon extension works within the fop?)

snip /

 xmlns:saxon=http://saxon.sf.net;


Your namespace is incorrect, perhaps that has something to with it? 
Replace it with:


http://saxon.sf.net/

(I've had troubles before when not including the trailing slash. A 
namespace is not a path, remember, but a URI, and must be precisely and 
correctly set to the letter, which in this case does include the 
trailing slash)


-- Abel Braaksma

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Performance issue XSL:FO

2007-03-12 Thread Abel Braaksma

Thomas Yip wrote:

4 transformer.transform(src, res);

However line#4 seems to be taking a lot of time to execute (around 40
seconds).


Thomas, good to see you here. But it would be much easier for us to help 
you if you at least answered my questions that I raised in the original 
thread on the xsl-list, especially to those that are a member of both 
lists (and many are). Also, if your statement seems to be is changed 
in is, add a little code snippet that on itself illustrates the problem.


And I like to repeat my experience with FOP 0.93 here: I use it from a 
servlet with no performance hit whatsoever, but both memory consuming of 
FOP and in-memory serialization of the HTTP output stream can be causing 
this. But first and foremost: add time logging statements to make sure 
your statement above holds.


Cheers,
-- Abel Braaksma

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Performance issue XSL:FO

2007-03-12 Thread Abel Braaksma

Thomas Yip wrote:

[...]
xsl:include href=../template1.xsl /
xsl:include href=template2.xsl/
xsl:include href=template3.xsl /
xsl:include href=template4.xsl /
xsl:include href=template5.xsl /

[...]

!-- Body --
fo:flow flow-name=xsl-region-body
  fo:block
xsl:call-template name=template1 / !--in template1.xsl--
xsl:call-template name=template2 / !--in template2.xsl--
xsl:call-template name=template3 / !--in template3.xsl--
xsl:call-template name=template4 / !--in template4.xsl--
xsl:call-template name=template5 / !--in template5.xsl--
  /fo:block
/fo:flow
[...]


Now it is XSLT, not XSL-FO. I thought the XSL-FO process was causing the 
trouble (see your own OP).


I don't see why this (including many stylesheets) would cause you 
problems with running XSLT.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: FOP 0.93: NullPointerException

2007-03-12 Thread Abel Braaksma

Jeff Powanda wrote:


I’m using xsltproc.exe and FOP 0.93 to try to convert DocBook 4 
(version 1.72) to PDF output. I keep getting this 
NullPointerException. From other messages posted here, I assumed it 
had to do with an older version of Xalan included with JRE 1.5, but 
I’ve placed the FOP 0.93 JAR files into the JRE\lib\endorsed folder 
and that hasn’t fixed the problem. Anyone have any idea what’s wrong. 
I’ve attached the FO file I’m using.


SEVERE: Exception

java.lang.NullPointerException



This won't really help, but I receive the same NPE when running the 
example. In addition, Oxygen found an error in one of your first 
fo:blocks (Invalid Content error), or it was the validator, not sure. I 
couldn't really check because my Eclipse and even my whole system got 
blocked for about 2 min when I tried loading your file (never 
experienced that before with an FO file or Eclipse/Java in general:S.


Can you reproduce the same error with the smallest example file possible 
and post it here (say 2k instead of 160k?), so it becomes easier to 
check the NPE?


-- Abel

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: celle borders problem

2007-03-08 Thread Abel Braaksma

[EMAIL PROTECTED] wrote:

Some time it's due to an issue of the PDF viewer, try to zoom at the
corners and/or print the PDF.
  


but can be resolved when the borders were drawn differently. I believe 
(not sure) that the borders for each individual cell are drawn as 
separate lines (or something), and not merged together as lines that 
continue where they can (I believe this is the infamous collapse issue?).


You can compare the rendering of the borderstyle of the whole table, and 
the borders of individual cells. I know it is not possible to set 
borders for columns and rows yet, but if you could, that would, by 
large, solve the problem without having to resolve to collapse.


The issue by itself (short lines etc) is something I have seen appear by 
most PDF creators I know off. Only some tools do it correctly (depends 
on what you consider correct, it is a pity that Adobe renders a non-join 
of zero-width as a thin line of whitespace, and consecutive lines of 
equal width as non-equal width).


Cheers,
-- Abel Braaksma


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: XPath version

2007-03-06 Thread Abel Braaksma

Jeff Vannest wrote:

What version of XPath is used in FOP 0.93 when parsing through an XSLT-FO
file? Is there a way to control the XPath version being used? I'm trying to
use:

xsl:if test=upper-case( ../NAME ) = quot;SITE NAMEquot;
  


I don't know whether you can control what XSLT/XPath processor is being 
used, but if you want to control the version, you can do so in the XSLT 
header. There is no way to control an XPath version, as a simple rule of 
the standard states that XSLT 2.0 is always chained with XPath 2.0 and 
XSLT 1.0 with XPath 1.0 (not vice versa, XPath can also be used stand 
alone). Changing the version won't have any effect, because FOP uses, if 
you specify an XSLT file, an XSLT 1.0 processor.


XSLT-FO does not exist. I think you meant an XSLT stylesheet that, with 
some input file, will result in an XSL-FO file, which in turn will be 
processed by FOP.


If you want to use upper-case() and don't want to use the obvious and 
ugly translate() hack you need for XSLT 1.0, you should consider XSLT 2. 
Processors that support XSLT 2.0 (and as a result must process XPath 
2.0) are Saxon 8 (.Net and Java), Gestalt (standalone and Eiffel), 
AltovaXML (only standalone, free, no source). Only the first is by most 
people considered both stable, fast and compliant. Gestalt is getting 
closer, AltovaXML still has a long way to go, but does claim compliancy.


If you go that path, I suggest you split your process in two steps. This 
can be done from a windows batch file, or any other means of course. 
First step: process your input XML with XSLT, second step: process the 
resulting XSL-FO(s). With time, you will probably find this way more 
convenient and more versatile (I did).


Cheers,
-- Abel Braaksma


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OutOfMemoryError when using a large unicode font (Arial Unicode MS)

2007-03-05 Thread Abel Braaksma

Andreas L Delmelle wrote:
AFAICT, it is already parsed with SAX (see 
org.apache.fop.fonts.FontReader).


Perhaps it is something else then? :S



It doesn't seem like it's those widths by itself that are causing the 
problem. An array of 50K int-widths should correspond to min. 200K 
max. 400K of heap. :/


That sounds logical.


Can you provide a bit more context information?
Does it appear as a cumulative effect, or does the problem also 
present itself if the document has only one fo:block with a few 
characters?
Does it (only) appear in a context where multiple documents are being 
rendered in parallel?


No, it appears with one document, with one table that has several cells 
with in some of those cells one character from another font. The rest of 
the document (which is in total 1 page) consists of SVG and some plain 
text blocks in other cells (with the default font). I tested without all 
the rest (no SVG etc) and the problem persisted. If needed, I can 
provide you with the full xsl-fo. When I remove the other font and 
replace it with a base-14 font, the problem disappears.


But my original memory counting was flawed by other processes. I did 
some additional tests and found that, regardless the size of the 
one-page table:


  1. With only Base-14 fonts, FOP consumes about 25 MB of the JVM 
memory pool.
  2. With the Arial Unicode MS (one char is enough), FOP consumes about 
80 MB of the JVM memory pool
  3. Without Tomcat (just commandline), FOP consumes approx. 95MB with 
the Unicode font.


Taken that the font itself (the TTF) is 23MB (but why would it be read 
in memory in full if you only need one character?), this still doesn't 
add up, not even if you count the 50.000 integers for the widths. But it 
makes it much more likely than my original 500MB increase (sorry about 
that).


Cheers,
-- Abel

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



OutOfMemoryError when using a large unicode font (Arial Unicode MS)

2007-03-04 Thread Abel Braaksma

Hi fop-users,

The situation was: it works on the commandline but not in Tomcat in a 
servlet. After some time, we figured out that it was causing an 
OutOfMemoryError from the FOP Processor, *after* it reads in the a 
rather large, but not substantial, font metrics file (700KB). Increasing 
Tomcat's maximum mem-use to 768MB solved the problem (it jumps to about 
540MB in a second). The code causing this was:


fo:block font-family='Arial Unicode MS'#x2714;/fo:block

In this particular case there were two solutions:

  1. Remove the Unicode font for a smaller one containing the required 
symbol

  2. Increase the memory


About (1) I can be brief: that is hardly a solution when you need many 
symbols or special characters (i.e., Chinese etc). About (2) I can also 
be brief: suppose you need more than 1 of these fonts, do I need to keep 
increasing memory (and walk by at the memory shop)? I'd rather not to.


I've no idea how the file is read in, but it contains some 51.000 glyphs 
(which translates into the same amount of cid-widths in the font metrics 
file) and the corresponding TTF is 23MB. Though fairly large, this is 
common among Unicode typefaces. Perhaps the XML is read in as DOM? And, 
since more often than not only a few widths are needed, by reading it as 
SAX stream would decrease this memory use (and/or speeds up the 
processing of it)? Perhaps it is a good idea to add it to the memory 
usage hints here: 
http://xmlgraphics.apache.org/fop/0.93/running.html#memory ?


I know this inquiry is not really a question, but rather a bug report 
with a work-around, but I though it'd be good to let you know ;)


Cheers,
-- Abel






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



vertical-align=middle does not put content of table-cell in the middle

2007-02-28 Thread Abel Braaksma

Hi List  fop-users,

I have a nicely formatted table but got stuck when trying to adjust the 
content of each cell to the middle of it. Perhaps this has been asked 
before, but I didn't find it in the archives. Here is the snippet:


fo:table-cell vertical-align=middle .../fo:table-cell

It becomes apparent when the text of one cell crosses several lines and 
the text in other cells do not.


In addition: on the compliance page I found [0.93] Percentages are not 
supported, yet. and on the history of changes 
(http://xmlgraphics.apache.org/fop/0.93/changes_0.93.html) I found 
Bugfix: Percentages in vertical-align property values were not 
correctly handled. which sounds to me that percentages should work now, 
is it not?


Thanks once again for such a nice product. The more I use the more I am 
stunned by the sheer volume of the work put forward and the inherent 
complexity of formatting objects.


Cheers,
-- Abel Braaksma

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: vertical-align=middle does not put content of table-cell in the middle

2007-02-28 Thread Abel Braaksma

Andreas L Delmelle wrote:

On Feb 28, 2007, at 13:45, Abel Braaksma wrote:

fo:table-cell vertical-align=middle .../fo:table-cell


The vertical-align shorthand does not apply to a fo:table-cell, and 
since it is non-inherited, specifying it there does not have any 
effect (unless a value of inherit or from-nearest-specified() is 
used on the descendants).


Thanks for your quick reply, Andreas.

From 
http://www.w3.org/TR/2001/REC-xsl-20011015/slice7.html#vertical-align it 
says: Applies to: inline-level and 'table-cell' elements, which I 
interpreted as that it applies to fo:table-cell as well. Do I 
misinterpret the spec?


If I judge correctly, the property you're actually looking for is 
display-align :


fo:table-cell display-align=center


This worked, though the content needed an extra pt down for adjustment 
(but it was hard to tell if this was visually not in the middle, or 
physically not in the middle).


Cheers
-- Abel Braaksma

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: vertical-align=middle does not put content of table-cell in the middle

2007-02-28 Thread Abel Braaksma

Pascal Sancho wrote:

XSL modifications to the CSS definition:
The CSS property (vertical-align) shall be treated as a shorthand by XSL and 
maps as follows:
(...)
alignment-baseline=xxx
alignment-adjust=xxx
baseline-shift=xxx
dominant-baseline=xxx

And all of thoses properties only apply to inline element.


Ah, thanks Pascal. Indeed, when I wondered through the specs, I couldn't 
find any of those as part of the allowed properties for table-cell. 
Quite confusing that they however do list it as an allowed property in 
one page and a non-allowed property on another. But it is a huge 
undertaking, such a standard, it is almost impossible to not have errors 
or omissions, I guess. ;)


-- Abel

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



What is the level of standard support when compliance table says yes?

2007-02-26 Thread Abel Braaksma

Hi all,

I was testing the FOP 0.93 the other day and worked through some samples 
and tried some myself. I was wondering why something like:


fo:table border-width=0.5pt border-color=red 

does not give a border and

fo:table border-width=0.5pt border-color=red border-style=solid

does.

However, I may be just misinterpreting the spec there, and even if I 
don't, it is a minor bug which I can easily work around. I had some more 
trouble getting the borders of fo:table-column and fo:table-row to work. 
It did not work in the borders.fo example which I found in the binary 
package, yet on the compliance page on the FOP website it says support 
for fo:table-row and fo:table-column is yes. I tried this (and some 
others):


fo:table-column column-width=3cm border-width=0.5pt 
border-color=green border-style=solid /


but it failed. I tried several border-collapse settings (I know that 
only separate is supported), but that didn't help either. As a result, 
I have two questions to the community:


1. If the compliance table says yes should I, or should we not, 
interpret that as being compliant to the spec?
2. Is there a way, other than using borders on each cell, to get the 
borders for the column/row to work? Is there a shortcut way to just set 
all borders of table/rows/columns/cells to the same properties?


If (1) is answered with yes, then I believe the above to be a bug in 
FOP 0.93. I know it is a work in progress, but if the answer is no, it 
would perhaps save you, the programmers, and others some work, like 
answering questions like these, when you update the compliance table 
with accurate data (I volunteer to do a part of it).


Cheers,
-- Abel Braaksma

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: XSL - NewLine

2007-02-13 Thread Abel Braaksma

Just use:

xsl:text#13;#10;/xsl:text
or
xsl:text#xD;#xA;/xsl:text

You can also add an entity to your doctype if you tend to use this kind 
of newlines more often:

!ENTITY newline #38;#x0D;#38;#x0A; 

and use it as follows:
xsl:textnewline;/xsl:text

which will be rendered as a \r\n by the serializer. Of course, you could 
also use an xsl:variable to do the same.


Why do you want a \r *and* a \n? Because if you output XML (which you 
do: XSL-FO) the serializer will make sure that all \r\n will become \n. 
Which means that


xsl:text#xD;#xA;/xsl:text

is semantically equivalent with:
xsl:text#xA;/xsl:text

which means that the newline entity definition will do exactly the same 
when defined thus:

!ENTITY newline #38;#x0A; 

(not so when you output as text, but that is another story)

If you *have* to have both the \r and the \n in the serialized output (I 
have no idea why, I think you don't) then your only bet is XSLT 2.0 
which allows you to put in late-serialization replacements with 
xsl:character-map.


Cheers,
-- Abel Braaksma


Gregan, Miroslav wrote:

Hello all,
 
I need to put manually new line in a pdf document and it has to be for 
the @value field.
I know, to put a new line I should use a new block, but Is it possible 
to put some kind of \r\n string into the value to format it?


fo:block hyphenate=true font-size=10pt font-weight=bold
xsl:value-of select=@value/
/fo:block

This XSL document is used to convert an XML document to PDF with 
either FOP 0.20.5 or 0.93 used embedded in a java 5.0 code.
 
Thank you for your help.
 
Kind regards,
 
Miroslav Gregan
 
Siemens PSE-SK KB SK2

Dubravska cesta 4
84104 Bratislava
Slovakia
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: XSL - NewLine

2007-02-13 Thread Abel Braaksma

Gregan, Miroslav wrote:

Thanks you for your answers

Actually I afraid I did not ask my question clearly enough.
The @value which is the content of an XML File's element which contains
a String.
This String has to be formatted (a little bit if possible :-) ) with new
lines.
So that the text:

Mister TNewLineCharHannibal SmithNewLineCharLooping

Where NewLineChar should be the expected character

After rendering FOP will look like in PDF format to:

Mister T
Hannibal Smith
Looping


Is it possible? Or should I find a way to use multiple blocks?
  


Your question seemed to be about how to insert line breaks in XML. If 
you want to introduce newlines in the rendered PDF, there is no use 
whatsoever to use line breaks the way we explained to you, because this 
is treated as whitespace and handled accordingly by FOP (or any xsl-fo 
processor for that matter).


Most likely you just want to use fo:block...

I do not understand why you want an attribute to contain \r\n as it 
whitespace has no influence on the rendering process. Perhaps you mean 
it the other way around: your source document contains some attribute 
with newlines in it and you want these newlines to be turned into 
fo:block /. This is then an XSLT question and the answer depends on 
what version you use. In XSLT 2 you can do the following:


xsl:for-each select=tokenize(@your-attribute, '\n')
   fo:blockxsl:value-of select=. /
   etc
/xsl:for-each

Your best bet for this kind of questions is the XSLT list at mulberry 
tech's: http://www.mulberrytech.com/xsl/xsl-list/index.html.


Cheers,
-- Abel Braaksma
  http://xslt.metacarpus.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: XSL - NewLine

2007-02-13 Thread Abel Braaksma

Manuel Mall wrote:
As mentioned in previous responses you need to add the linefeed 
characters to the value. However, in addition you need to set the 
property  linefeed-treatment=preserve on the enclosing fo:block 
otherwise the linefeeds in the text will be treated like / converted to 
spaces and don't generate a line break.
  


Interesting. I use xsl-fo too little to be aware of that. Nice tip for 
me as well, may save a lot of work ;)


-- Abel

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cannot print FOP-generated PDFs via Acrobat Reader 8

2007-02-13 Thread Abel Braaksma

BiYing Huang wrote:

Hi, All:

I have a weird issue with printing FOP(v.0.20.5)-generated pdf files
using Acrobat 8 and HP Color LaserJet 4650.


Though it looks like an acrobat problem to me, can you do a test with 
FOP 0.93? The 0.20 branch is obsolete now and the 0.9x branch is a 
complete rewrite of everything before, there's a big chance this problem 
(if it is indeed a FOP problem) does not occur anymore.


-- Abel

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Pagebreak

2007-01-16 Thread Abel Braaksma

paul wrote:


I chose to do

xsl:template match=a/b
xsl:for-each select=c
fo:block break-before=page
(content)
/fo:block
/xsl:for-each
/xsl:templat


Hi Paul

I'm glad it worked out. In the xslt language it is usually best to let 
the processor do the work for you. Often people choose to use 
xsl:choose, xsl:if and xsl:for-each when a pure template approach would 
suffice. You can rewrite the above as follows:


xsl:template match=a
   xsl:apply-templates select=b/c /
/xsl:template

xsl:template match=c
   fo:block break-before=page
xsl:apply-templates select=yourcontent /
/fo:block
/xsl:template

xsl:template match=yourcontent
...blocks for your content etc...
/xsl:template


Trying to think XSLT and to consider using declarative style (xslt is a 
declarative programming language, as opposed to imperative, which is the 
type for Java, C#, VB etc; within declarative languages, you tell what 
you want and the processor defines the best execution path and decision 
logic), will increase your joy with the language and your speed of 
programming.


Cheers,
-- Abel Braaksma
  http://www.nuntia.nl

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Pagebreak

2007-01-16 Thread Abel Braaksma

paul wrote:

oh my gosh, I just noticed a huge mistake on my part. My first page actually has
never been blank, but there was a tiny text on there. unwanted text, for some
xpath-mistake on my side it got printed too. So I guess with my for-each loop I
managed to avoid printing this text and therefore avoided the first pagebreak
with an almost empty page. I'm sorry for unnecessary posting, hope I didn't
steal too much of your time. Still learning...


Your best bet for questions on XSLT is the XSLT list.

The reason for this text is likely the following: the default template 
for any content is the same as the xsl:value-of, which extracts the 
text. If you fail to supply a root template match, it is likely that for 
missed template matches, the default template is called. Consider:


a
   text
   bother text/b
/a

The following stylesheet will output both text and other text:

xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform; 
version=1.0

/xsl:stylesheet

The following stylesheet will so too, because it only matches b nodes 
with a as parent. The a node does not have a match and so will fall 
into the default template:


xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform; 
version=1.0

  xsl:template match=a/b
  xsl:value-of select=. /
  /xsl:template
/xsl:stylesheet

The following stylesheet will only print other text:

xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform; 
version=1.0

  xsl:stylesheet match=/
  xsl:apply-templates select=a/b /
  /xsl:stylesheet
  xsl:template match=b
  xsl:value-of select=. /
  /xsl:template
/xsl:stylesheet


When nodes do not contain bare text but only child nodes and attributes, 
this is not a problem. However, this is seldom the case (consider 
whitespace nodes, they are almost always there) and so it is good 
practice to start a new template using the root match and go from there.


Cheers,
-- Abel Braaksma
  http://www.nuntia.nl

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: SHY characters in user mode

2007-01-15 Thread Abel Braaksma

DA Shetland wrote:
In fact SHY is the character that is not a character - it is a one 
character size processing instruction that happens to enjoy a code 
point in character tables, but strictly speaking, it doesn't even need 
a glyph (we have a code point for the hyphen).  


There are very many characters of this kind. Like the RTL and LTR 
markers and combining characters.


In every case, hyphenation available on or not, turned on or not, the 
SHY needs to disappear from the string - of course, if hyphenation is 
available, the location needs to be remembered for later use.


It happens that the Unicode consortium defines this glyph as a glyph 
that should indeed not appear (this is a change between Unicode 3 to 
Unicode 4). But the of course in your sentence is not so obvious as it 
may seem. This article shows an in-depth coverage of the SOFT HYPHEN: 
http://www.cl.cam.ac.uk/~mgk25/ucs/L2/03155r-kuhn-soft-hyphen.pdf.


In short: the soft hyphen should not be removed from the data stream. 
However, it should not appear in the sentence, unless the sentence must 
be hyphenated due to a line break.


To support this, the SOFT HYPHEN is a Cf (Other, format) group character 
that normally has no visible appearance, unless in special situations. 
It also does not count as a character when the numbers of characters is 
counted, nor does it appear in comparison functions (it is ignored).


-- Abel


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Pagebreak

2007-01-15 Thread Abel Braaksma

paul wrote:

somehow it doesn't work for me :( I suspect I have an xpath-problem, but can't
figure out what would be wrong...

my template starts like this:
xsl:template match=projektindikator_info/projekt/projektindikator
xsl:if test=position()  1fo:block break-before=page//xsl:if

...

it works just fine, but always inserts a blank page at the beginning of the
document. I don't understand this. Can I only call for positions if I go through
a for-each loop?
  


This is an XSLT question and not about fop. You'll have more luck on the 
XSLT list. But to answer your question: position() returns the position 
of the current node in the source tree. It can be used inside an 
xsl:template (like you do) and in an xsl:for-each, xsl:for-each-group 
(if you use XSLT 2) etc.


You say my template starts like this, but XSLT is a declarative 
language, the order of elements is not important, so it is impossible to 
say anything useful about your template without seeing more. Create a 
smallest possible XSLT file and a smallest possible XML input file that 
illustrate your problem. Post them, plus explanation and an example of 
what you want the output to look like, on the XSLT list and you have a 
good chance that someone can help you out.


Cheers,
-- Abel Braaksma

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Pagebreak

2007-01-15 Thread Abel Braaksma

J.Pietschmann wrote:

There are two possibilities:
1. Use xsl:strip-space elements=*/, or whatever suits you.
2. Use xsl:apply-templates select=*/ or something similar at
 the necessary places, which will apply templates to element nodes only
 and ignore all text nodes.


And a third: use xsl:number / inside your match, like this (puts '1' 
to the result tree, while position() would put '2'):


   xsl:template match=b
   xsl:variable name=nrxsl:number //xsl:variable
   xsl:value-of select=$nr/
   /xsl:template


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: SHY characters in user mode

2007-01-15 Thread Abel Braaksma

DA Shetland wrote:

My saying that strings have to be de-SHYed up front was as much as 
saying that I don't trust the presentation layer to do what it needs 
to do for all categories of control characters, combining characters, 
etc. of which SHY is one.


So I will pre-filter and watch for news. 



In the case you are using XSLT 2 (and in the event you haven't applied a 
filter yet), here is an easy solution you can use for all your templates:


xsl:output use-character-maps=remove-SHY /

xsl:character-map name=remove-SHY
   xsl:output-character character=#xAD; string=/
/xsl:character-map



If you place it in an include/import xslt file, you can easily expand 
the list with other control characters. Note that this method is much 
faster (should be) than regex replacing.


Cheers
-- Abel Braaksma

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: SHY characters in user mode

2007-01-15 Thread Abel Braaksma

J.Pietschmann wrote:

Abel Braaksma wrote:
In the case you are using XSLT 2 (and in the event you haven't 
applied a filter yet), here is an easy solution you can use for all 
your templates:


xsl:output use-character-maps=remove-SHY /


I was under the impression that output maps are only applied if
the transformation result is serialized, which is not the case
if the FO process is chained to the transformation using SAX
events.
Can anybody confirm that output maps work even in the latter case?


I never thought of that, but you are right, of course. Though I am not 
certain how processors actually deal with this when you do an in-memory 
transformation, processors are allowed to ignore xsl:output and 
xsl:character-map. Here's the quote from the XSLT 2 REC that says so:


When serialization is not being performed, either because the 
implementation does not support the serialization option, or because the 
user is executing the transformation in a way that does not invoke 
serialization, then the content of the xsl:output and xsl:character-map 
declarations has no effect. Under these circumstances the processor may 
report any errors in an xsl:output or xsl:character-map declaration, or 
in the serialization attributes of xsl:result-document, but is not 
required to do so.


However, the workaround is simple (but a bit more time-consuming for the 
processor to perform, and perhaps to implement):


xsl:value-of select=replace( $your-shy-value, '#xAD', '' ) /

You'll have to do this for every text node containing a SHY. If you find 
that too cumbersome (I would), another resolution is be to wrap your 
result in a temporary result tree, and apply an identity template to it:


xsl:template match=/ 
  xsl:variable name=temp-result
   !-- apply your normal templates as they are now --
   xsl:apply-templates /
  /xsl:variable
  xsl:apply-template select=$temp-result/* mode=remove-SHY /
/xsl:template

xsl:template match=text() mode=remove-SHY
   xsl:copy-of select=replace( . , '#xAD', '' ) /
/xsl:template

!-- copy template --
xsl:template match=node() | @* mode=remove-SHY
   xsl:copy
   xsl:apply-templates select=node() | @* mode=#current /
  /xsl:copy
/xsl:template

that way you only have to change your existing code at one spot (but 
note that the serialization option is less processor-intensive, so if 
you do some serialization before applying FOP, go for that option).


Cheers,
-- Abel Braaksma
  http://www.nuntia.nl

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Mismatch: table-body

2007-01-12 Thread Abel Braaksma

Xavier Ottolini wrote:

Hi,

I want to build a PDF file with a XSL transformation. I use FOP 0.93 
on Tomcat 4.3 (Windows) . Fop is embeded in a JSP.


If I run FOP as a standalone application. The XSL transform is ran 
successfully. But In my embeded class, an exception is thrown :


javax.xml.transform.TransformerException: 
org.apache.fop.fo.ValidationException: Error(Unknown location): 
fo:table-body is missing child elements.

Required Content Model: marker* (table-row+|table-cell+)

The child element in the table-body tag is a apply-template 
element and not a table-cell element.


fo:table-body
xsl:apply-templates select=detail/ligne/
/fo:table-body


No, the child of the element in the XSLT file is xsl:apply-templates. 
This is an XSLT instruction and it generates a result tree. If the 
context node has a child detail that has a child ligne, these 
ligne-nodes will be processed by the matching template. If these nodes 
are not there, or there is no matching template, the fo:table-body will 
remain empty, which is illegal.


You can change the XSLT such that it does not include fo:table-body at 
all, or, better yet, not the whole table at all, depending on some 
condition.


Since this appears to be an XSLT question, you may be better off 
narrowing it down a bit and asking a specific question on the XSLT 
mailing list, instead of the FOP user list.


Cheers,
-- Abel Braaksma


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Mismatch: table-body

2007-01-12 Thread Abel Braaksma

Xavier Ottolini wrote:
org.apache.fop.fo.ValidationException: Error(Unknown location): 
fo:table-body is missing child elements.

Required Content Model: marker* (table-row+|table-cell+)


PS: your templates shows that you do have a matching template, 
containing well enough literal result elements. So, the place to look is 
the source XML. Consider running the XSLT stand-alone on your input 
document (the same input you use in your embedded class) and examine the 
xsl-fo output closely. Then, adjust the XSLT and/or the input XML 
according your required output (in this case: a table with content, or 
no table at all).




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Em Space - UTF8

2007-01-08 Thread Abel Braaksma

Oliver Müller wrote:

Maybe I don't got any other solution because I'm quite new to XSL-FO ...
I would really love to use text-indent, but in my case I don't see a
chance to do so.
[]
I found no possibility to apply a new fo:block to all of the text
before and after


Normally people choose XSLT to do that task, I assume you do so too. The 
best place to ask that question is on the XSLT list. Try 
http://www.mulberrytech.com/xsl/xsl-list/subscribe-unsubscribe.html to 
subscribe to that list.


Since this is fairly trivial to do in XSLT 1 and 2 (what version do you 
use?), I will give you a solution that works for either version:


INPUT DOC:
root
   Lorem ipsum 1
   absatz /
   Lorem ipsum 2
   absatz /
   Lorem ipsum 3
/root

XSLT DOC:
xsl:stylesheet version=1.0
   xmlns:xsl=http://www.w3.org/1999/XSL/Transform;
   xmlns:fo=http://www.w3.org/1999/XSL/Format;
  
   xsl:output indent=yes/
  
   xsl:template match=root

   fo:root
   xsl:apply-templates /
   /fo:root
   /xsl:template
  
   xsl:template match=text()[preceding-sibling::*[1][self::absatz]]

   fo:block text-indent=6pt
   xsl:value-of select=./
   /fo:block
   /xsl:template
/xsl:stylesheet

OUTPUT:
   fo:root xmlns:fo=http://www.w3.org/1999/XSL/Format;
   Lorem ipsum 1
   fo:block text-indent=6pt
   Lorem ipsum 2
   /fo:block
   fo:block text-indent=6pt
   Lorem ipsum 3
   /fo:block
   /fo:root


If you want the first textblock to be indented as well, add the 
following to the match of the text-nodes with preceding-sibling:


text()[following-sibling::*[1][local-name() = 'absatz']]

or make a copy of it, and add this:

   xsl:template match=text()[following-sibling::*[1][self::absatz]]
   fo:block text-indent=6pt
   xsl:value-of select=./
   /fo:block
   /xsl:template

which will wrap all text nodes that have either a following node or a 
preceding node that is called absatz. Note that the following 
(seemingly correct) versions do not yield the same results:


text()[preceding-sibling::absatz]

which will match the text-node if somewhere, between all siblings, there 
is a node 'absatz', and


text()[preceding-sibling::absatz[1]]

which will match if there is at least one node, somewhere, that matches 
the name 'absatz' (same as before) and


text()[preceding-sibling::*[1][absatz]]

which will match if the first sibling has a child 'absatz', which is not 
what we want. So, finally, this comes to:


text()[preceding-sibling::*[1][local-name() = 'absatz']]

Please note, that this explicitly does not wrap the text inside an 
fo:block when something else then an absatz / node is preceding or 
following the text node. Also, if the text node you want to match 
contains more nodes (like text in xhtml with strong and em), the 
above solution needs some tweaking (nothing fancy though). In that case, 
I think your chances are better at the XSLT mailing list.


Note, too, that text nodes that do not match the predicate discussed 
above, will simply be output.


Hope this helps!


absatz /.
Thats why I'm using fo:block /fo:inline 
font-size=10pt#8195;/fo:inline

to get my linebreak and indent.


Since you need a linebreak and an indent, you better wrap the texts in a 
fo:block, like you suggested already.


Cheers,
-- Abel Braaksma
  http://www.nuntia.nl

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Em Space - UTF8

2007-01-07 Thread Abel Braaksma

Oliver Müller wrote:

the problem only appears when it's the first element of a new line.
I tried 2 different methods to get the effect and both fail with fop.

 fo:inline space-start=10pt/fo:inline
 fo:inline font-size=10pt#8195;/fo:inline

Note that this works in Antenna House XSLFormatter.

I need this for my workaround for line indenting, because I want
to indent lines after a xml node called absatz /.


I can hardly believe you need a workaround for spacing text, the last 
time I saw that it was really needed was in the HTML 2.0 time, where 
tables were not yet a part of the standard. However, if you must use 
spaces and cannot use text-indent or the like, consider a workaround 
with either:


#x200C;  -- Zero Width Non-Joiner
#x200D;  -- Zero Width Joiner
#x200E; -- Left-To-Right-Mark
#x200F; -- Right-To-Left-Mark

For example, you could try this:

EM SPACE -- ZWJ -- HAIR SPACE

But if that is still truncated down to nothing (as spaces appear to be 
stripped), you can try holding it into two characters that are not 
spaces, like this:


LRM -- EM SPACE -- LRM

(or if your text is supposed to be right-to-left, replace that with RLM)
(look here for possible candidates that are better suited than a 
character that actually has a function: 
http://www.fileformat.info/info/unicode/category/Cf/list.htm)


But, these seem to me like terrible workarounds: not all fonts support 
them, you should, in any case, use an indentation method or try to apply 
one, and spacing characters are not defined to be of equal width amongst 
fonts, leaving you with unequal indentation when you try to apply this 
techniques with other fonts.


Cheers,
-- Abel Braaksma
  http://www.nuntia.nl






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: MIME_TIFF format

2006-11-01 Thread Abel Braaksma

Richard King wrote:

Hi all,
I currently use fop 0.92 to product PDF documents but have had a request to 
also produce a TIFF documents.  To this end I updated my java code so MIME_TIFF 
is used.

The file produced is very large.
The PDF created is 145KB
The equivalent tiff file is 9650KB!

Is there any way to reduce this file size?
Are there any other alternatives I could consider?
I understand that Batik only supports Deflate algorithm. But you may try 
this extension of Apache Fop: TIFFRenderer. It is made to add 
compression capabilities. Not sure if it works with the 0.92 version, though

http://www.tkachenko.com/fop/tiffrenderer.html

Other libraries are around, like LibTIFF (a C library that does what you 
want) and Sun's library for TIFF (com.sun.media.imageio.plugins.tiff, 
not sure of the version). Commercial libs are around too, look for tiff 
compression in google.


-- Abel Braaksma
  http://www.nuntia.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: fo:inline with line-height, height, border or other block-like properties

2006-10-17 Thread Abel Braaksma

Abel,

0.92a does not exists...

Either 0.90alpha, 0.91beta, or 0.92beta

Can you confirm what version do you use?
  


Pascal, Manuel,

I use 0.92beta, just checked.
But you are right! It was a version problem! It was the age-old 0.20.5 
version I used, without knowing: The Eclipse plugin of Oxygen was 
blinding my eyes. It uses a non-standard way of installing (not in 
Eclipse plugin dir). So, I thought I had upgraded fop.jar everywhere, 
but forgot about Oxygen.


Just tested with the correct 0.92beta. And you are both right. My 
apologies for not checking deeper in the first place (these darn java 
lib paths!).


This brings me to a little q.: in XSLT, I can get the vendor version by 
using system-property(xsl:vendor). Is there a similar way for XSLFO? 
It would prevent me for making the same mistake next time ;-)


Cheers!
-- Abel Braaksma
  http://www.nuntia.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: fo:inline with line-height, height, border or other block-like properties

2006-10-17 Thread Abel Braaksma

Pascal Sancho wrote:

commandLine: -v option
Java: org.apache.fop package, Class Version, getVersion() method. 


Pascal
  


I am aware of those options, they are all at places hidden for me, as a 
user. All I can do is provide an XSLT which creates (from some source) 
XSLFO (which in turn is automatically processed by the internal fop 
proc, which can be different on different installations). As a user of 
our system, I cannot access the fop.jar directly.


Hmm, perhaps I can create an extension function for XSLT. But then, that 
will call the fop version available on the moment that the XSLT is 
processing. Which is (in our case) not necessarily the same (esp. in the 
aforementioned case, where fop.jar was from a diff. location than I 
expected.


-- Abel

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: fo:inline with line-height, height, border or other block-like properties

2006-10-17 Thread Abel Braaksma

Pascal Sancho wrote:

You cannot have the FOP version in the XSL-FO file since at this stage,
FOP is not yet invoked.
  


Sorry for being unclear. I did not mean in the XSLFO file, but with 
the XSLFO file. Like, that there exists an instruction such as: 
fo:vendor-version / or something like that. Perhaps it just does not 
exist.



But you can check the PDF producer property of your PDF file, witch
gives engine+version used to make the PDF.
  


That will help. Thanks! Indeed, the document that I put online shows FOP 
0.20.5. That takes away my last uncertainty of what version was used here.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: fo:inline with line-height, height, border or other block-like properties

2006-10-16 Thread Abel Braaksma

Manuel Mall wrote:
Sorry, but your example does not make sense to me. You provide HTML not 
XSL:FO. Can you provide the exact fo file you feed into fop so we can 
better understand your issue?


My apologies. I thought it'd be clearer that way. Here's a snippet:

  fo:block line-height=313% space-before=1em 
space-after=1emParagraph with different sizes: fo:block/

  fo:inline font-size=60% role=xhtml:fontx-small, /fo:inline
  fo:inline font-size=80% role=xhtml:fontsmall,/fo:inline
  fo:inline font-size=100% role=xhtml:fontnormal,/fo:inline
  fo:inline font-size=135% role=xhtml:fontlarger,/fo:inline
  fo:inline font-size=171% role=xhtml:fontlarge,/fo:inline
  fo:inline font-size=267% role=xhtml:fontx-large,/fo:inline
  fo:inline font-size=313% role=xhtml:fontxx-large./fo:inline
  And back to normal again.
  /fo:block


Here you see that I set the line-height on the block element. When I set 
the line-height on the fo:inline elements, it does not have any effect. 
If the block is small enough so that it spans multiple lines, without 
the line-height in the block element, the text will overlap. But with 
it, *all* lines will have the maximum height. I do not want that. I only 
want the lines to have the minimum needed line-height for the size of 
the text it contains.


From the specs I understand that the line-height property is available 
on inline level elements also. I tried, but to no effect, like this 
(actually, I expected the overlap not to happen at all, unless I'd 
specifically say so):


  fo:block space-before=1em space-after=1emParagraph with 
different sizes: fo:block/
  fo:inline line-height=60% font-size=60% 
role=xhtml:fontx-small, /fo:inline
  fo:inline line-height=80% font-size=80% 
role=xhtml:fontsmall,/fo:inline
  fo:inline line-height=100% font-size=100% 
role=xhtml:fontnormal,/fo:inline
  fo:inline line-height=135% font-size=135% 
role=xhtml:fontlarger,/fo:inline
  fo:inline line-height=171% font-size=171% 
role=xhtml:fontlarge,/fo:inline
  fo:inline line-height=267% font-size=267% 
role=xhtml:fontx-large,/fo:inline
  fo:inline line-height=313% font-size=313% 
role=xhtml:fontxx-large./fo:inline

  And back to normal again.
  /fo:block

Hmm, I see now there's also a line-stacking-strategy. Should I do 
something with that?


Any ideas are very welcome,

Cheers,
-- Abel Braaksma

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: fo:inline with line-height, height, border or other block-like properties

2006-10-16 Thread Abel Braaksma

Manuel Mall wrote:
If I remove the line-height=313% from the fo:block it seems to do 
exactly what you want, that is each line get the minimum necessary 
height to render it.
  


This is precisely what I want to happen. Hmm, I'll make a full test, 
leaving out as much as possible, and if it still doesn't work, I will 
post my results online, so you can see the resulting PDF. I use FOP 
0.92a. Perhaps that's the prb?


If I leave your settings the line-height on the first line is correctly 
set to 37.56pt (12pt * 313%). Note: As you didn't specify a font-size 
on the fo:block the inherited font-size is chosen which is the document 
default size of 12pt. The other lines get either the minimum 
line-height of 37.56pt or a bigger height if larger fonts are used.
  


That last thing still doesn' t happen. Hmm, my guess is, I have some 
setting alongside my copy 'n' past xsl-fo that I missed (?).


Setting the line-height on an inline element does simply set the minimum 
height for that element. 


My thoughts exactly

In your examples this never takes effect as 
the actual height is larger then the line-height. For example:
 fo:inline line-height=60% font-size=60% role=xhtml:fontx-small, 
/fo:inline
Assuming on the enclosing block the font-size is 12pt. That means the 
font-size on the inline is 7.2pt (60% of 12pt). Now you say the 
line-height is 60% of that value making it 4.32pt (60% of 7.2pt). 
Obviously that won't fit.
  


Aha! That maybe what I am missing here. I thought '60% of original 
inherited font size.



Hope this helps



I will try these new insights. Thanks for making me understand the 
subject matter a little better.


Regards,
-- Abel

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: fo:inline with line-height, height, border or other block-like properties

2006-10-16 Thread Abel Braaksma

Abel Braaksma wrote:

Manuel Mall wrote:
If I remove the line-height=313% from the fo:block it seems to do 
exactly what you want, that is each line get the minimum necessary 
height to render it.
  


This is precisely what I want to happen. Hmm, I'll make a full test, 
leaving out as much as possible, and if it still doesn't work, I will 
post my results online, so you can see the resulting PDF. I use FOP 
0.92a. Perhaps that's the prb?


It simply does not work, still, all text is mixed through one another 
(see below for link). Here's the full XSLFO document I used to create my 
document, as you can see, I tried the last inline element to increase 
the line-height. But it has zero effect:


fo:root xmlns:fo=http://www.w3.org/1999/XSL/Format;
   fo:layout-master-set
   fo:simple-page-master page-width=auto page-height=auto 
master-name=all-pages
   fo:region-body margin-top=1in margin-right=1in 
margin-bottom=1in margin-left=1in

   column-count=1
   column-gap=12pt/
   /fo:simple-page-master
   /fo:layout-master-set
   fo:page-sequence master-reference=all-pages
   fo:flow flow-name=xsl-region-body
   fo:block space-before=1em space-after=1emParagraph 
with different sizes: fo:block/
   fo:inline font-size=60%  x-small /fo:inline and 
back to normal,
   fo:inline font-size=80%  small/fo:inline and back 
to normal,
   fo:inline font-size=100% normal/fo:inline and back 
to normal,
   fo:inline font-size=135% larger/fo:inline and back 
to normal,
   fo:inline font-size=171% large/fo:inline and back 
to normal,
   fo:inline font-size=267% x-large/fo:inline and 
back to normal,
   fo:inline line-height=600% font-size=313% 
xx-large/fo:inline and back to normal,

   And back to normal again.
   /fo:block
   /fo:flow
   /fo:page-sequence
/fo:root

If you want to see the PDF document (in case it is different from 
yours), you can see it online here: 
http://abelleba.metacarpus.com/xslfo/test.pdf


Hope you (or anyone) has any ideas how to resolve this.

Cheers,
-- Abel Braaksma

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Fwd: fo:inline with line-height, height, border or other block-like properties

2006-10-13 Thread Abel Braaksma
[something went wrong with subscription a while ago. This message was 
originally send Monday 2 October, but apparently my subscription was 
wrong. My apologies if this is the second time you see this message. I 
will request a digest]


 Original Message 

Dear List,

I am new to XSL-FO, but I am trying to read up and catch up. From what I 
understand from the specs and from the book Definitive XSL-FO, it is 
possible to do the following:


fo:block space-before=1em space-after=1emParagraph with different 
sizes: fo:block/

  fo:inline font-size=1.70 padding-top=2emlarge,/fo:inline
  fo:inline font-size=2.67 padding-top=2emx-large,/fo:inline
  fo:inline font-size=3.13 padding-top=2emxx-large./fo:inline
  And back to normal again.
/fo:block

In that example, I use the common property padding-top. From the 
compliance page from Apache Fop, I understand that padding-properties 
are supported. Same for border-top-width, height  and the like. These 
properties can be used on inline elements as well as on block elements. 
For block elements they seem to work perfect, but for inline elements, 
they are completely ignored.


Can someone help me here? What I am trying to do is make the line-height 
higher when halfway up a line, not knowing up-front what the maximum 
height will be for that line (I cannot know what fits on a line and what 
not). In HTML (as a bad comparison), this is done automatically with 
inline elements (span, em etc).


I tried using fo:block with keep-with-next, expecting that the 
line-break on the end of the block would not appear, but alas, it did 
anyway. So using a block as an inline element was no consort either.


Anybody any ideas?

Thanks in advance,

Cheers,
Abel Braaksma



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: fo:inline with line-height, height, border or other block-like properties

2006-10-13 Thread Abel Braaksma

Jeremias Maerki wrote:

You got an answer on your question from Manuel Mall:
http://www.nabble.com/fo%3Ainline-with-line-height%2C-height%2C-border-or-other-block-like-properties-tf2369401.html


Thanks Jeremias. This list apparently also works when you are not (or 
not correctly) subscribed.


Manuel, sorry for this belated reply, but I thought (really) that this 
FOP User list was dead(ish) until I saw on the internet and XSLT list 
referrers to recent posts. I retried. Here are my answers to your questions.


Manuel Mall-2  wrote:

On Monday 02 October 2006 20:47, Abel Braaksma wrote:

No they are not ignored, although it may appear that way. This is one of
the peculiarities of the XSL-FO spec. For block areas border/padding
are inside the allocation rectangle for inline areas they are outside
(see section 4.2.3). Therefore defining border/padding top/bottom on an
inline area will not make the line any higher.


Can someone help me here? What I am trying to do is make the
line-height higher when halfway up a line, not knowing up-front what
the maximum height will be for that line (I cannot know what fits on
a line and what not). In HTML (as a bad comparison), this is done
automatically with inline elements (span, em etc).



Not sure I fully understand what you trying to achieve. FOP will use the
maximum height of any inlines as the height of the line.


Well, I really hoped so, But this is not what happens. If I have in one 
paragraph different font sizes, the bigger font sizes will overlap over 
the previous line. If I set the line-height to a given height, it is 
applied to all lines of the paragraph, whereas I want the line to be of 
the minimum height required *per line*, inside that paragraph.


Consider the following HTML snippet:
html
body
div style=width:100px;
font size=2This piece is in a small font
size but font size=5this is BIG/font
and this is font size=7real BIG/font
and back to normal again.
/div
/body

Paste it in a text file you see what I mean. The first lines have a 
small line-height (automatically), the next lines are higher when 
needed, to prevent overlap, the last lines have smaller line-height, 
because no bit text anymore. All inside one paragraph. If I do the same 
in XSL-FO, the BIG letters will overlap with the previous lines and look 
ugly. If I increase the line height, the line heigh increases for the 
whole paragraph.


What I want is to increase the line height only where it is needed: on 
the inline element. But this I tried, and does not seem possible (though 
what I got from the specs and what you say above, it should be possible 
(?)  )



So, it should
do what you want without anything special. If I have misunderstood you
could you please rephrase what you trying to do.


Yes I can, see above, hope it clears things up a bit.


BTW, which version of FOP are you using?


version 0.92a (latest, I believe).

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]