public class WarningSource
extends java.lang.Object
Examples:
Shows how to work with the warning source.
Document doc = new Document(getMyDir() + "Emphases markdown warning.docx");
WarningInfoCollection warnings = new WarningInfoCollection();
doc.setWarningCallback(warnings);
doc.save(getArtifactsDir() + "DocumentBuilder.EmphasesWarningSourceMarkdown.md");
for (WarningInfo warningInfo : warnings) {
if (warningInfo.getSource() == WarningSource.MARKDOWN)
Assert.assertEquals("The (*, 0:11) cannot be properly written into Markdown.", warningInfo.getDescription());
}
Shows how to get additional information about font substitution.
Document doc = new Document(getMyDir() + "Rendering.docx");
WarningInfoCollection callback = new WarningInfoCollection();
doc.setWarningCallback(callback);
FontSettings fontSettings = new FontSettings();
fontSettings.getSubstitutionSettings().getDefaultFontSubstitution().setDefaultFontName("Arial");
fontSettings.setFontsFolder(getFontsDir(), false);
fontSettings.getSubstitutionSettings().getTableSubstitution().addSubstitutes("Arial", "Arvo", "Slab");
doc.setFontSettings(fontSettings);
doc.save(getArtifactsDir() + "FontSettings.SubstitutionWarnings.pdf");
FontSubstitutionWarningInfo warningInfo = (FontSubstitutionWarningInfo)callback.get(0);
Assert.assertEquals(WarningSource.LAYOUT, warningInfo.getSource());
Assert.assertEquals(WarningType.FONT_SUBSTITUTION, warningInfo.getWarningType());
Assert.assertEquals(FontSubstitutionReason.TABLE_SUBSTITUTION_RULE, warningInfo.getReason());
Assert.assertEquals("Font \'Arial\' has not been found. Using \'Arvo\' font instead. Reason: table substitution.", warningInfo.getDescription());
Assert.assertTrue(warningInfo.getRequestedBold());
Assert.assertFalse(warningInfo.getRequestedItalic());
Assert.assertEquals("Arial", warningInfo.getRequestedFamilyName());
| Modifier and Type | Field and Description |
|---|---|
static int |
CHM
Module that reads CHM files.
|
static int |
DOC
Module that reads/writes binary DOC files.
|
static int |
DOCX
Module that reads/writes DOCX files.
|
static int |
DRAWING_ML
Module that renders DrawingML shapes.
|
static int |
EPUB
Module that reads/writes EPUB files.
|
static int |
FONT
Module that reads font files.
|
static int |
HTML
Module that reads/writes HTML/MHTML files.
|
static int |
IMAGE
Module that renders images.
|
static int |
LAYOUT
Module that builds a document layout.
|
static int |
length |
static int |
MARKDOWN
Module that reads/writes Markdown files.
|
static int |
MATH_ML
Module that reads W3C MathML files.
|
static int |
METAFILE
Module that renders metafiles.
|
static int |
NRX
Common modules that are shared between DOCX/WML reader/writer modules.
|
static int |
ODT
Module that reads/writes ODT files.
|
static int |
OFFICE_MATH
Module that renders OfficeMath.
|
static int |
PDF
Module that renders PDF.
|
static int |
RTF
Module that reads/writes RTF files.
|
static int |
SHAPES
Module that renders ordinary shapes.
|
static int |
SVG
Module that reads SVG files.
|
static int |
SVM
Module that reads Svm files.
|
static int |
TEXT
Module that reads/writes plaintext files.
|
static int |
UNKNOWN
The warning source is not specified.
|
static int |
VALIDATOR
Module that verifies model consistency and validity.
|
static int |
WORD_ML
Module that reads/writes WML files.
|
static int |
XAML
Module that reads/writes Xaml files.
|
static int |
XLSX
Module that writes XLSX files.
|
static int |
XML
Module that reads XML files.
|
static int |
XPS
Module that renders XPS.
|
| Modifier and Type | Method and Description |
|---|---|
static int |
fromName(java.lang.String warningSourceName) |
static java.lang.String |
getName(int warningSource) |
static int[] |
getValues() |
static java.lang.String |
toString(int warningSource) |
public static int UNKNOWN
public static int LAYOUT
public static int DRAWING_ML
public static int OFFICE_MATH
public static int SHAPES
public static int METAFILE
public static int XPS
public static int PDF
public static int IMAGE
public static int DOCX
public static int DOC
public static int TEXT
public static int RTF
public static int WORD_ML
public static int NRX
public static int ODT
public static int HTML
public static int VALIDATOR
public static int XAML
public static int SVM
public static int MATH_ML
public static int FONT
public static int SVG
public static int MARKDOWN
public static int CHM
public static int EPUB
public static int XML
public static int XLSX
public static int length