PdfFontEmbeddingMode
Contents
[
Hide
]Inheritance: java.lang.Object
public class PdfFontEmbeddingMode
Specifies how Aspose.Words should embed fonts.
Examples:
Shows how to set Aspose.Words to skip embedding Arial and Times New Roman fonts into a PDF document.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// "Arial" is a standard font, and "Courier New" is a nonstandard font.
builder.getFont().setName("Arial");
builder.writeln("Hello world!");
builder.getFont().setName("Courier New");
builder.writeln("The quick brown fox jumps over the lazy dog.");
// Create a "PdfSaveOptions" object that we can pass to the document's "Save" method
// to modify how that method converts the document to .PDF.
PdfSaveOptions options = new PdfSaveOptions();
// Set the "EmbedFullFonts" property to "true" to embed every glyph of every embedded font in the output PDF.
options.setEmbedFullFonts(true);
// Set the "FontEmbeddingMode" property to "EmbedAll" to embed all fonts in the output PDF.
// Set the "FontEmbeddingMode" property to "EmbedNonstandard" to only allow nonstandard fonts' embedding in the output PDF.
// Set the "FontEmbeddingMode" property to "EmbedNone" to not embed any fonts in the output PDF.
options.setFontEmbeddingMode(pdfFontEmbeddingMode);
doc.save(getArtifactsDir() + "PdfSaveOptions.EmbedWindowsFonts.pdf", options);
switch (pdfFontEmbeddingMode) {
case PdfFontEmbeddingMode.EMBED_ALL:
Assert.assertTrue(new File(getArtifactsDir() + "PdfSaveOptions.EmbedWindowsFonts.pdf").length() < 1031200);
break;
case PdfFontEmbeddingMode.EMBED_NONSTANDARD:
Assert.assertTrue(new File(getArtifactsDir() + "PdfSaveOptions.EmbedWindowsFonts.pdf").length() < 491800);
break;
case PdfFontEmbeddingMode.EMBED_NONE:
Assert.assertTrue(new File(getArtifactsDir() + "PdfSaveOptions.EmbedWindowsFonts.pdf").length() <= 4258);
break;
}
Fields
Field | Description |
---|---|
EMBED_ALL | Aspose.Words embeds all fonts. |
EMBED_NONE | Aspose.Words do not embed any fonts. |
EMBED_NONSTANDARD | Aspose.Words embeds all fonts excepting standard Windows fonts Arial and Times New Roman. |
length |
Methods
Method | Description |
---|---|
fromName(String pdfFontEmbeddingModeName) | |
getName(int pdfFontEmbeddingMode) | |
getValues() | |
toString(int pdfFontEmbeddingMode) |
EMBED_ALL
public static int EMBED_ALL
Aspose.Words embeds all fonts.
EMBED_NONE
public static int EMBED_NONE
Aspose.Words do not embed any fonts.
EMBED_NONSTANDARD
public static int EMBED_NONSTANDARD
Aspose.Words embeds all fonts excepting standard Windows fonts Arial and Times New Roman. Only Arial and Times New Roman fonts are affected in this mode because MS Word doesn’t embed only these fonts when saving document to PDF.
length
public static int length
fromName(String pdfFontEmbeddingModeName)
public static int fromName(String pdfFontEmbeddingModeName)
Parameters:
Parameter | Type | Description |
---|---|---|
pdfFontEmbeddingModeName | java.lang.String |
Returns: int
getName(int pdfFontEmbeddingMode)
public static String getName(int pdfFontEmbeddingMode)
Parameters:
Parameter | Type | Description |
---|---|---|
pdfFontEmbeddingMode | int |
Returns: java.lang.String
getValues()
public static int[] getValues()
Returns: int[]
toString(int pdfFontEmbeddingMode)
public static String toString(int pdfFontEmbeddingMode)
Parameters:
Parameter | Type | Description |
---|---|---|
pdfFontEmbeddingMode | int |
Returns: java.lang.String