Original Docx (12.1 KB)
PDF produced by aspose.app converter (38.7 KB)
PDF produced by cloudconvert (258.4 KB)
PDF produced by Microsoft Word (264.8 KB)
Summary: My expectation is that all 3 PDF’s are almost identical. The Word and CloudConvert PDF’s are close to identical, but the Aspose PDF failed to use the Arial font.
Explanation: This docx contains some text in the Arial font, which is supplied to our docker-based on-premise deployment of Aspose Words. Word and CloudConvert both render the Arial text properly, but Aspose does not include the Arial font in the PDF. The aspose.app PDF attached, was generated by the following site:
Therefor I don’t believe this to be a case of a missing font in our on-premise deployment, but rather an issue with Aspose Words functionality. Finally, other docx files with Arial fonts do produce a PDF with the Arial font correctly used, so it’s something specific to the way the Arial font is used in this docx.
@rucontract
You are facing problem due to missing custom fonts when you export DOCX to PDF with Aspose.Words REST API. Each conversion tool/app has different logic for the replacement of missing custom fonts. For example, signature fields on the first page of your Word document are using Helvetica Neue font and it is being replaced with Arial/Times New Roman in different conversion apps/tools.
Aspose.Words Cloud API provides a fontsLocation parameter in convert APIs. You can upload your custom font to a cloud storage folder and pass the folder path in fontsLocation. The API will check fonts in that folder for missing fonts.
Convert DOCX to PDF With Custom Fonts
curl -X PUT "https://api.aspose.cloud/v4.0/words/convert?format=pdf&fileNameFieldValue=sourceFilename&fontsLocation=Fonts"
-H "accept: application/octet-stream"
-H "Authorization: Bearer [Access_Token]"
-H "Content-Type: multipart/form-data"
-F Document="@C:/Temp/Sample.docx"
--output C:/Temp/Sample.pdf
Thanks @tilal.ahmad , that makes sense! So both the Aspose Cloud, and our on-prem deploy, are missing Helvetica Neue, and then defaulting to a different font than CloudConvert is.
One clarifying question - if I set fontsLocation, that will only take effect when selecting a default font for when the requested font is missing? I have loaded up many fonts already so I’m a little confused on why and how the fontsLocation defines the font to use when the requested font is missing.
@rucontract
The fontsLocation is used if Aspose.Words Cloud API cannot find the referenced font in the Cloud server fonts resource. So yes it will be used for missing fonts only. Please feel free to contact us If you face any issues in this regard.