Class 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 Detail

      • ignorePDFAErrors

        protected boolean ignorePDFAErrors
    • Constructor Detail

      • ZUGFeRDExporterFromPDFA

        public ZUGFeRDExporterFromPDFA()
    • Method Detail

      • determineAndSetExporter

        protected void determineAndSetExporter​(int PDFAVersion)
      • 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:
        load in interface IZUGFeRDExporter
        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:
        load in interface IZUGFeRDExporter
        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:
        load in interface IZUGFeRDExporter
        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
      • setProfile

        public IZUGFeRDExporter setProfile​(java.lang.String profileName)
      • ensurePDFIsValid

        public boolean ensurePDFIsValid​(jakarta.activation.DataSource dataSource)
                                 throws java.io.IOException
        Specified by:
        ensurePDFIsValid in interface IZUGFeRDExporter
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • export

        public void export​(java.lang.String ZUGFeRDfilename)
                    throws java.io.IOException
        Specified by:
        export in interface IExporter
        Throws:
        java.io.IOException
      • export

        public void export​(java.io.OutputStream output)
                    throws java.io.IOException
        Specified by:
        export in interface IExporter
        Throws:
        java.io.IOException
      • attachFile

        public void attachFile​(java.lang.String filename,
                               byte[] data,
                               java.lang.String mimetype,
                               java.lang.String relation)
        Specified by:
        attachFile in interface IZUGFeRDExporter