fop

Access file in WebContent folder from a servlet

Hi, I'm trying to generate a PDF document using FOP. The pdf generation code is kept in a servlet and the xsl is in a specific folder in the WebContent folder. How can I access this xsl file by giving a relative path? It works only if I give the complete path in the File object. I need to generate the xml content dynamically. How can...

Convert a string to XML input stream in java

Hi, I'm trying to generate a PDF document using FOP and Java. I receive the XML as a string and not as a file. How can I convert this XML string to an XML input stream so that I can call xslfoTransformer.transform(source, res); where source is my XML string as an Input stream. Please provide your suggestions. ...

XSLT fop-0.95: problem with dyn:evaluate

Hello, I've been struggling with some weird behavior of fop 0.95 (don't know if I'm doing something wrong, or if there is a work around). I have an auto generated XML as follows: <projectteam> <projectname>Report Generation</projectname> <RoleTypes> <dev/> <qa/> <doc/> </RoleTypes> <member> <name>Jo...

FOP generated PDF borders missing

Hi, I'm having a strange problem with the PDF I've generated using FOP v0.94. The borders are missing at some points. But I've given border="solid 0.5px" for all table-cells. Please see the attached image and the borders in it. Any ideas? ...

How do I disable the titlepage when generating a pdf via docbook and fop?

Not that it is all that entirely practicle, I have a particular customer that is wanting to turn off the title pages in their pdfs that are getting generated. I looked and looked through the docbook fop parameters and documentation and couldn't find a way to disable the titlepage. I found ways to customize however. ...

Using new fonts with Apache FOP in Java

I have to internationalize an application, and therefore have to let a user chose a font for a PDF that I will create at runtime. I want to be able to display a list of font choices from the user's system using GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts(); This works fine for getting fonts, but then it seems that ...

Set PDF title with Java and FOP

Hi, I'm generating some PDF files using Apache FOP v0.94. Can you please tell me how to set the PDF Document Properties like Title, Author, Keywords etc programmatically? Googled a bit but didn't get any useful information. Thanks in advance... ...

Apache Fop for .NET locks external-graphic image - can I force it to close the references?

Something in Apache FOP is locking modify/delete file access rights. Here is the situation.. First, there is a gif file on disk, in a certain location in my web application structure, but more importantly, in a certain physical location on the drive. In the xsl stylesheet, the gif is referenced by absolute physical path through the XS...

In XSL how to you make a block take up a whole page?

In xsl / fop how do you make a block take up exactly the whole page ? Is there something like height = 100%? I want the first page of my pdf to contain a block with dynamic summary that can be a couple of lines only so I don't want the rest of the pdf blocks to be come up on the first page. ...

What does this Apache FOP error mean?

Error message (Location of error unknown)org.apache.fop.fo.Validation Exception: Property id "_Ref191196753" previously used; id values must be unique in document. Any ideas on what may cause this? Is it because I have a for-each and apply the same template multiple times? ...

problem with xsl apply-templates

It seems that my template is never called but the for loop works correctly. It prints "test" exactly the number of times the "car" node exists but "doStuff" doesn't seem to be accessed and "test2" is never outputted. Any ideas? <fo:table-body> <xsl:for-each select="car"> test <xsl:apply-templates select="car" /> </xsl:f...

xsl fo base link problem with password protected pdf in fop 0.95

Hi all. I have successfully generated password protected pdf using xsl fo from apache foundation's fop 0.95 engine. Now the problem comes with the base-link with external-destination specified. Clicking the links work no more. On hover, the link shows the tooltip of the form: "file:///C:/myfolder/some-strange-special-characters". However...

xsl checking variable doesn't seem to work

when I output the value of the node directly for example: <fo:inline><xsl:value-of select="isEnabled" /></fo:inline> I get the correct string outputted in pdf "true".. but if I set the value of isEnabled directly to a variable and then try to do the comparison on it.. it doesn't seem to work as if the node doesn't exist. <xsl:vari...

strange pdf generator issue

Is there a problem with xml tags that have a dash in them?? I am trying to generate a pdf from and xsl and an xml.. I have the following for example: <car> <name>toyotoa</name> <color-value>green</color-value> </car> In my xsl I have something like <fo:inline font-weight="bold"> <xsl:value-of select="name" /> </fo:inline> th...

Display arabic text left to right in pdf using apache fop 0.95

Hi all. We are generating pdf using apache's xsl fo engine, namely fop 0.95. We have been successful in displaying arabic text from xml to pdf. But there is some problem in the direction of the displayed words. If we have 'sangam' (please assume that 'sangam' is in arabic) in xml, it gets displayed as 'magnas'. Has anyone encountered th...

Issue rendering truetype font in SVG

Hi, I'm having an issue with the rendering of a truetype font inside an svg being rendered to a pdf through fop. In the final pdf the font comes out with Times New Roman instead of the truetype font I had expected. The main font family of the document is using Type 1 fonts and are also using font metrics that I generated and these are...

How to display fixed image height and width using xsl-fo with apache fop 0.95

I am trying to fix the height and width of image in pdf generated using fop 0.95. Here is the code used for it <fo:external-graphic src="s\image.png" height="2.00in" width="2.00in"/> Following also does not work <fo:external-graphic src="s\image.png" content-height="scale-to-fit" height="2.00in" content-width="2.00in"/> These giv...

Get width of text with given font in Apache FOP

Hi, I need to programatically get a width of some text (word, specifically) in a given font, size and style, which will be generated in Apache FOP (version 0.95) PDF document. The problem is that I need to know, if given word will fit to a column with a known width, and if it won't - resize to a fitable size. So far I have used java.awt...

Displaying newline character in PDF generated with FOP

Hi, I'm generating a PDF document using FOP. The source XML contains some text data which contains newlines. But when its being shown in PDF, all new lines are converted into spaces. I tried replacing all \n characters with &#xA; in the java code but that is not helping too. How can I display the new lines in PDF document? Can you...

Limit number of pages in FOP output

Hi, I am generating a pdf file using FOP. My requirement is to limit the number of pages in pdf to 2 and the remaining contents can be discarded. Is it possible? Thanks in Advance. ...