Free Support Forum - aspose.com

How to retain the font size on pdf creation

Hi,

We combine the 3 different documents(FP.docx, UM.doc(wml format), LAS.docx) into a single document and then convert that document to a pdf. Upon pdf creation we specify the fonts folder path in linux env, and it creates a pdf document, which is attached. If you notice the font size in pdf, it has not retained the size of the font against the same text in the docx. Can you please let us know how can we acheive this.

Here is the code I use to create a pdf

ByteArrayOutputStream bAOS = new ByteArrayOutputStream();
if("PDF".equals(returnDocType) ){

log.debug("Saving ByteStream as PDF");

log.debug("fontsDirPath "+fontsDirPath);

FontSettings.setFontsFolders(new String[] {fontsDirPath}, true);

finalDoc.save(bAOS,SaveFormat.PDF);

}

for reference we use this to merge the docs

Document FP;

FP.appendDocument(LAS, ImportFormatMode.KEEP_SOURCE_FORMATTING)

regards

Hari

We tried with ms fonts and it causes text wrapping, and also with liberation fonts and it prints in the type writer format in linux. Can someone please respond if this can be possible as we are using this in a high value application?