Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

HTML to PDF Generation - UnsatisfiedLinkError-Unable to load library error

srikanthp689160
Level 4
Level 4

Hi,

We are using third party library(io.woo.htmltopdf) library to generate PDF out of AEM web page which works fine in localhost publish instance(on windows machine) but in QA or Pre-Prod environments which are on linux box, we see below error

java.util.concurrent.ExecutionException: java.lang.UnsatisfiedLinkError: Unable to load library '/tmp/io.woo.htmltopdf/wkhtmltox/0.12.5/libwkhtmltox.so': Native library (tmp/io.woo.htmltopdf/wkhtmltox/0.12.5/libwkhtmltox.so) not found in resource path (crx-quickstart/app/cq-quickstart-6.5.0-standalone-quickstart.jar)

Can anyone let us know how this issue can be fixed?

We have added below dependencies to the maven project

<dependency>
<groupId>io.woo</groupId>
<artifactId>htmltopdf</artifactId>
<version>1.0.8</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>4.5.2</version>
</dependency>

library PDF
1 Accepted Solution
Ankur_Khare
Correct answer by
Community Advisor
Community Advisor

Could you pls confirm if you are using the same java version on local and other environments?

 

try to use the same java version in ur local and see

View solution in original post

12 Replies
srikanthp689160
Level 4
Level 4
@Anudeep_Garnepudi, i could not understand how to check if dependency packages are installed? Is it on AEM instance? or Linux?
Anudeep_Garnepudi
Community Advisor
Community Advisor
@srikanthp689160 In AEM itself as part of your bundle. Try to add in <Embed-Dependency>dependencies</Embed-Dependency> tag.
srikanthp689160
Level 4
Level 4

@Anudeep_Garnepudi, i have already added them in core pom.xml as below for the two dependencies which we have included

Include-Resource: htmltopdf-1.0.8.jar,jna-4.5.2.jar

Bundle-ClassPath: ., htmltopdf-1.0.8.jar,jna-4.5.2.jar

In a similar way, we need to add for the below native libraries?

  • libc6 (or glibc)
  • libx11
  • libxext
  • libxrender
  • libstdc++
  • libssl1.0
  • freetype
  • fontconfig
srikanthp689160
Level 4
Level 4
@Anudeep_Garnepudi, I could not find maven dependency for any of the below native libraries. Can you please help me on how to get that info?
Anudeep_Garnepudi
Community Advisor
Community Advisor
@srikanthp689160 I think they are not JAR files but packages that needs to be installed. Google each package for more details.
Ankur_Khare
Correct answer by
Community Advisor
Community Advisor

Could you pls confirm if you are using the same java version on local and other environments?

 

try to use the same java version in ur local and see

View solution in original post

srikanthp689160
Level 4
Level 4
@Ankur_Khare, locahost is on Java 8 where as QA and Pre-Prod are on Java 11.
Ankur_Khare
Community Advisor
Community Advisor
try to use the same java version in ur local and see
srikanthp689160
Level 4
Level 4
@Ankur_Khare, update from java 8 to 11 in my local machine might take some time. While i am waiting for java version upgrade, since QA and Stage environments are on Java 11, what can be done to get htmltopdf api working? Any suggestions on this?