Make America build again! ;-)
This commit is contained in:
@@ -13,6 +13,7 @@ import java.io.ByteArrayInputStream;
|
|||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -63,6 +64,19 @@ import org.mustangproject.ZUGFeRD.model.*;
|
|||||||
|
|
||||||
public class ZUGFeRDExporter implements Closeable {
|
public class ZUGFeRDExporter implements Closeable {
|
||||||
|
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
try {
|
||||||
|
jaxbContext = JAXBContext
|
||||||
|
.newInstance("org.mustangproject.ZUGFeRD.model");
|
||||||
|
marshaller = jaxbContext.createMarshaller();
|
||||||
|
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
|
||||||
|
marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
|
||||||
|
} catch (JAXBException e) {
|
||||||
|
throw new ZUGFeRDExportException("Could not initialize JAXB", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* * You will need Apache PDFBox. To use the ZUGFeRD exporter, implement
|
* * You will need Apache PDFBox. To use the ZUGFeRD exporter, implement
|
||||||
* IZUGFeRDExportableTransaction in yourTransaction (which will require you
|
* IZUGFeRDExportableTransaction in yourTransaction (which will require you
|
||||||
@@ -80,15 +94,13 @@ public class ZUGFeRDExporter implements Closeable {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public ZUGFeRDExporter() {
|
public ZUGFeRDExporter() {
|
||||||
try {
|
init();
|
||||||
jaxbContext = JAXBContext
|
|
||||||
.newInstance("org.mustangproject.ZUGFeRD.model");
|
|
||||||
marshaller = jaxbContext.createMarshaller();
|
|
||||||
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
|
|
||||||
marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
|
|
||||||
} catch (JAXBException e) {
|
|
||||||
throw new ZUGFeRDExportException("Could not initialize JAXB", e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ZUGFeRDExporter(PDDocument doc2) {
|
||||||
|
init();
|
||||||
|
doc=doc2;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class LineCalc {
|
private class LineCalc {
|
||||||
@@ -420,7 +432,7 @@ public class ZUGFeRDExporter implements Closeable {
|
|||||||
String producer, String creator, boolean attachZugferdHeaders)
|
String producer, String creator, boolean attachZugferdHeaders)
|
||||||
throws IOException, TransformerException {
|
throws IOException, TransformerException {
|
||||||
|
|
||||||
if (!ignoreA1Errors && !isValidA1(filename)) {
|
if (!ignoreA1Errors && !isValidA1(new FileInputStream(filename))) {
|
||||||
throw new IOException("File is not a valid PDF/A-1 input file");
|
throw new IOException("File is not a valid PDF/A-1 input file");
|
||||||
}
|
}
|
||||||
loadPDFA3(filename);
|
loadPDFA3(filename);
|
||||||
@@ -530,8 +542,8 @@ public class ZUGFeRDExporter implements Closeable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final ObjectFactory xmlFactory = new ObjectFactory();
|
private static final ObjectFactory xmlFactory = new ObjectFactory();
|
||||||
private final JAXBContext jaxbContext;
|
private JAXBContext jaxbContext;
|
||||||
private final Marshaller marshaller;
|
private Marshaller marshaller;
|
||||||
private static final SimpleDateFormat zugferdDateFormat = new SimpleDateFormat(
|
private static final SimpleDateFormat zugferdDateFormat = new SimpleDateFormat(
|
||||||
"yyyyMMdd"); //$NON-NLS-1$
|
"yyyyMMdd"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ public class ZUGFeRDExporterFromA1Factory {
|
|||||||
*/
|
*/
|
||||||
private void addZugferdXMP(XMPMetadata metadata) {
|
private void addZugferdXMP(XMPMetadata metadata) {
|
||||||
|
|
||||||
XMPSchemaZugferd zf = new XMPSchemaZugferd(metadata, zugferdConformanceLevel.name());
|
XMPSchemaZugferd zf = new XMPSchemaZugferd(metadata, zugferdConformanceLevel);
|
||||||
|
|
||||||
metadata.addSchema(zf);
|
metadata.addSchema(zf);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user