Hi all,
I'm trying to use Apache PDFBox for a workflow step (version 3.0.1) and the maven build runs in my local. However I see that my bundle fails to install and the org.apache.pdfbox cannot resolve in the AEM author.
Solved! Go to Solution.
Views
Replies
Total Likes
To get this working, I used version 5.5.13 of IText Core on our AEM author and included it in both my parent pom and core pom.
<!-- iTextPDF -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.13</version>
</dependency>
https://mvnrepository.com/artifact/com.itextpdf/itextpdf/5.5.13.3
can you please provide you pom.xml entry for pdfbox
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>3.0.1</version>
<scope>compile</scope>
</dependency>
or you can try embed explicitly to the maven-bundle-plugin
<Embed-Dependency>
pdfbox;scope=compile|runtime
</Embed-Dependency>
Here's my entry for pdfbox in the pom:
<!-- Apache PDF Box -->
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>3.0.1</version>
<scope>compile</scope>
</dependency>
Hi @stiegjo22
AEM works with very lower versions of PDFBOX only. Might be this the limitation while you are working in AEM, so keep these things in mind.
I went down to version 2.0.9 and it still failed. Does anyone know what is the lowest version that works with AEM? Thanks.
try 1.8.0 below
in some threads, it worked with 1.6.0
I tried with lower versions of PDFBOX - 1.8.0 and 1.6.0. Both show the same error message after running a maven build and deploying to AEM author 6.5.18.
Do you see pdfbox as part of your /system/cobsole/bundles...
if not, can you please download jar and try uploading one manually just for quick verification or download in local have this as part of code and upload as external jar through code.
Hi @stiegjo22
Please check the correct dependency using dependency finder.
http://localhost:4502/system/console/depfinder
If dependency does not exists then you need to installed the pdfbox bundle in AEM, using embedded; Example
Also In your POM you added dependency scope as compile, thats means dependency will only be available for compile time.
Now I'm trying to use a different PDF library - https://mvnrepository.com/artifact/com.itextpdf/kernel
I've added the Maven Bundle Plugin to my project's pom.xml file and specified instructions such as Export-Package.
<!-- Maven Bundle Plugin -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>4.1.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Import-Package>
com.itextpdf.kernel.*;version="[8.0,9)",
com.itextpdf.io.*;version="[8.0,9)", *
</Import-Package>
<Export-Package>
com.itextpdf.bundle;version="1.0.0"
</Export-Package>
<Embed-Dependency>
itext.kernel;version="[8.0,9)",scope=compile|runtime
</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
</instructions>
</configuration>
</plugin>
However I can't find the com.itextpdf.bundle in the 'Target" directory after running maven clean install.
did you add itextpdf kernel dependency ?
<!-- iText Kernal -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>kernel</artifactId>
<version>8.0.3</version>
</dependency>
is it downloading the dependencies ?
try (force) mvn clean install
check your .m2 folder for the libraries (settings.xml)
To get this working, I used version 5.5.13 of IText Core on our AEM author and included it in both my parent pom and core pom.
<!-- iTextPDF -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.13</version>
</dependency>
https://mvnrepository.com/artifact/com.itextpdf/itextpdf/5.5.13.3