Embed Fonts

  • SLiM

    SLiM - 2008-09-30

    How does one go about embedding a font into document?

    I utilize the SetFont method for the font that i'm using, but when i perform the WriteTo method to have it save the output pdf... the document fails preflight and states that the font is not embedded.

    Thanks in advance.

    • Stefano Chizzolini


      embedding OpenType/TrueType fonts is just a matter of instantiating an OpenTypeFont object passing a valid file system path of the corresponding font file (see the TypesettingSample included in the downloadable distribution) as parameter, like this:

      OpenTypeFont myFont = new OpenTypeFont(document, fontFilePath);

      after this operation you can use the font wherever you want inside your document, invoking the SetFont method of the PrimitiveFilter class:

      builder.SetFont(myFont, 10);

      I'm sorry but the description of your issue is way too vague to suggest something useful. What kind of font are you using? What's the exception stack trace?

      Please consider that at the moment  eastern fonts (for example: arabic, hebrew, indic, CJK and so on) have not been tested yet. Moreover, right-to-left writing systems are currently not supported.



Log in to post a comment.