How to Force the Use of Custom Fonts During Word to PDF Conversion?

I am testing the following API for converting Word to PDF:
https://api.aspose.cloud/v4.0/words/convert?format=pdf&storage=TEST&fontslocation=xxx

I have specified the fontslocation parameter, assuming that it would enforce the use of custom fonts. However, it doesn’t seem to always work as expected.

Is there a way to ensure that custom fonts are always used during the conversion process? For example, is there a specific option or setting to disable default or embedded fonts and prioritize custom fonts exclusively?

Any guidance would be greatly appreciated.

@nstock

To ensure that custom fonts are used during the conversion of Word documents to PDF with the Aspose.Words Cloud API, you can utilize the fontsLocation parameter effectively. This parameter allows you to specify a path to a cloud storage folder where your custom fonts are stored. The API will check this location for any missing fonts that are referenced in your Word document.

Here are some key points to consider:

  1. Custom Fonts Location: Upload your custom fonts to a designated folder in your cloud storage. You can then pass the path of this folder in the fontsLocation parameter when making the conversion request.

  2. Fallback Mechanism: The fontsLocation parameter is specifically used when the API cannot find the referenced font in its own font resources. Therefore, it will only be utilized for missing fonts. If the fonts are available on the server, the API may not prioritize the custom fonts.

  3. Example Request: Here’s an example of how to structure your API request to convert a DOCX file to PDF while specifying the custom fonts location:

    curl -X PUT "https://api.aspose.cloud/v4.0/words/convert?format=pdf&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
    
  4. Limitations: If the fonts are not missing and are available on the server, the API may not use the custom fonts from your specified location. Unfortunately, there is no specific option to disable default or embedded fonts entirely.

If you continue to experience issues with font usage during conversion, consider reaching out to Aspose support for further assistance.

Sources:
[1]: Export DOCX to PDF Without Losing Font Formatting with Aspose.Words REST API

The API loads all fonts you specified, and if the document is converted with a font issue, it is either the wrong font version or some document-specific issue.
Please share your document along with fonts you want to be applied, I will create an issue for investigation.