[ https://issues.apache.org/jira/browse/FOP-3137?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17745529#comment-17745529 ]
Rafael Witak commented on FOP-3137: ----------------------------------- Hi [~daveroxburgh], thank you for your reply! * Yes, I only put "PDF/input.pdf" as a placeholder, so you could compare the results of including both "original.pdf" and "older.pdf". * No, I did not use an fop.xconf file. During troubleshooting, I included one that had just the fonts and strict-validation set to true in it - but that made no difference. * We have found a workaround of sorts simply by manually re-saving the files as PDF 1.6 in Acrobat. Due to large volumes (and possibly similar problems in the future with other clients' PDFs), that is not an ideal long-term solution, unfortunately. Here's my Main.java: {code:java} public class Main { public static final ClassLoader CLASS_LOADER = Main.class.getClassLoader(); public static void main(String[] args) { try (OutputStream out = new BufferedOutputStream(new FileOutputStream("PDF/output.pdf"))) { TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); InputStream foInputStream = CLASS_LOADER.getResourceAsStream("input.fo"); Source src = new StreamSource(foInputStream); FopFactory fopFactory = new FopFactoryBuilder(new File(".").toURI()) .build(); Fop fop = fopFactory.newFop(MIME_PDF, out); SAXResult saxResult = new SAXResult(fop.getDefaultHandler()); transformer.transform(src, saxResult); } catch (Exception e) { e.printStackTrace(System.err); System.exit(-1); } } } {code} and my pom.xml: {code:xml} <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.example</groupId> <artifactId>FOPtest</artifactId> <version>1.0-SNAPSHOT</version> <name>Archetype - FOPtest</name> <url>http://maven.apache.org</url> <properties> <maven.compiler.source>11</maven.compiler.source> <maven.compiler.target>11</maven.compiler.target> </properties> <dependencies> <dependency> <groupId>org.apache.xmlgraphics</groupId> <artifactId>fop</artifactId> <version>2.8</version> </dependency> <dependency> <groupId>org.apache.xmlgraphics</groupId> <artifactId>fop-pdf-images</artifactId> <version>2.8</version> </dependency> </dependencies> </project> {code} Do you see anything missing there that could cause the problem? > PDF Images - external-document layout broken > -------------------------------------------- > > Key: FOP-3137 > URL: https://issues.apache.org/jira/browse/FOP-3137 > Project: FOP > Issue Type: Bug > Environment: Windows 10.0.19045 Build 19045 > Java 17 > FOP 2.8 > PDF Images 2.8 > Reporter: Rafael Witak > Priority: Major > Attachments: image-2023-07-13-16-46-26-626.png, > image-2023-07-13-16-47-09-093.png, older.pdf, original.pdf, output.pdf > > > When including the PDFs of one of our customers, the layout gets messed up, > turning this: > !image-2023-07-13-16-47-09-093.png|width=349,height=265! > into this: > !image-2023-07-13-16-46-26-626.png|width=350,height=284! > > The customer recently switched to PDF 1.7, all of their PDFs get messed up > ever since. > There are no FOP events in the log, checking the resulting PDF with _pdfcpu_ > validates perfectly, even with strict mode on. > Setting strict-validation in the renderer also doesn't produce any errors. > The problem happens regardless of the version of FOP and fop-pdf-images used. > The FO input for reproduction can be reduced to > {{<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"}} > {{xmlns:fox="http://xmlgraphics.apache.org/fop/extensions">}} > {{ <fo:layout-master-set>}} > {{ <fo:simple-page-master master-name="simple">}} > {{ <fo:region-body/>}} > {{ </fo:simple-page-master>}} > {{ </fo:layout-master-set>}} > {{ <fox:external-document src="PDF/input.pdf" />}} > {{{}</fo:root>{}}}{{{}{}}} > > Various problems regarding layouts are mentioned in the "Known Issues". > There is also the general statement _"Apache FOP currently generates PDF 1.4. > If you include a PDF with a higher PDF version, the results may be > unpredictable."_ to be found (That said, setting different versions in the > renderer did not solve the problem). > Please let me know, if this is out of scope for the project - and if it is, > please provide me with any workarounds you might know of! > > (Included are one of the originals together with its output, as well as an > older PDF of the same customer which works as expected. ) -- This message was sent by Atlassian Jira (v8.20.10#820010)