public class XFAFlattener extends Object implements com.itextpdf.tool.xml.html.CssAppliersAware
Input for flattening can be either PDF document containing XFA forms or XDP stream (a pure XML stream containing XFA description).
To flattenXDP the form (from either PDF or XDP):
XFAFlattener instance
flattenXDP method
| Modifier and Type | Class and Description |
|---|---|
static class |
XFAFlattener.ViewMode |
| Constructor and Description |
|---|
XFAFlattener() |
| Modifier and Type | Method and Description |
|---|---|
void |
flatten(InputStream xfaInputStream,
OutputStream pdfOutputStream)
Flattens XFA form from PDF
For a single instance of
XFAFlattener this method could be called only once. |
void |
flattenXDP(Document xdpData,
OutputStream pdfOutputStream)
Flattens XFA form from XML data.
|
void |
flattenXDP(InputStream xdpStream,
OutputStream pdfOutputStream)
Flattens XFA form from XDP stream.
|
AppConfig |
getAppConfig() |
com.itextpdf.tool.xml.html.CssAppliers |
getCssAppliers()
For internal use only.
|
Locale |
getDefaultLocale() |
List<String> |
getExtraEventList() |
XFAFlattenerProperties |
getFlattenerProperties() |
XFAFontSettings |
getFontSettings() |
HostConfig |
getHostConfig() |
com.itextpdf.tool.xml.xtra.xfa.resolver.IHrefResolver |
getHrefResolver() |
XFAFlattener.ViewMode |
getViewMode() |
XFAFlattener |
setAppConfig(AppConfig appConfig) |
void |
setCssAppliers(com.itextpdf.tool.xml.html.CssAppliers cssAppliers)
For internal use only.
|
XFAFlattener |
setDefaultLocale(Locale defaultLocale) |
XFAFlattener |
setExtraEventList(List<String> extraEventList) |
XFAFlattener |
setFlattenerProperties(XFAFlattenerProperties flattenerProperties) |
XFAFlattener |
setFontSettings(XFAFontSettings fontSettings) |
XFAFlattener |
setHostConfig(HostConfig hostConfig) |
XFAFlattener |
setHrefResolver(com.itextpdf.tool.xml.xtra.xfa.resolver.IHrefResolver hrefResolver) |
XFAFlattener |
setViewMode(XFAFlattener.ViewMode viewMode) |
public void flattenXDP(InputStream xdpStream, OutputStream pdfOutputStream) throws IOException
XFAFlattener this method could be called only once.
Attempt to reuse method will result in throwing a XFAFlattenerUnexpectedUsageException.
Declare another XFAFlattener instance to process another XDP.
Example:
XFAFlattener flattener = new XFAFlattener();
FileInputStream fin = new FileInputStream("c:/xdp_source.xml");
flattener.flattenXDP(fin, new FileOutputStream("my_flat_doc.pdf"));
fin.close();
xdpStream - an XDP streampdfOutputStream - PDF output streamIOException - is thrown if an error occurred while reading the XDP input streampublic void flatten(InputStream xfaInputStream, OutputStream pdfOutputStream) throws IOException, InterruptedException
XFAFlattener this method could be called only once.
Attempt to reuse method will result in throwing a XFAFlattenerUnexpectedUsageException.
Declare another XFAFlattener instance to process another PDF.xfaInputStream - the input stream with the PDF containing XFA templatepdfOutputStream - the output stream where the flattened PDF will be written toIOException - is thrown if an error occurred while reading the XFA input streamInterruptedException - if the current thread is interrupted by another thread while it is waiting
for flatten process, then the wait is ended and an InterruptedException is thrown.public void flattenXDP(Document xdpData, OutputStream pdfOutputStream) throws IOException
XFAFlattener this method could be called only once.
Attempt to reuse method will result in throwing a XFAFlattenerUnexpectedUsageException.
Declare another XFAFlattener instance to process another XML.
Example:
XFAFlattener flattener = new XFAFlattener();
File xmlFile = new File("c:/xdp_source.xml");
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
org.w3c.dom.Document xmlDoc = docBuilder.parse(fXmlFile);
flattener.flattenXDP(xmlDoc, new FileOutputStream("my_flat_doc.pdf"));
xdpData - an XML datapdfOutputStream - PDF output streamIOException - is thrown if an error occurred while reading the XDP input streampublic void setCssAppliers(com.itextpdf.tool.xml.html.CssAppliers cssAppliers)
setCssAppliers in interface com.itextpdf.tool.xml.html.CssAppliersAwarepublic com.itextpdf.tool.xml.html.CssAppliers getCssAppliers()
getCssAppliers in interface com.itextpdf.tool.xml.html.CssAppliersAwarepublic XFAFlattener.ViewMode getViewMode()
public XFAFlattener setViewMode(XFAFlattener.ViewMode viewMode)
public AppConfig getAppConfig()
public XFAFlattener setAppConfig(AppConfig appConfig)
public HostConfig getHostConfig()
public XFAFlattener setHostConfig(HostConfig hostConfig)
public Locale getDefaultLocale()
public XFAFlattener setDefaultLocale(Locale defaultLocale)
public XFAFlattener setExtraEventList(List<String> extraEventList)
public com.itextpdf.tool.xml.xtra.xfa.resolver.IHrefResolver getHrefResolver()
public XFAFlattener setHrefResolver(com.itextpdf.tool.xml.xtra.xfa.resolver.IHrefResolver hrefResolver)
public XFAFontSettings getFontSettings()
public XFAFlattener setFontSettings(XFAFontSettings fontSettings)
public XFAFlattenerProperties getFlattenerProperties()
public XFAFlattener setFlattenerProperties(XFAFlattenerProperties flattenerProperties)
Copyright (C) 1998-2020 iText Group NV. All Rights Reserved.