Expand my Community achievements bar.

SOLVED

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

Avatar

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>

1 Accepted Solution

Avatar

Correct answer by
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

14 Replies

Avatar

Community Advisor

Hi @srikanthp689160 

Check the below link and try adding the native dependencies.

https://github.com/wooio/htmltopdf-java/blob/master/README.md#troubleshooting

Hope this will resolve your issue.

AG

@Anudeep_Garnepudi, i could not understand how to check if dependency packages are installed? Is it on AEM instance? or Linux?

Avatar

Community Advisor
@srikanthp689160 In AEM itself as part of your bundle. Try to add in <Embed-Dependency>dependencies</Embed-Dependency> tag.

Avatar

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
@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?

Avatar

Level 1

Hi @srikanthp689160,

We are facing this similar issue in AEM as Cloud Service.
Did you find any way to add the native libraries in AEM, can you suggest any solution which you followed for resolving this, or help with any other approach you followed for converting HTML to PDF.

 

@Ankur_Khare Can you please reshare the link you added as an answer below (404 - File or directory not found. (iditect.com)), since that is not opening now.

 

 

 

Avatar

Community Advisor
@srikanthp689160 I think they are not JAR files but packages that needs to be installed. Google each package for more details.

Avatar

Correct answer by
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

Avatar

Level 4
@Ankur_Khare, locahost is on Java 8 where as QA and Pre-Prod are on Java 11.

Avatar

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

Avatar

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?