apache-fop

Generating PDF from XML in Java using ApacheFOP

心已入冬 提交于 2019-12-23 12:45:15
问题 I am trying to generate on-the-fly PDF reports from Java objects. I have not been able to find many examples of this, so I have been following this example: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleObj2PDF.java?view=markup The only real difference between this code and my own is that I generate src (line 81 in the example) using JSON conversion and an XMLSerializer. The problem I run into is using the Transformer. When I do the transform

Apache FOP from Java with XSLT 2.0…?

独自空忆成欢 提交于 2019-12-23 12:19:09
问题 I'm having problems using some of the features of XSLT 2.0 in an embedded use of Apache FOP 1.0. In particular I get an exception when using "current-group()". I see that FOP is using xalan 2.6 which is throwing the exception. I tried to exclude the transitive dependency of xalan 2.6 and replaced it with 2.7.1 but it didn't help. Is it possible to use Apache FOP with another XSLT processor that supports more 2.0 features? 回答1: If you run FOP as standalone distribution from command line, you

What does reference-orientation really do?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 09:49:05
问题 I have to render a pfd using FOP, and some images mst be rotated. The result however doesn't look the way I expect it to be. So, here is my question (and I somehow wasn't able to find a good documentation to clarify this issue for me): If I define fo:block-container reference-orientation="90" width="100" height="200" will this rotate the whole container (leading effectively to a rendered box of dimension 200x100), or will it merely rotate the content of the container (leaving the container

Return as ByteArrayOutputStream instead of FileOutputStream

◇◆丶佛笑我妖孽 提交于 2019-12-23 06:37:26
问题 I have a requirement to generate PDF file from JSON Objects and am able to produce PDF document using Apache FOP and Java. But i want to return the PDF file as ByteArrayOutputStream and then i have to encode like this Base64.getEncoder().encodeToString(baos.toByteArray()) . Please find the below code where am able to generate PDF file, instead of FileOutputStream i want to return as ByteArrayOutputStream . ByteArrayOutputStream outStream = new ByteArrayOutputStream(); Transformer

fo:instream-foreign-object does not show the image properly

扶醉桌前 提交于 2019-12-23 05:07:43
问题 I use the below code to show a PNG image in PDF. I use <fo:instream-foreign-object> because <fo:external-graphic> does not fulfil my requirement to show a image. Refer to issue external graphic <fo:instream-foreign-object width="50%" content-width="scale-to-fit"> <svg> <image height="439px" width="1037px" xlink:href="test.png"/> </svg> </fo:instream-foreign-object> With the above use, I am not able to get the picture in the document. The image is not properly placed in the page and the text

XSL-FO Different header/footer depending on page-position

坚强是说给别人听的谎言 提交于 2019-12-22 12:25:36
问题 This might be a quite common problem with XSL-FO: I try to build a billing which has clear specifications: "Main Header": on every page (Text, Logo and Barcode) "Sub Header": (Customer Data) -> On the first page this block should be about 10% of the pages height -> On all the others page this block should be about the half smaller, so lets say 5% "Last-Page Footer": just on the last page of course (Total amount and signatures) "Every-page Footer": just for the printing date "Body": the

How to change Apache FOP Xalan XSLT Processor?

天涯浪子 提交于 2019-12-21 16:57:30
问题 I am using Apache FOP 1.1.I want to change current apache Xalan XSLT processor to other for supporting XSLT 2.0. Currently it is not supporting XSLT 2.0. Please help me how to solve this problem. thank you. 回答1: I got my Answer. TransformerFactory has a plug-ability layer. JAXP provides a common Java interface that allows flexibilty to add various implementations of the supported standards XSLT processors. TransformerFactory tFactory = TransformerFactory.newInstance(); This had look-up

Inline image data in XSL:FO / Apache FOP

我只是一个虾纸丫 提交于 2019-12-21 04:12:08
问题 I have MIME Multi-Part data that I want to convert to PDF using XSL:FO. I'm comfortable reading MIME using Apache James and I have a grasp on embedded image data in Mime or inline images in HTML. I diligently searched SO for "[xsl-fo] inline graphic" and "[xsl] +html +mime +image" and found somehow the opposite and a precurser what I'm up to. Also Google on "convert HTML MIME to XSL:FO" was inconclusive. What I want to do is having an element (or a set of elements) that render a graphic (JPG

Inline image data in XSL:FO / Apache FOP

让人想犯罪 __ 提交于 2019-12-21 04:10:02
问题 I have MIME Multi-Part data that I want to convert to PDF using XSL:FO. I'm comfortable reading MIME using Apache James and I have a grasp on embedded image data in Mime or inline images in HTML. I diligently searched SO for "[xsl-fo] inline graphic" and "[xsl] +html +mime +image" and found somehow the opposite and a precurser what I'm up to. Also Google on "convert HTML MIME to XSL:FO" was inconclusive. What I want to do is having an element (or a set of elements) that render a graphic (JPG

Remove whitespace/blank spaces in table columns XSL-FO

笑着哭i 提交于 2019-12-20 07:14:46
问题 The link has a table in a PDF generated using Apache-FOP. I am unable to remove the blank spaces/empty spaces in the table column headers and column values. The PDF has limitation of 120 characters and thus unable to display all the text. The application does supply the column width. But unsure how to use it in the xsl-fo file Please suggest how to define widths of the table columns to hold only the text and without any blank/unused spaces. 回答1: Use fo:table-column (see https://www.w3.org/TR