public class WarningType
extends java.lang.Object
Examples:
Shows how to set the property for finding the closest match for a missing font from the available font sources.
// Open a document that contains text formatted with a font that does not exist in any of our font sources.
Document doc = new Document(getMyDir() + "Missing font.docx");
// Assign a callback for handling font substitution warnings.
WarningInfoCollection warningCollector = new WarningInfoCollection();
doc.setWarningCallback(warningCollector);
// Set a default font name and enable font substitution.
FontSettings fontSettings = new FontSettings();
fontSettings.getSubstitutionSettings().getDefaultFontSubstitution().setDefaultFontName("Arial");
fontSettings.getSubstitutionSettings().getFontInfoSubstitution().setEnabled(true);
// Original font metrics should be used after font substitution.
doc.getLayoutOptions().setKeepOriginalFontMetrics(true);
// We will get a font substitution warning if we save a document with a missing font.
doc.setFontSettings(fontSettings);
doc.save(getArtifactsDir() + "FontSettings.EnableFontSubstitution.pdf");
for (WarningInfo info : warningCollector)
{
if (info.getWarningType() == WarningType.FONT_SUBSTITUTION)
System.out.println(info.getDescription());
}
| Modifier and Type | Field and Description |
|---|---|
static int |
DATA_LOSS
Generic data loss, no specific code.
|
static int |
DATA_LOSS_CATEGORY
Some text/char/image or other data will be missing from either the document tree following load, or from the created document following save.
|
static int |
FONT_EMBEDDING
Loss of embedded font information during document saving.
|
static int |
FONT_SUBSTITUTION
Font has been substituted.
|
static int |
HINT
Advises of a potential problem or suggests an improvement.
|
static int |
length |
static int |
MAJOR_FORMATTING_LOSS
Generic major formatting loss, no specific code.
|
static int |
MAJOR_FORMATTING_LOSS_CATEGORY
The resulting document or a particular location in it might look substantially different compared to the original document.
|
static int |
MINOR_FORMATTING_LOSS
Generic minor formatting loss, no specific code.
|
static int |
MINOR_FORMATTING_LOSS_CATEGORY
The resulting document or a particular location in it might look somewhat different compared to the original document.
|
static int |
UNEXPECTED_CONTENT
Generic unexpected content, no specific code.
|
static int |
UNEXPECTED_CONTENT_CATEGORY
Some content in the source document could not be recognized (i.e.
|
| Modifier and Type | Method and Description |
|---|---|
static int |
fromName(java.lang.String warningTypeName) |
static int |
fromNames(java.util.Set warningTypeNames) |
static java.lang.String |
getName(int warningType) |
static java.util.Set |
getNames(int warningType) |
static int[] |
getValues() |
static java.lang.String |
toString(int warningType) |
static java.lang.String |
toStringSet(int attr) |
public static int DATA_LOSS_CATEGORY
public static int DATA_LOSS
public static int MAJOR_FORMATTING_LOSS_CATEGORY
public static int MAJOR_FORMATTING_LOSS
public static int MINOR_FORMATTING_LOSS_CATEGORY
public static int MINOR_FORMATTING_LOSS
public static int FONT_SUBSTITUTION
public static int FONT_EMBEDDING
public static int UNEXPECTED_CONTENT_CATEGORY
public static int UNEXPECTED_CONTENT
public static int HINT
public static int length
public static java.lang.String getName(int warningType)
public static java.util.Set getNames(int warningType)
public static java.lang.String toString(int warningType)
public static java.lang.String toStringSet(int attr)
public static int fromName(java.lang.String warningTypeName)
public static int fromNames(java.util.Set warningTypeNames)
public static int[] getValues()