Package org.mustangproject.ZUGFeRD
Class ZUGFeRDExporterFromPDFA
- java.lang.Object
-
- org.mustangproject.ZUGFeRD.ZUGFeRDExporterFromPDFA
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,IExporter,IZUGFeRDExporter
public class ZUGFeRDExporterFromPDFA extends java.lang.Object implements IZUGFeRDExporter
Auto-detects the source PDF-A-Version and acts accordingly like a ZUGFeRDExporterFromA1 or ZUGFeRDExporterFromA3
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanignorePDFAErrorsprotected IZUGFeRDExportertheExporter
-
Constructor Summary
Constructors Constructor Description ZUGFeRDExporterFromPDFA()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidattachFile(java.lang.String filename, byte[] data, java.lang.String mimetype, java.lang.String relation)voidattachFile(FileAttachment file)voidclose()protected voiddetermineAndSetExporter(int PDFAVersion)IZUGFeRDExporterdisableAutoClose(boolean disableAutoClose)IZUGFeRDExporterdisableFacturX()booleanensurePDFIsValid(jakarta.activation.DataSource dataSource)voidexport(java.io.OutputStream output)voidexport(java.lang.String ZUGFeRDfilename)protected byte[]filenameToByteArray(java.lang.String pdfFilename)IZUGFeRDExportergetExporter()java.lang.StringgetNamespaceForVersion(int ver)java.lang.StringgetPrefixForVersion(int ver)IXMLProvidergetProvider()ZUGFeRDExporterFromPDFAignorePDFAErrors()protected byte[]inputstreamToByteArray(java.io.InputStream fileInputStream)IZUGFeRDExporterload(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)IZUGFeRDExporterload(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)IZUGFeRDExporterload(java.lang.String pdfFilename)Load from filenameIZUGFeRDExportersetConformanceLevel(PDFAConformanceLevel newLevel)IZUGFeRDExportersetCreator(java.lang.String creator)IZUGFeRDExportersetProducer(java.lang.String producer)IZUGFeRDExportersetProfile(java.lang.String profileName)IZUGFeRDExportersetProfile(Profile p)IExportersetTransaction(IExportableTransaction trans)IZUGFeRDExportersetXML(byte[] zugferdData)IZUGFeRDExportersetZUGFeRDVersion(int version)
-
-
-
Field Detail
-
theExporter
protected IZUGFeRDExporter theExporter
-
ignorePDFAErrors
protected boolean ignorePDFAErrors
-
-
Method Detail
-
ignorePDFAErrors
public ZUGFeRDExporterFromPDFA ignorePDFAErrors()
-
determineAndSetExporter
protected void determineAndSetExporter(int PDFAVersion)
-
getExporter
public IZUGFeRDExporter getExporter()
-
filenameToByteArray
protected byte[] filenameToByteArray(java.lang.String pdfFilename) throws java.io.IOException- Throws:
java.io.IOException
-
inputstreamToByteArray
protected byte[] inputstreamToByteArray(java.io.InputStream fileInputStream) throws java.io.IOException- Throws:
java.io.IOException
-
load
public IZUGFeRDExporter load(java.lang.String pdfFilename) throws java.io.IOException
Load from filename- Specified by:
loadin interfaceIZUGFeRDExporter- Parameters:
pdfFilename- binary of a PDF/A1 compliant document- Returns:
- the A1 or A3 exporter
- Throws:
java.io.IOException- e.g. on read error
-
load
public IZUGFeRDExporter load(byte[] pdfBinary) throws java.io.IOException
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)- Specified by:
loadin interfaceIZUGFeRDExporter- Parameters:
pdfBinary- binary of a PDF/A1 compliant document- Returns:
- the generated exporter
- Throws:
java.io.IOException- (should not happen at all)
-
load
public IZUGFeRDExporter load(java.io.InputStream pdfSource) throws java.io.IOException
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)- Specified by:
loadin interfaceIZUGFeRDExporter- Parameters:
pdfSource- source to read a PDF/A1 compliant document from- Returns:
- the generated ZUGFeRDExporter
- Throws:
java.io.IOException- if anything is wrong with inputstream
-
setCreator
public IZUGFeRDExporter setCreator(java.lang.String creator)
- Specified by:
setCreatorin interfaceIZUGFeRDExporter
-
setProfile
public IZUGFeRDExporter setProfile(Profile p)
- Specified by:
setProfilein interfaceIZUGFeRDExporter
-
setProfile
public IZUGFeRDExporter setProfile(java.lang.String profileName)
-
setConformanceLevel
public IZUGFeRDExporter setConformanceLevel(PDFAConformanceLevel newLevel)
- Specified by:
setConformanceLevelin interfaceIZUGFeRDExporter
-
setProducer
public IZUGFeRDExporter setProducer(java.lang.String producer)
- Specified by:
setProducerin interfaceIZUGFeRDExporter
-
setZUGFeRDVersion
public IZUGFeRDExporter setZUGFeRDVersion(int version)
- Specified by:
setZUGFeRDVersionin interfaceIZUGFeRDExporter
-
ensurePDFIsValid
public boolean ensurePDFIsValid(jakarta.activation.DataSource dataSource) throws java.io.IOException- Specified by:
ensurePDFIsValidin interfaceIZUGFeRDExporter- Throws:
java.io.IOException
-
setXML
public IZUGFeRDExporter setXML(byte[] zugferdData) throws java.io.IOException
- Specified by:
setXMLin interfaceIZUGFeRDExporter- Throws:
java.io.IOException
-
disableFacturX
public IZUGFeRDExporter disableFacturX()
- Specified by:
disableFacturXin interfaceIZUGFeRDExporter
-
getNamespaceForVersion
public java.lang.String getNamespaceForVersion(int ver)
- Specified by:
getNamespaceForVersionin interfaceIZUGFeRDExporter
-
getPrefixForVersion
public java.lang.String getPrefixForVersion(int ver)
- Specified by:
getPrefixForVersionin interfaceIZUGFeRDExporter
-
disableAutoClose
public IZUGFeRDExporter disableAutoClose(boolean disableAutoClose)
- Specified by:
disableAutoClosein interfaceIZUGFeRDExporter
-
getProvider
public IXMLProvider getProvider()
- Specified by:
getProviderin interfaceIZUGFeRDExporter
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
setTransaction
public IExporter setTransaction(IExportableTransaction trans) throws java.io.IOException
- Specified by:
setTransactionin interfaceIExporter- Throws:
java.io.IOException
-
export
public void export(java.lang.String ZUGFeRDfilename) throws java.io.IOException
-
export
public void export(java.io.OutputStream output) throws java.io.IOException
-
attachFile
public void attachFile(FileAttachment file)
- Specified by:
attachFilein interfaceIZUGFeRDExporter
-
attachFile
public void attachFile(java.lang.String filename, byte[] data, java.lang.String mimetype, java.lang.String relation)- Specified by:
attachFilein interfaceIZUGFeRDExporter
-
-