public final class FontCollection extends Object implements com.aspose.ms.System.Collections.ICollection
Represents font collection.
The example demonstrates how to make all font declared on page as embedded.// Open document Document doc = new Document(@"D:\Tests\input.pdf"); // ensure all fonts declared on page resources are embedded // note that if fonts are declared on form resources they are not accessible from page resources fore(com.aspsoe.pdf.Font font : doc.getPages().get_Item(1).getResources().getFonts()) { if(!font.isEmbedded()) font.isEmbedded(true); } doc.save(@"D:\Tests\input.pdf");
FontCollection
class are used in several scenarios.
For example, in resources with Resources.Fonts
property.
Modifier and Type | Method and Description |
---|---|
void |
add(Font fragment)
Adds the font element at the specified index.
|
void |
add(Font newFont,
String[] resName)
Adds new font to font resources and returns automatically assigned name of font resource.
|
void |
add(String resName,
com.aspose.pdf.engine.data.IPdfObject newFont)
Add new font to font collection.
|
void |
add(String resName,
String baseFontName)
Adds to font resources new font entry with specified base font name.
|
boolean |
contains(String name)
Checks if font exists in font collection.
|
void |
copyTo(com.aspose.ms.System.Array array,
int index)
Copies the entire collection to a compatible one-dimensional Array, starting at the specified index of the target array
|
Font |
get_Item(int index)
Gets the font element at the specified index.
|
Font |
get_Item(String name)
Gets font from the collection by font name.
|
Object |
getSyncRoot()
Gets an object that can be used to synchronize access to the collection.
|
boolean |
isSynchronized()
Gets a value indicating whether access to the collection is synchronized (thread safe).
|
com.aspose.ms.System.Collections.IEnumerator |
iterator()
Returns an enumerator for the entire collection.
|
int |
size()
Gets the number of
Font object elements actually contained in the collection. |
public int size()
Gets the number of Font
object elements actually contained in the collection.
size
in interface com.aspose.ms.System.Collections.ICollection
public Object getSyncRoot()
Gets an object that can be used to synchronize access to the collection.
getSyncRoot
in interface com.aspose.ms.System.Collections.ICollection
public boolean isSynchronized()
Gets a value indicating whether access to the collection is synchronized (thread safe).
isSynchronized
in interface com.aspose.ms.System.Collections.ICollection
public com.aspose.ms.System.Collections.IEnumerator iterator()
Returns an enumerator for the entire collection.
public void copyTo(com.aspose.ms.System.Array array, int index)
Copies the entire collection to a compatible one-dimensional Array, starting at the specified index of the target array
copyTo
in interface com.aspose.ms.System.Collections.ICollection
public void add(Font newFont, String[] resName)
Adds new font to font resources and returns automatically assigned name of font resource.
newFont
- Font.resName
- The automatically assigned resource item name.public void add(Font fragment)
Adds the font element at the specified index.
fragment
- Font objectpublic Font get_Item(int index)
Gets the font element at the specified index.
index
- public Font get_Item(String name)
Gets font from the collection by font name. Exception is thrown if font was not found.
name
- Name of the font.public boolean contains(String name)
Checks if font exists in font collection.
name
- Font name.public void add(String resName, com.aspose.pdf.engine.data.IPdfObject newFont)
Add new font to font collection.
resName
- newFont
- Copyright © 2017 Aspose. All Rights Reserved.