[
https://issues.apache.org/jira/browse/FOP-3179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17848178#comment-17848178
]
Andreas Schlegel edited comment on FOP-3179 at 5/21/24 11:54 AM:
-----------------------------------------------------------------
{quote}[~jgoncalves] we have a stylesheet, a XML created by JAXB and this is
essentially the code for the transformation.
final FOUserAgent foUserAgent = this.fopFactory.get().newFOUserAgent();
foUserAgent.setPdfUAEnabled(true);
foUserAgent.setTitle("xyz");
try (final ByteArrayOutputStream out = new java.io.ByteArrayOutputStream()){
// Construct fop with desired output format
final Fop fop = this.fopFactory.get().newFop(MimeConstants.MIME_PDF,
foUserAgent, out);
final Transformer transformer = this.noticeXslt.newTransformer();
transformer.setParameter("versionParam", "2.0");
// Setup input for XSLT transformation
final Source src = new StreamSource(new StringReader(xmlTemplate));
final Result res = new SAXResult(fop.getDefaultHandler());
// Start XSLT transformation and FOP processing
transformer.transform(src, res);
return out.toByteArray();
}
was (Author: JIRAUSER305469):
[~jgoncalves] we have a stylesheet, a XML created by JAXB and this is
essentially the code for the transformation.
{quote} final FOUserAgent foUserAgent =
this.fopFactory.get().newFOUserAgent();
foUserAgent.setPdfUAEnabled(true);
foUserAgent.setTitle("xyz");
try (final ByteArrayOutputStream out = new
java.io.ByteArrayOutputStream()) {
// Construct fop with desired output format
final Fop fop =
this.fopFactory.get().newFop(MimeConstants.MIME_PDF, foUserAgent, out);
final Transformer transformer = this.noticeXslt.newTransformer();
transformer.setParameter("versionParam", "2.0");
// Setup input for XSLT transformation
final Source src = new StreamSource(new StringReader(xmlTemplate));
final Result res = new SAXResult(fop.getDefaultHandler());
// Start XSLT transformation and FOP processing
transformer.transform(src, res);
return out.toByteArray();
}
{quote}
> bounding box on image is not where it should be (PDF/UA)
> --------------------------------------------------------
>
> Key: FOP-3179
> URL: https://issues.apache.org/jira/browse/FOP-3179
> Project: FOP
> Issue Type: Bug
> Components: image/unqualified
> Affects Versions: 2.9
> Environment: Windows 10
> Reporter: Andreas Schlegel
> Priority: Major
> Attachments: any-image.jpg, example.pdf, notice.pdf, notice.xml,
> notice.xsl, screenshot--image-and-bbox-in-axesPDF.png
>
>
> Our code generates a PDF file with image and bounding box. But the image and
> bounding box are not on top of each other (see attached example.pdf and open
> it with axesPDF ).
> If the bounding box is missing, the image cannot be displayed at all or not
> correctly in alternative representations.
> If you use the axesPDF tool
> (https://www.axes4.com/de/software-services/axespdf/download), you can see
> that the bounding box is always placed in the bottom left corner of the
> respective page.
>
> PAC3 doesn't show any error except white spaces instead of images
> (screenreader preview) but this is not classified as error.
>
> *** Settings:
>
> pom.xml:
> <version.fop>2.9</version.fop>
>
> <dependency>
> <groupId>org.apache.xmlgraphics</groupId>
> <artifactId>fop</artifactId>
> <version>${version.fop}</version>
> </dependency>
>
>
> fop.conf
> <renderers>
> <renderer mime="application/pdf">
> <version>1.6</version>
> <pdf-ua-mode>PDF/UA-1</pdf-ua-mode>
> ...
>
> xsl:
> <fo:block-container position="fixed" left="24mm" top="24mm">
> <fo:block role="P" position="fixed" left="24mm" top="24mm">
> <fo:external-graphic position="fixed" left="24mm" top="24mm"
> src="any-image.png" fox:alt-text="xyz">
> </fo:external-graphic>
> </fo:block>
> </fo:block-container>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)