Free Support Forum - aspose.com

Times new roman coverting to TimesNewRomanPSMT

test.zip (159.4 KB)

I am having a problem on both Linux servers and my Windows machine. It is converting to the incorrect times new roman. The font is install because Microsoft office can convert it to PDF perfectly. I am using the following code.

public String convert(String input)  throws Exception {
    // Args contain the file
        Document doc = new Document(input);
        //Update the page layout and TOC
        doc.updateFields();
        doc.updatePageLayout();

        String out_fname = this.mktemppdf();
        doc.save(out_fname);

        return out_fname;
        }
    }

Any help would be appreciated. Also it doesn’t not to any font substitution of fallback during the conversion.

Thanks

@jshields3_baml_com,

Thanks for your inquiry. PDF specification says that PostScript font names should be used. TimesNewRomanPSMT’ is just a PostScript name of the corresponding TimesNewRoman font. This is the expected behavior and Aspose.Words outputs the font names to PDF according to the specifications.

MS Word 2016 uses the same method. We have converted your “link test.docx” document to PDF by using MS Word 2016 and attached the generated PDF here for your reference (see msw-2016.pdf (46.7 KB)).

If we can help you with anything else, please feel free to ask.

Thanks for the quick response.
Is there anyway to not do this because the fonts are a different size which means the document are different size and all the heading are moved around. We want to make an exact copy of the document like MS Word 2013 does.

@jshields3_baml_com,

To reduce generated PDF file size, you can use the following code:
https://apireference.aspose.com/java/words/com.aspose.words/PdfFontEmbeddingMode

Document doc = new Document("D:\\temp\\test\\link test.docx");

PdfSaveOptions opts = new PdfSaveOptions();
opts.setFontEmbeddingMode(PdfFontEmbeddingMode.EMBED_NONE);

doc.save("D:\\Temp\\test\\awjava-18.6.pdf", opts);

Sorry if I wasn’t clear with my problem. The size of the file is not as issue. The size of the text in the converted file is different from the original. That is because it is using the post script version of times new roman. Is there any way to use the original version of Times new roman so the text appears the exact same in the converted document.

@jshields3_baml_com,

Can you please also list the steps here that you used on your end to verify that the size of the text in the converted file (18.6.pdf (35.4 KB)) is different from the original Word document? We will perform the same steps on our end to confirm the difference and provide you more information.

Well the first thing is just to look at the text and you can see it is bigger. If you look at the properties of the document in adobe reader you can see that the font is a different type. Finally if you copy the font from the pdf into a word document and place it beside the original
textDiff.PNG (5.5 KB)

The top line of the picture is the original and the bottom is converted text copied from the PDF. You can clearly see the difference

@jshields3_baml_com,

For the sake of any correction, we have logged this problem in our issue tracking system. The ID of your issue is WORDSNET-16974. We will further look into the details of this problem and will keep you updated on the status of this issue. We apologize for your inconvenience.

Also, please “Save As” your “link test.docx” document to PDF format by using MS Word 2013 on Windows machine and share the NS Word 2013 generated PDF file here for our reference.

@jshields3_baml_com,

Regarding WORDSNET-16974, we have completed the work on your issue and have come to a conclusion that this issue is actually not a bug. So, we have closed this issue as ‘Not a Bug’. Please see the following analysis details:

Aspose.Words writes the “Times New Roman” font to PDF correctly. The fact that text looks different after the copy-paste from PDF to MS Word is related to particularities of Acrobat Reader text extraction. The text is extracted with “TimesNewRomanPSMT” font name which cannot be resolved by MS Word and substituted with “Calibri”. The difference can be clearly visible if comparing original text in Acrobat Reader and extracted text in MS Word. So, it is not a bug of Aspose.Words.

Also when MS Word saves the document to PDF, it does not embed the “Times New Roman” font data unlike the Aspose.Words. If you please open the MS Word PDF document on machine where this font is not installed, Acrobat Reader may substitute the font. This may be the cause of the difference between Aspose.Words and MS Word PDF outputs.