Jump to content
We've recently updated our Privacy Statement, available here ×
  • What is the purpose of "Embed this font in PDF Document"


    ghudson_1
    • Version: v6.4 Product: JasperReports® Server

    Issue Description

    When creating font extensions in Studio, there is a checkbox for "Embed this font in PDF Document". We explain its purpose below

    As indicated in the Studio User Guide link below, font extensions are helpful in forcing proper associations of fonts with PDF files created by JasperReports Server and the JasperReports API https://community.jaspersoft.com/documentation/tibco-jaspersoft-studio-user-guide/v640/fonts . When creating font extensions in Studio, there is a checkbox for "Embed this font in PDF Document". We explain its purpose below

    studio_embed.png.781b4242f2ab5ac921e2597f10cb9c82.png


    Resolution

    The documentation describes the checkbox as a "Flag that specifies whether to embed the font in a generated PDF or not. Embedding fonts is recommended to ensure consistency across platforms"

    During generation of the PDF, the java libraries comprising JRS, iText api and the JVM require a font. If they can't find a specified physical font (.TTF file for example) they find a logical find using their best approximation, or guess or a mapping that has been defined within the JVM on the server.

    So if the font defined in the jrxml tags either has not been installed via a font extension or has not been added to the JVM running the appserver, then a default font will be used and this will be evident when you hit File -> Properties -> Font within the pdf file.  You will see that the PDF references a font different from your jrxml tags unless your are using one of the PDF core specification default fonts (these are the families of Helvetica, Courier, Symbol, Times Roman, ZapfDingbats).  Of course visually you'll see a different font than expected too.

    If using font extension or your font happens to be installed in the JVM then the PDF is created with references to that specific font. Optionally the data representing the font can be embedded within the file which the PDF client program (adobe acrobat desktop application or browser plugin for example) will use for graphical rendering once the PDF is opened. If the it is not embedded, then you are reallying on the PDF client program to 'find' the physical font within the client OS.  If it doesn't exist (for example of the Microsoft oriented font Arial hasn't been installed on a Mac or Linux desktop), then the PDF will be graphically rendered with something else (one of the core fonts).   But if you embed the font via the checkbox, then the font will be graphically correct regardless of whether or not the client has had that font/ttf installed.

    Do determine what font is being referenced in our PDF and whether or not it is embedded, see the File -> Properties -> Font tab.  Note the "embedded subset" in the first image vs the second.   The files with "embed" will also be slightly larger in file-size.

    file_properties.png.43171c7f6249befbb3e1a05cc176253f.png

    file_prop2.png.78b2c4eed4495ca44ebf8f03f3cb0274.png


    Summary

    Unless you are okay with your PDF potentially being rendered with a default/native PDF specification font, or unless you are confident your client machines will always have the fonts installed, you need to use the "embed..." checkbox while creating your font extension

    Ref. Case 01468397


    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    This is now closed for further comments

×
×
  • Create New...