public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporter, IExporter, java.io.Closeable
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
author
Deprecated.
author is never set yet
|
protected PDFAConformanceLevel |
conformanceLevel |
protected java.lang.String |
creator
Author/Creator attribute for PDF
|
protected java.lang.String |
creatorTool
CreatorTool
|
static int |
DefaultZUGFeRDVersion |
protected org.apache.pdfbox.pdmodel.PDDocument |
doc |
protected boolean |
documentPrepared |
protected java.util.ArrayList<FileAttachment> |
fileAttachments |
protected org.apache.pdfbox.pdmodel.common.PDMetadata |
metadata
Data (XML invoice) to be added to the ZUGFeRD PDF.
|
protected boolean |
overwrite
This flag controls whether or not the metadata is overwritten, or kind of merged.
|
protected java.lang.String |
producer
Producer attribute for PDF
|
protected java.lang.String |
subject
Deprecated.
subject is never set yet
|
protected java.lang.String |
title
Deprecated.
title is never set yet
|
protected org.apache.xmpbox.XMPMetadata |
xmp |
protected java.lang.String |
XRechnungVersion |
protected int |
ZFVersion |
| Constructor and Description |
|---|
ZUGFeRDExporterFromA3() |
| Modifier and Type | Method and Description |
|---|---|
ZUGFeRDExporterFromA3 |
addAdditionalFile(java.lang.String name,
byte[] content) |
protected void |
addSRGBOutputIntend()
Adds an OutputIntent and the sRGB color profile if no OutputIntent exist
|
protected void |
addStructureTreeRoot()
Adds a StructureTreeRoot element to the PDF if it doesn't already exist.
|
protected void |
addXMP(org.apache.xmpbox.XMPMetadata metadata)
This will add both the RDF-indication which embedded file is Zugferd and the
neccessary PDF/A schema extension description to be able to add this
information to RDF
|
void |
attachFile(FileAttachment file) |
void |
attachFile(java.lang.String filename,
byte[] data,
java.lang.String mimetype,
java.lang.String relation) |
void |
close() |
ZUGFeRDExporterFromA3 |
disableAutoClose(boolean disableAutoClose) |
IZUGFeRDExporter |
disableFacturX()
Generate ZF2.0/2.1 files with filename zugferd-invoice.xml instead of factur-x.xml
|
boolean |
ensurePDFIsValid(javax.activation.DataSource dataSource) |
void |
export(java.io.OutputStream output)
Perform the final export to a now ZUGFeRD-enriched PDF file as OutputStream
|
void |
export(java.lang.String ZUGFeRDfilename)
Perform the final export to a now ZUGFeRD-enriched PDF file
|
protected org.apache.xmpbox.schema.AdobePDFSchema |
getAdobePDFSchema(org.apache.xmpbox.XMPMetadata xmp)
Returns the AdobePDFSchema from the XMPMetadata if it exists.
|
protected org.apache.xmpbox.schema.DublinCoreSchema |
getDublinCoreSchema(org.apache.xmpbox.XMPMetadata xmp) |
java.lang.String |
getFilenameForVersion(int ver,
Profile profile)
internal helper: return the name of the file attachment for the given zf/fx version
|
java.lang.String |
getNamespaceForVersion(int ver)
internal helper function: get namespace for given zugferd or factur-x version
|
protected org.apache.xmpbox.schema.PDFAIdentificationSchema |
getPDFAIdentificationSchema(org.apache.xmpbox.XMPMetadata xmp) |
java.lang.String |
getPrefixForVersion(int ver)
internal helper: returns the namespace prefix for the given zf/fx version number
|
IXMLProvider |
getProvider() |
protected org.apache.xmpbox.schema.XMPBasicSchema |
getXmpBasicSchema(org.apache.xmpbox.XMPMetadata xmp) |
protected org.apache.xmpbox.XMPMetadata |
getXmpMetadata()
Reads the XMPMetadata from the PDDocument, if it exists.
|
boolean |
isAutoCloseDisabled() |
ZUGFeRDExporterFromA3 |
load(byte[] pdfBinary)
Makes A PDF/A3a-compliant document from a PDF-A1 compliant document (on the
metadata level, this will not e.g. convert graphics to JPG-2000)
|
ZUGFeRDExporterFromA3 |
load(java.io.InputStream pdfSource)
Makes A PDF/A3a-compliant document from a PDF-A1 compliant document (on the
metadata level, this will not e.g. convert graphics to JPG-2000)
|
ZUGFeRDExporterFromA3 |
load(java.lang.String pdfFilename)
Makes A PDF/A3a-compliant document from a PDF-A1 compliant document (on the
metadata level, this will not e.g. convert graphics to JPG-2000)
|
void |
PDFAttachGenericFile(org.apache.pdfbox.pdmodel.PDDocument doc,
java.lang.String filename,
java.lang.String relationship,
java.lang.String description,
java.lang.String subType,
byte[] data)
Embeds an external file (generic - any type allowed) in the PDF.
|
void |
PDFAttachGenericFile(java.lang.String filename,
java.lang.String relationship,
java.lang.String description,
java.lang.String subType,
byte[] data)
Embeds an external file (generic - any type allowed) in the PDF.
|
IExporter |
prepare() |
protected void |
prepareDocument() |
protected byte[] |
serializeXmpMetadata(org.apache.xmpbox.XMPMetadata xmpMetadata) |
protected ZUGFeRDExporterFromA3 |
setAttachZUGFeRDHeaders(boolean attachHeaders) |
ZUGFeRDExporterFromA3 |
setConformanceLevel(PDFAConformanceLevel newLevel)
All files are PDF/A-3, setConformance refers to the level conformance.
|
ZUGFeRDExporterFromA3 |
setCreator(java.lang.String creator) |
ZUGFeRDExporterFromA3 |
setCreatorTool(java.lang.String creatorTool) |
ZUGFeRDExporterFromA3 |
setFacturX()
Deprecated.
|
protected void |
setMarked()
Adds a MarkInfo element to the PDF if it doesn't already exist and sets it as marked.
|
ZUGFeRDExporterFromA3 |
setProducer(java.lang.String producer) |
ZUGFeRDExporterFromA3 |
setProfile(Profile p) |
ZUGFeRDExporterFromA3 |
setProfile(java.lang.String profilename) |
IExporter |
setTransaction(IExportableTransaction trans)
Embeds the Zugferd XML structure in a file named ZUGFeRD-invoice.xml.
|
ZUGFeRDExporterFromA3 |
setXML(byte[] zugferdData)
Sets the ZUGFeRD XML data to be attached as a single byte array.
|
protected void |
setXMLProvider(IXMLProvider p) |
void |
setXRechnungSpecificVersion(java.lang.String XRechnungVersion)
Sets a specific XRechnung version from outside.
|
ZUGFeRDExporterFromA3 |
setZUGFeRDVersion(EStandard est,
int version) |
ZUGFeRDExporterFromA3 |
setZUGFeRDVersion(int version) |
protected void |
writeAdobePDFSchema(org.apache.xmpbox.XMPMetadata xmp)
Sets the producer if the overwrite flag is set or the producer is not already set.
|
protected void |
writeDocumentInformation() |
protected void |
writeDublinCoreSchema(org.apache.xmpbox.XMPMetadata xmp) |
protected void |
writePDFAIdentificationSchema(org.apache.xmpbox.XMPMetadata xmp) |
protected void |
writeXMLBasicSchema(org.apache.xmpbox.XMPMetadata xmp) |
public static final int DefaultZUGFeRDVersion
protected PDFAConformanceLevel conformanceLevel
protected java.util.ArrayList<FileAttachment> fileAttachments
protected boolean overwrite
protected boolean documentPrepared
protected org.apache.pdfbox.pdmodel.common.PDMetadata metadata
protected org.apache.xmpbox.XMPMetadata xmp
protected java.lang.String producer
protected java.lang.String creator
protected java.lang.String creatorTool
@Deprecated protected java.lang.String author
@Deprecated protected java.lang.String title
@Deprecated protected java.lang.String subject
protected org.apache.pdfbox.pdmodel.PDDocument doc
protected int ZFVersion
protected java.lang.String XRechnungVersion
public ZUGFeRDExporterFromA3 load(java.lang.String pdfFilename) throws java.io.IOException
load in interface IZUGFeRDExporterpdfFilename - filename of an PDF/A1 compliant documentjava.io.IOException - if anything is wrong with filenamepublic IXMLProvider getProvider()
getProvider in interface IZUGFeRDExporterpublic ZUGFeRDExporterFromA3 setProfile(Profile p)
public ZUGFeRDExporterFromA3 setProfile(java.lang.String profilename)
public ZUGFeRDExporterFromA3 addAdditionalFile(java.lang.String name, byte[] content)
public java.lang.String getNamespaceForVersion(int ver)
getNamespaceForVersion in interface IZUGFeRDExporterver - the ZUGFeRD versionpublic java.lang.String getPrefixForVersion(int ver)
getPrefixForVersion in interface IZUGFeRDExporterver - the zf/fx versionpublic java.lang.String getFilenameForVersion(int ver,
Profile profile)
ver - the zf/fx versionprofile - which profile to be used, e.g. Profiles.getByName("EN16931")public ZUGFeRDExporterFromA3 setFacturX()
public void setXRechnungSpecificVersion(java.lang.String XRechnungVersion)
XRechnungVersion - the XRechnung versionpublic IZUGFeRDExporter disableFacturX()
disableFacturX in interface IZUGFeRDExporterpublic ZUGFeRDExporterFromA3 load(byte[] pdfBinary) throws java.io.IOException
load in interface IZUGFeRDExporterpdfBinary - binary of a PDF/A1 compliant documentjava.io.IOException - (should not happen at all)public void attachFile(FileAttachment file)
public void attachFile(java.lang.String filename,
byte[] data,
java.lang.String mimetype,
java.lang.String relation)
public void export(java.lang.String ZUGFeRDfilename)
throws java.io.IOException
export in interface IExporterexport in class XRExporterZUGFeRDfilename - the pdf file namejava.io.IOException - if anything is wrong in the target locationpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic void export(java.io.OutputStream output)
throws java.io.IOException
export in interface IExporterexport in class XRExporteroutput - the OutputStreamjava.io.IOException - if anything is wrong in the OutputStreampublic void PDFAttachGenericFile(java.lang.String filename,
java.lang.String relationship,
java.lang.String description,
java.lang.String subType,
byte[] data)
throws java.io.IOException
filename - name of the file that will become attachment name in the PDFrelationship - how the file relates to the content, e.g. "Alternative"description - Human-readable description of the file contentsubType - type of the data e.g. could be "text/xml" - mime likedata - the binary data of the file/attachmentjava.io.IOException - if anything is wrong with filenamepublic void PDFAttachGenericFile(org.apache.pdfbox.pdmodel.PDDocument doc,
java.lang.String filename,
java.lang.String relationship,
java.lang.String description,
java.lang.String subType,
byte[] data)
throws java.io.IOException
doc - PDDocument to attach the file to.filename - name of the file that will become attachment name in the PDFrelationship - how the file relates to the content, e.g. "Alternative"description - Human-readable description of the file contentsubType - type of the data e.g. could be "text/xml" - mime likedata - the binary data of the file/attachmentjava.io.IOException - if anything is wrong with filenamepublic ZUGFeRDExporterFromA3 setXML(byte[] zugferdData) throws java.io.IOException
setXML in interface IZUGFeRDExporterzugferdData - XML data to be set as a byte array (XML file in raw form).java.io.IOException - (should not happen)public ZUGFeRDExporterFromA3 load(java.io.InputStream pdfSource) throws java.io.IOException
load in interface IZUGFeRDExporterpdfSource - source to read a PDF/A1 compliant document fromjava.io.IOException - if anything is wrong with inputstreampublic boolean ensurePDFIsValid(javax.activation.DataSource dataSource)
throws java.io.IOException
ensurePDFIsValid in interface IZUGFeRDExporterjava.io.IOExceptionpublic ZUGFeRDExporterFromA3 setConformanceLevel(PDFAConformanceLevel newLevel)
PDF/A-3 has three coformance levels, called "A", "U" and "B".
PDF/A-3-B where B means only visually preservable, U -standard for Mustang- means visually and unicode preservable and A means full compliance, i.e. visually, unicode and structurally preservable and tagged PDF, i.e. useful metainformation for blind people.
Feel free to pass "A" as new level if you know what you are doing :-)
setConformanceLevel in interface IZUGFeRDExporterpublic ZUGFeRDExporterFromA3 setCreator(java.lang.String creator)
setCreator in interface IZUGFeRDExporterpublic ZUGFeRDExporterFromA3 setCreatorTool(java.lang.String creatorTool)
public ZUGFeRDExporterFromA3 setProducer(java.lang.String producer)
setProducer in interface IZUGFeRDExporterprotected ZUGFeRDExporterFromA3 setAttachZUGFeRDHeaders(boolean attachHeaders)
protected void addXMP(org.apache.xmpbox.XMPMetadata metadata)
metadata - the PDFbox XMPMetadata objectprotected void prepareDocument()
throws java.io.IOException
java.io.IOExceptionpublic IExporter setTransaction(IExportableTransaction trans) throws java.io.IOException
setTransaction in interface IExportersetTransaction in class XRExportertrans - a IZUGFeRDExportableTransaction that provides the data-model to
populate the XML. This parameter may be null, if so the XML data
should hav ebeen set via
setZUGFeRDXMLData(byte[] zugferdData)java.io.IOException - if anything is wrong with already loaded PDFpublic IExporter prepare() throws java.io.IOException
java.io.IOExceptionprotected org.apache.xmpbox.XMPMetadata getXmpMetadata()
throws java.io.IOException
java.io.IOExceptionprotected byte[] serializeXmpMetadata(org.apache.xmpbox.XMPMetadata xmpMetadata)
throws javax.xml.transform.TransformerException
javax.xml.transform.TransformerExceptionprotected void writeAdobePDFSchema(org.apache.xmpbox.XMPMetadata xmp)
protected org.apache.xmpbox.schema.AdobePDFSchema getAdobePDFSchema(org.apache.xmpbox.XMPMetadata xmp)
xmp - the metadata to attach toprotected void writePDFAIdentificationSchema(org.apache.xmpbox.XMPMetadata xmp)
protected org.apache.xmpbox.schema.PDFAIdentificationSchema getPDFAIdentificationSchema(org.apache.xmpbox.XMPMetadata xmp)
protected void writeDublinCoreSchema(org.apache.xmpbox.XMPMetadata xmp)
protected org.apache.xmpbox.schema.DublinCoreSchema getDublinCoreSchema(org.apache.xmpbox.XMPMetadata xmp)
protected void writeXMLBasicSchema(org.apache.xmpbox.XMPMetadata xmp)
protected org.apache.xmpbox.schema.XMPBasicSchema getXmpBasicSchema(org.apache.xmpbox.XMPMetadata xmp)
protected void writeDocumentInformation()
protected void addSRGBOutputIntend()
throws java.io.IOException
java.io.IOExceptionprotected void setMarked()
protected void addStructureTreeRoot()
public boolean isAutoCloseDisabled()
public ZUGFeRDExporterFromA3 disableAutoClose(boolean disableAutoClose)
disableAutoClose in interface IZUGFeRDExporterdisableAutoClose - prevent PDF file from being closed after adding ZFprotected void setXMLProvider(IXMLProvider p)
public ZUGFeRDExporterFromA3 setZUGFeRDVersion(EStandard est, int version)
public ZUGFeRDExporterFromA3 setZUGFeRDVersion(int version)
setZUGFeRDVersion in interface IZUGFeRDExporterCopyright © 2023. All rights reserved.