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

Free Support Forum - aspose.com

Error saving word document as PDF with Jokerman font

I’m receiving an error when saving a word document to PDF.

The word document contains a textbox with Jokerman font. The resulting error is: “Value cannot be null. Parameter name: trueTypeFont”.

Is this a bug or known limitation? Any help would be appreciated.

I am using Aspose.words for .NET version 17.5.0.0 and Aspose.Pdf for .net version 17.4.0.0.

Attahced is an example word document that causes this error.

jokerman3.zip (10.1 KB)

@jcapell

Thanks for your inquiry. We have tested the scenario with your shared document using Aspose.Words for .NET 17.9 and we are unable to notice any exception. Please download and try latest version of Aspose.Words for .NET, hope it will resolve the issue. However, if the issue persists then please share your sample code(without compilation errors) to replicate the issue at our end. We will look into the issue and will guide you accordingly.
AW179.pdf (25.7 KB)

var document = new Document(@"jokerman3.docx");
document.Save(@"AW179.pdf");

I am able to reproduce this error using the exact code you are using, but only on a freshly installed machine that does not have MS Office installed.

The previously attached document displays the error behavior as a result of having both the Jokerman font as well as the wavy transformation effect on the text. The error only happens if both of those are being used.

@jcapell

Thanks for your feedback. Please note that Aspose.Words requires TrueType fonts when rendering documents to fixed-page formats (e.g. Tiff, PDF, XPS or SWF). Make sure you have all the Fonts installed on the machine you are using. Please check following documentation link for more details. Furthermore, you may implement IWarningCallback to get notification of missing fonts and install these fonts accordingly.

How Aspose.Words uses True Type Fonts

Document docWord = new Document("Input.docx");
docWord.WarningCallback = new HandleDocumentWarnings();
docWord.Save("Output.pdf");


public class HandleDocumentWarnings : IWarningCallback
{
    /// <summary>
    /// Our callback only needs to implement the "Warning" method. This method is called whenever there is a
    /// Potential issue during document processing. The callback can be set to listen for warnings generated during document
    /// Load and/or document save.
    /// </summary>
    public void Warning(WarningInfo info)
    {
        // We are only interested in fonts being substituted.
        if (info.WarningType == WarningType.FontSubstitution)
        {
            Console.WriteLine("Font substitution: " + info.Description);
        }
    }
}

Thanks so much.

We have installed the Jokerman font on the machine performing the conversion. It still throws an exception. The error happens when we have the wavy effect added to the text.

@jcapell

Thanks for your feedback. Please confirm have you implemented the IWarningCallback and you are getting missing fonts notification? Please also share your sample code and confirm your environment details, so we will try to replicate the issue at our end for further investigation.

Thanks so much for the help. We have resolved this issue by ensuring the Jokerman font is present on the machine performing the conversion.

For the sake of completeness, I wanted to reiterate that the error we were receiving was due to an exception. Based on my best understanding, I would expect a font substitution to happen, but I would not expect an unhandled exception.

When we remove the “wavy” text transformation from the source word document, we get a font substitution without the exception.

I’ve attached my code used to debug this, including a screen capture of the output which includes the exception information and stack trace. I don’t need any further assistance on this issue, but perhaps it will be useful to you for debugging.
JokermanDocumentTest.zip (160.5 KB)

@jcapell

Thanks for your feedback. It is good to know that you have managed to resolve the issue. However, I am afraid I am still unable to replicate the issue at my end, even I have tried the scenario on couple of machines. It seems your system specific issue.