public final class FontCollection extends Object implements Iterable
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 for(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 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.
|
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.
public Object getSyncRoot()
Gets an object that can be used to synchronize access to the collection.
public boolean isSynchronized()
Gets a value indicating whether access to the collection is synchronized (thread safe).
public com.aspose.ms.System.Collections.IEnumerator iterator()
Returns an enumerator for the entire collection.
public void add(Font newFont, String[] resName)
Adds new font to font resources and returns automatically assigned name of font resource.
newFont
- Font object.resName
- The automatically assigned resource item name.public Font get_Item(int index)
Gets the font element at the specified index.
index
- Index within the collection.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 © 2016 Aspose. All Rights Reserved.