We're sorry GroupDocs doesn't work properply without JavaScript enabled.

Free Support Forum - groupdocs.com

HTML to PDF Conversion Not working in Java

Hi,
I am trying to convert HTML to PDF while doing so it throws below exception after 4 to 5 mins
class com.groupdocs.conversion.exceptions.GroupDocsConversionException:
class com.groupdocs.conversion.internal.c.a.pd.internal.l42t.lk cannot be cast to class com.groupdocs.conversion.internal.c.a.pd.internal.l42u.l1u
(com.groupdocs.conversion.internal.c.a.pd.internal.l42t.lk and com.groupdocs.conversion.internal.c.a.pd.internal.l42u.l1u are in unnamed module of loader ‘app’)

am using JAVA GroupDocs Conversion version 20.10.2.
it is not a file-specific.

ConverterSettings  converterSettings =  new ConverterSettings();
Converter converter = new Converter(inputFilePath,converterSettings);
 PdfConvertOptions convetOptions = new PdfConvertOptions();
converter.convert(outputFilePath, convetOptions);
converter.dispose();

Thanks.

@swapnilkumbhar

We cannot reproduce this issue using v27.1. Could you please try it with latest API version? Have a look at the source and output files.zip (35.3 KB).

@Atir_Tahir

I don’t find that version V27.1 you mentioned,
But, I have tried latest version 21.7 available here https://downloads.groupdocs.com/conversion/java
and using that version 21.7 am getting the following error

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.groupdocs.conversion.internal.c.a.ps.internal.gJ.c (file:/C:/Users/swapnilk/.m2/repository/com/groupdocs/groupdocs-conversion/21.7/groupdocs-conversion-21.7.jar) to field java.io.ByteArrayInputStream.buf
WARNING: Please consider reporting this to the maintainers of com.groupdocs.conversion.internal.c.a.ps.internal.gJ.c
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Aug 24, 2021 2:14:17 PM com.groupdocs.conversion.internal.c.a.w.internal.Ny u
SEVERE: 
java.lang.UnsatisfiedLinkError: 'java.util.Map com.groupdocs.conversion.internal.c.a.w.WindowsNativeCall.readRegistryStringValues(int, java.lang.String)'
	at com.groupdocs.conversion.internal.c.a.w.WindowsNativeCall.readRegistryStringValues(Native Method)
	at com.groupdocs.conversion.internal.c.a.w.internal.Qi.readRegistryStringValues(Unknown Source)
	at com.groupdocs.conversion.internal.c.a.w.internal.sl.b(Unknown Source)
	at com.groupdocs.conversion.internal.c.a.w.internal.abt.piA(Unknown Source)
	at com.groupdocs.conversion.internal.c.a.w.internal.abt.b(Unknown Source)
	at com.groupdocs.conversion.internal.c.a.w.SystemFontSource.getFontDataInternal(Unknown Source)
	at com.groupdocs.conversion.internal.c.a.w.internal.Kn.oPU(Unknown Source)
	at com.groupdocs.conversion.internal.c.a.w.internal.Kn.oPT(Unknown Source)
	at com.groupdocs.conversion.internal.c.a.w.internal.Rs$1.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
	at java.base/java.lang.Thread.run(Thread.java:832)

Aug 24, 2021 2:14:17 PM com.groupdocs.conversion.internal.c.a.w.internal.Ny u
SEVERE: 
java.lang.UnsatisfiedLinkError: 'java.util.Map com.groupdocs.conversion.internal.c.a.w.WindowsNativeCall.readRegistryStringValues(int, java.lang.String)'
	at com.groupdocs.conversion.internal.c.a.w.WindowsNativeCall.readRegistryStringValues(Native Method)
	at com.groupdocs.conversion.internal.c.a.w.internal.Qi.readRegistryStringValues(Unknown Source)
	at com.groupdocs.conversion.internal.c.a.w.internal.sl.b(Unknown Source)
	at com.groupdocs.conversion.internal.c.a.w.internal.abt.piA(Unknown Source)
	at com.groupdocs.conversion.internal.c.a.w.internal.abt.b(Unknown Source)
	at com.groupdocs.conversion.internal.c.a.w.SystemFontSource.getFontDataInternal(Unknown Source)
	at com.groupdocs.conversion.internal.c.a.w.internal.Kn.oPU(Unknown Source)
	at com.groupdocs.conversion.internal.c.a.w.internal.Kn.oPT(Unknown Source)
	at com.groupdocs.conversion.internal.c.a.w.internal.Rs$1.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
	at java.base/java.lang.Thread.run(Thread.java:832) 

Let me know if any fix for it.
Thanks.

@swapnilkumbhar

Please confirm if you are getting output as well. Meanwhile, we are investigating this exception. Your investigation ticket ID is CONVERSIONJAVA-1399. You’ll be notified in case of any update.

@Atir_Tahir
Yes, I am getting output files after an exception is thrown.
How can we create single Page PDF while converting, any options for that?

1 Like

@swapnilkumbhar

We are further looking into this scenario (converting HTML to single paged PDF). Your investigation ticket ID is CONVERSIONJAVA-1400. We’ll update you in case of any update or workaround.