Free Support Forum - aspose.com

Convert PDF to JPG in Java - Output has missing content - Landray RDM 94099

pdf source code:
src.zip (4.4 KB)

origin pdf:
星盛-寰球201911.pdf.zip (9.6 KB)

converted problem:
convert error.jpg (118.1 KB)

It was missed content.please have a check.

@hucq_landray_com_cn,

I have worked with source files and sample code shared by you using Aspose.Pdf and unable to observe the issue. Can you please share environment details along with version which you are using on your end. I have also shared my generated result for your kind reference.111r.jpg (20.7 KB)

Error information:

org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)

Caused by:java.lang.NoClassDefFoundError: jdk/nashorn/internal/runtime/regexp/RegExp

com.aspose.pdf.internal.l4y.l1h.lI(Unknown Source)
com.aspose.pdf.internal.l4y.l1h.l2n(Unknown Source)
com.aspose.pdf.internal.l4y.l1h.l1u(Unknown Source)
com.aspose.pdf.internal.l4y.l1h.lk(Unknown Source)
com.aspose.pdf.internal.l4y.l1h.l0y(Unknown Source)
com.aspose.pdf.internal.l4y.l2t.l0y(Unknown Source)
com.aspose.pdf.internal.l3h.lj.lI(Unknown Source)
com.aspose.pdf.internal.l2u.l0h.lf(Unknown Source)
com.aspose.pdf.internal.l2u.l0h.lt(Unknown Source)
com.aspose.pdf.internal.l2u.lu.lf(Unknown Source)
com.aspose.pdf.internal.l2u.lu.lI(Unknown Source)
com.aspose.pdf.devices.lI.lI(Unknown Source)
com.aspose.pdf.devices.lI.lI(Unknown Source)
com.aspose.pdf.devices.ImageDevice.lI(Unknown Source)
com.aspose.pdf.devices.PngDevice.processToBufferedImage(Unknown Source)
com.landray.converter.executor.aspose.AsposePdfConverter.toPic(AsposePdfConverter.java:149)
com.landray.converter.executor.aspose.AsposePdfConverter.doConvert(AsposePdfConverter.java:63)
com.landray.converter.executor.aspose.AsposeToHTMLConverter.doPdfConvert(AsposeToHTMLConverter.java:97)
com.landray.converter.executor.aspose.AsposeToHTMLConverter.convert(AsposeToHTMLConverter.java:41)
com.landray.converter.executor.AsposeExecutorMain.main(AsposeExecutorMain.java:66)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)

I used the version of aspose-pdf-20.7.jar to convert this 星盛-寰球201911.pdf.zip (9.6 KB),it was error,please tell me how to settle it.

@hucq_landray_com_cn

We were unable to notice any exception in our environment while testing the scenario with Aspose.PDF for Java 20.7. Please check following code snippet that we used for testing purpose:

Document pdfDocument = new Document(dataDir + "星盛-寰球201911.pdf");
for (Page page : pdfDocument.getPages()) {
 java.io.OutputStream imageStream = new java.io.FileOutputStream(dataDir + "Converted_Image_" + page.getNumber() + ".jpg");
 com.aspose.pdf.devices.Resolution resolution = new com.aspose.pdf.devices.Resolution(162);
 com.aspose.pdf.devices.JpegDevice jpegDevice = new com.aspose.pdf.devices.JpegDevice(resolution, 162);
 jpegDevice.process(page, imageStream);
 imageStream.close();
}

Would you kindly make sure that the font used in attached PDF is installed in your system. In case you still face any issue, please let us know.

But it was successful by java 20.6 in my macbook,I didn’t change any code,just replaced java 20.6 to java 20.7.I don’t know how to deal with it.

@hucq_landray_com_cn

Please try to clean all the JARs and deploy them again. Also, try to change the path of maven local repository in your system and let us know in case it helps. Otherwise, please share complete environment details i.e. OS name and version, JDK Version, Application type, etc. with us. We will further proceed to assist you accordingly.