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

Free Support Forum - aspose.com

Convert Word Document to JPEG Images on Android Device | Install Fonts to Prevent Text Overlapping

I use Android phone to edit the document. Some of my phones have overlapped or disordered text, and both English and Chinese will appear. I guess because of the font, how should I set the correct font to ensure the typesetting of the document font? Or how can I set the font as the default font of the system?

InkedScreenshot_2020-04-01-18-13-41-30_841797baea012d5_LI.jpg (299.3 KB)
数学2.7.zip (286.3 KB)

@lingengliang,

Please tell, what Android App are you getting this problem with and what Aspose.Words’ code did you use to create this DOCX file? Also, this looks more to be an issue with the Android App you are viewing this DOCX Word document with. As shown in following screenshot, the latest version of WPS Office Android App displays the content of your document correctly on our end.

@awais.hafeez

I wrote the Android application myself, and the above problems occurred when I used Aspose to parse it. But this problem will not appear on all mobile phones, only some mobile phones will have text overlap. I guess it’s because the mobile phone system doesn’t support fonts in the document. How can I adjust the document to fonts in the mobile phone system, or how can I use other font resources?

        //设置页面样式
        if (ObjectUtils.isEmpty(mDocument)) {
            mDocument = new Document(mFilePath);
        }
        //更改字体大小
        int size = mOrientation == Orientation.PORTRAIT ? mPortraitTextSize : mLandscapeTextSize;
        mDocument.accept(new FontChanger(size));
        //设置页面布局
        SectionCollection sections = mDocument.getSections();
        for (Section section : sections) {
            PageSetup pageSetup = section.getPageSetup();
            pageSetup.setTopMargin(PAGE_MARGIN);
            pageSetup.setBottomMargin(PAGE_MARGIN);
            pageSetup.setLeftMargin(PAGE_MARGIN);
            pageSetup.setRightMargin(PAGE_MARGIN);
            pageSetup.setHeaderDistance(PAGE_MARGIN);
            pageSetup.setFooterDistance(PAGE_MARGIN);
        }
        mDocument.updatePageLayout();

        ImageSaveOptions iso = new ImageSaveOptions(SaveFormat.JPEG);
        iso.setPrettyFormat(true);
        iso.setPageCount(1);
        iso.setPrettyFormat(true);
        iso.setUseHighQualityRendering(true);
        List<String> picsList = new ArrayList<>();
        int pageSize = mDocument.getPageCount();
        for (int i = 0; i < pageSize; i++) {
            iso.setPageIndex(i);
            String picPath = PathUtils.getExternalAppDcimPath() + "/" + UUID.randomUUID().toString() + ".jpg";
            mDocument.save(picPath, iso);
            picsList.add(picPath);
        }

@awais.hafeez
Sorry, my problem description is wrong,it’s use aspose.word to open an existing document and saving it as a picture, not editing a new document

@lingengliang,

Please make sure that the following font file are installed/available on the device where you are rendering Word document.

  • 宋体
  • Times New Roman
  • Cambria Math
  • Microsoft Sans Serif

You can copy these fonts from Windows machine and specify path to the folder containing these fonts.