Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save aspose-com-gists/309d9d6a0fb089de84db22954fb9ba1f to your computer and use it in GitHub Desktop.

Select an option

Save aspose-com-gists/309d9d6a0fb089de84db22954fb9ba1f to your computer and use it in GitHub Desktop.
Convert Type1 and Type3 fonts to TTF with Java

Fonts Conversion Examples

These code snippets will help you to convert Type1 and Type3 fonts to TrueType (TTF). With Aspose.Page for Java library it is quick and simple to convert Type3 fonts, contained in PostScript (PS) files, and Type 1 fonts, contained in eithe PS or PFA or PFB files, to TTF.

Key Use Cases

  • How to convert Type1 fonts to TTF.
  • How to convert Type3 fonts to TTF.

How to Run Examples

  1. Make sure Aspose.Page for Java library is referenced in your project.
  2. Copy necessary code snippet from here to your project.
  3. Download temporary license and set it up as it is shown here or use paid license.
  4. Execute it.

Restrictions

In unlicensing mode Aspose.Page for Java library doesn't allow conversion of fonts. Set up valid temporary or paid license in order to use font conversion.

Related Documentation

More about fonts conversion see in the tutorial Working with fonts chapter of the official documentation.

Related Resources

Requirements

  • Java 8 or higher
  • Aspose.Page for Java library
Aspose.Page for Java – Convert Fonts Examples
// Convert Type1 font from "*.ps", ".pfa" or ".pfb" file.
// Learn more: https://docs.aspose.com/page/java/type1-to-ttf/
//Create ne PsDocument object
PsDocument doc = new PsDocument();
//Convert Type1 font from the file 'Type1_Arial_Bold.ps' to TTF font in DataDir folder.
//Exstension of file can be ".pfa", ".pfb", ".ps" or something else. The main thing is that there is a font Type1 inside.
doc.convertType1FontToTTF(getDataDir() + "Type1_Arial_Bold.ps", getOutputDir());
// Convert Type1 font from "*.ps" file.
// Learn more: https://docs.aspose.com/page/java/type3-to-ttf/
//Create ne PsDocument object
PsDocument doc = new PsDocument();
//Convert outline Type3 font from the file 'Type3_outline.ps' to TTF font in dataDir folder.
//Exstension of file can be ".ps" or something else. The main thing is that there is a font Type3 inside.
doc.convertType3FontToTTF(getDataDir() + "Type3_outline.ps", getOutputDir());
//Convert bitmap Type3 font from the file 'Type3_bitmap.ps' to TTF font in DataDir folder.
doc.convertType3FontToTTF(getDataDir() + "Type3_bitmap.ps", getOutputDir());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment