apache fop - adding dam images into the pdf

Avatar

Avatar

jakej40603950

Avatar

jakej40603950

jakej40603950

14-12-2018

Hello,

I'm using Apache FOP to convert page into pdf but i'm unable to add images from DAM into the pdf.

I'm using this tag in the fop xslt

<fo:external-graphic src="sling://content/dam/myproject/img/image.jpeg"/>

and have included the following namespaces into the xslt:

  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

  xmlns:fo="http://www.w3.org/1999/XSL/Format"

  xmlns:jcr="http://www.jcp.org/jcr/1.0"

  xmlns:sling="http://sling.apache.org/jcr/sling/1.0"

  xmlns:dam="http://www.day.com/dam/1.0"

But the image just isn't rendered. What am I doing wrong here?

Any help much appreciated. Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

jakej40603950

Avatar

jakej40603950

jakej40603950

17-12-2018

Actually, I should have mentioned it before - I'm using the FOP API directly to generate the pdf and not the ootb solution AEM comes with.

The ootb solution seems to have a few customizations to the API especially with regards to setting a custom URIResolver.

Similarly, in my case, I had to write a custom URIResolver which would search for the image paths within the repo and not on the file system and configure the API to use this resolver. That has fixed the problem.

More details here:

Apache(tm) FOP: Embedding

Answers (7)

Answers (7)

Avatar

Avatar

Phanindra_Busi

Avatar

Phanindra_Busi

Phanindra_Busi

05-02-2021

Hi jakej40603950,

can you help me on this please

Avatar

Avatar

Phanindra_Busi

Avatar

Phanindra_Busi

Phanindra_Busi

04-02-2021

I wanted to know how you have Created the Custom URI resolver in AEM.

How you have passed the custom URI resolver of AEM into FOP.

Please help me with the same.

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K
smacdonald2008

17-12-2018

thanks for posting your fix!

Avatar

Avatar

jakej40603950

Avatar

jakej40603950

jakej40603950

15-12-2018

No...tried putting them inside etc and apps but the image still doesn't show up.

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K
smacdonald2008

14-12-2018

For a test - if you place the images in aother location - are they picked up?

Avatar

Avatar

jakej40603950

Avatar

jakej40603950

jakej40603950

14-12-2018

That will help a lot. Thank you

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K
smacdonald2008

14-12-2018

I am not sure we have docs for this use case - let me check.