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

Free Support Forum - aspose.com

Convert PDF to JPEG using Aspose.PDF - localized characters become boxes in output

Hi! Dear engineer:
I am micheal. I use jpegDevice to transform pdf to jpg,but the image looks not good. some localized characters cannot display. The characters looks like boxes. How to resolve this issue?

Thank you!

19期培训发票.pdf (40.4 KB)
19期培训发票0001.jpg (328.5 KB)

@liaoxb03

Thanks for contacting support.

Can you please share sample code with us for further investigation along with version details so that we may further investigate to help you out.

    hi,Adan! The Version I Use is  aspose.pdf  11.8.0. My codes  like bellow:
            String pdfFile="D:/19期培训发票.pdf";
            com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(pdfFile);
            PageCollection pages = pdfDocument.getPages();
            int totalPage = pages.size();
            for (int index = 1; index <= totalPage; index++) {
                Page currentPage = pages.get_Item(index);
                double pageWidth = currentPage.getPageInfo().getWidth();
                String imageName = index+".jpg";
                String imageFolder="D:/"
                File file = new File(imageFolder + imageName);// output file
                FileOutputStream fileOS = new FileOutputStream(file);
                int resolution = (int) Math.round(1400* 71.98 / pageWidth);
                Resolution reso = new Resolution(resolution);  
                JpegDevice jpegDevice = new JpegDevice(reso);
                jpegDevice.process(currentPage, fileOS);
                currentPage.dispose();
                fileOS.close();
            }
            pdfDocument.dispose();

@liaoxb03,

I like to inform that code snippet you have shared includes some undeclared variables so would you please share your SSCCE code reproducing the issue so that we may try to reproduce and investigate it in our environment. Also you are using legacy version of API. Can you please try to use Aspose.PDF latest version 20.4 on your end.

I have modified the codes above. Please have a look. Thank you!

@liaoxb03,

We have tested the scenario in our environment and were able to notice the issue. We have logged it as PDFJAVA-39358 in our issue tracking system. We will further look into details of the issue and keep you posted with the status of its correction. Please be patient and spare us little time.

We are sorry for the inconvenience.