Search in sources :

Example 1 with ByteArrayDataSource

use of org.apache.pdfbox.preflight.utils.ByteArrayDataSource in project mustangproject by ZUGFeRD.

the class ZUGFeRDExporterFromA1Factory method loadFromPDFA1.

/**
     * 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)
     *
     * @param pdfBinary binary of a PDF/A1 compliant document
     */
public ZUGFeRDExporter loadFromPDFA1(byte[] pdfBinary) throws IOException, TransformerException {
    ensurePDFIsValidA1(new ByteArrayDataSource(new ByteArrayInputStream(pdfBinary)));
    PDDocument doc = PDDocument.load(pdfBinary);
    makePDFA3compliant(doc);
    return new ZUGFeRDExporter(doc);
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) PDDocument(org.apache.pdfbox.pdmodel.PDDocument) ByteArrayDataSource(org.apache.pdfbox.preflight.utils.ByteArrayDataSource)

Example 2 with ByteArrayDataSource

use of org.apache.pdfbox.preflight.utils.ByteArrayDataSource in project mustangproject by ZUGFeRD.

the class ZUGFeRDExporterFromA3 method load.

/**
 * 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)
 *
 * @param pdfBinary binary of a PDF/A1 compliant document
 */
public ZUGFeRDExporterFromA3 load(byte[] pdfBinary) throws IOException {
    ensurePDFIsValid(new ByteArrayDataSource(new ByteArrayInputStream(pdfBinary)));
    doc = PDDocument.load(pdfBinary);
    return this;
}
Also used : ByteArrayDataSource(org.apache.pdfbox.preflight.utils.ByteArrayDataSource)

Example 3 with ByteArrayDataSource

use of org.apache.pdfbox.preflight.utils.ByteArrayDataSource in project mustangproject by ZUGFeRD.

the class OXExporterFromA3 method load.

/**
 * 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)
 *
 * @param pdfBinary binary of a PDF/A1 compliant document
 */
public OXExporterFromA3 load(byte[] pdfBinary) throws IOException {
    ensurePDFIsValid(new ByteArrayDataSource(new ByteArrayInputStream(pdfBinary)));
    doc = PDDocument.load(pdfBinary);
    return this;
}
Also used : ByteArrayDataSource(org.apache.pdfbox.preflight.utils.ByteArrayDataSource)

Aggregations

ByteArrayDataSource (org.apache.pdfbox.preflight.utils.ByteArrayDataSource)3 ByteArrayInputStream (java.io.ByteArrayInputStream)1 PDDocument (org.apache.pdfbox.pdmodel.PDDocument)1