apache-fop

Scale down to fit an image in FOP

余生长醉 提交于 2019-12-06 18:11:18
问题 I am using FOP version 1.0 to create PDFs. In one of the pages I'd like to display an image (2552 x 4200 pixel) and scale it down if it doesn't fully fit on the page. As far as I could see on the mailing list the recommended way of doing this would be following: <fo:external-graphic inline-progression-dimension.maximum="100%" content-height="scale-down-to-fit" content-width="scale-down-to-fit" src="..."/> Unfortunately, that still doesn't display the whole image. The lower part of the image

reduce size of PDF generated with FOP

有些话、适合烂在心里 提交于 2019-12-06 15:55:10
I have unsuccessfully browsed this site (that has so often saved my life in the past) and the web for an answer to this question: I use Java, XSL-FO and FOP to generate PDFs that consist in one or more pages of data and images, each page having a header and a footer containing images themselves. These header and footer are repeated on each and every page of the PDF documents. The images are responsible for a large part of the size of the resulting PDF (about 50 %). I noticed that, by converting them from JPEG to TIFF, and by reducing their resolution, I was able to reduce considerably the size

apache fop fails to generate pdf with latest jre update (java 8 update 73)

感情迁移 提交于 2019-12-06 15:38:01
With Java 7 update xx, pdf was generated in my asp.net application. When I updated the Java version to latest , ie Java 8 Update 73 , its fails to generate pdf. No idea on whats the issue. Tried other updates of Jre 8 , always fails, but works with jre 7 update xx JGlass Baji, while yo're doing things differently, e.g. ASP.Net and IIS instead of tomcat but still using Java 8 this article seems to indicate he got it working with Java 8 and Tomcat. I know it doesnt answer your question 100%, but if the questions just on Java 8 support it looks like it works. An indicator FOP works with Java 8 来源

Processing FOP with parameters

泪湿孤枕 提交于 2019-12-06 14:12:11
HI, I want to use FOP to prepare a XML document for printing (ps/pdf). Is it possible to send parameters to FOP to do conditional formating as exist in xsl processors XSL: <xsl:param name="isDuplicate">no</xsl:param> .... <xsl:if test="$isDuplicate='yes'"> <h2 align="center">Copy</h2> </xsl:if> .... If you're using the fop batch/shell file that comes with the distribution, you can use the --param argument to fop, as d ocumented on the Fop page -param name value <value> to use for parameter <name> in xslt stylesheet (repeat '-param name value' for each parameter) 来源: https://stackoverflow.com

How to convert xsl-fo to docx (Office Open XML) in Java?

大城市里の小女人 提交于 2019-12-06 12:29:48
问题 I'm looking for an open-source or commercial friendly library in Java to convert xsl-fo to docx (Office Open XML) format. I'm planing to use xsl-fo to produce pdf documents (with Apache FOP), so I thought generating Word documents ( docx ) out of the same source XML could be a good idea. UPDATE : I forgot to mention that I'm using Java. 回答1: Alternatively, you could do: your source xml -> docx -> xsl-fo -> pdf. or easier perhaps: source xml -> Flat OPC XML -> xsl-fo -> pdf. Once you have a

FOP Driver Configuration same as FOPFactory

微笑、不失礼 提交于 2019-12-06 10:28:12
问题 I am currently using FOP embedded using Driver as follows Driver driver = new Driver(); driver.setRenderer(Driver.RENDER_PDF); driver.setInputSource(new InputSource(new FileInputStream(tempout))); File tempFile = File.createTempFile("W2P", ".pdf"); FileOutputStream pdfOutput = new FileOutputStream(tempFile); tempFile.deleteOnExit(); driver.setOutputStream(pdfOutput); driver.run(); but i would like to have access to configuration settings programatically specifically the output resolution as I

Use XSL:FO to add attachments to PDF

冷暖自知 提交于 2019-12-06 08:58:44
After resolving inline images with help from SO, I need to sort out inline attachments. PDF can contain attachments and I found: fo:declarations - pdf:embedded-file but again it pointed to an external file. How can I attach a file that is part of a MIME message (most likely BASe64)? In the latest FOP builds, you can use the same syntax for pdf:embedded-file as for fo:external-graphic and directly append the base64 data: <fo:declarations> <pdf:embedded-file filename="myfile.pdf" src="data:application/pdf;base64,<DATA>"/> </fo:declarations> ... <fo:basic-link external-destination="url(embedded

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

最后都变了- 提交于 2019-12-06 08:51:20
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 content of the billing (every position) should flow in between of the all headers and footers automatically

How display preformatted text in a pdf generated by fop?

烈酒焚心 提交于 2019-12-06 04:08:12
问题 Does anyone know how I can display preformatted html text like: <ol> <li>item 1</li> <li>item 2</li> <li>item 3</li> </ol> inside a pdf generated with fop? Thanks 回答1: This XSLT 1.0: <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:strip-space elements="*"/> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template

Apache Batik Transcoder inside Docker Container Blocking

一曲冷凌霜 提交于 2019-12-06 02:53:22
We're running a Spring application within a docker container. Our application can take SVG files and transform them into PDF format to be embedded within a PDF. The application works correctly on osx and transcodes as expected. However when run from inside a docker container, which has a different file system, the transcoder gets stuck and thrashes the cpu in some bizarre recursive file searching loop. java.lang.Thread.State: RUNNABLE at java.io.UnixFileSystem.getBooleanAttributes0(Native Method) at java.io.UnixFileSystem.getBooleanAttributes(UnixFileSystem.java:242) at java.io.File.isFile