diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml deleted file mode 100644 index 850770ec..00000000 --- a/dependency-reduced-pom.xml +++ /dev/null @@ -1,258 +0,0 @@ - - - 4.0.0 - org.mustangproject.ZUGFeRD - mustang - Mustang - 1.5.2 - The Mustang project is a java library to read and write ZUGFeRD meta data inside your invoice PDFs - http://www.mustangproject.org/ - - - User List - https://groups.google.com/forum/?hl=de#!forum/mustangproject - - - - - Jochen Stärk - jstaerk@usegroup.de - - architect - developer - - - - Alexander Schmidt - schmidt.alexander@mail.de - - developer - - - - - - Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - A business-friendly OSS license - - - - scm:git:https://github.com/ZUGFeRD/mustangproject.git - scm:git:https://github.com/ZUGFeRD/mustangproject.git - mustang-1.5.2 - https://github.com/ZUGFeRD/mustangproject - - - - - - maven-release-plugin - 2.5.3 - - - - - - maven-compiler-plugin - 3.6.1 - - - - true - org.mustangproject.toecount.Toecount - - - - jar-with-dependencies - - 1.7 - 1.7 - - - - maven-deploy-plugin - 2.8.2 - - internal.repo::default::file://${project.build.directory}/mvn-repo - - - - com.github.github - site-maven-plugin - 0.12 - - - deploy - - site - - - - - Maven artifacts for ${project.version} - true - ${project.build.directory}/mvn-repo - refs/heads/mvn-repo - - **/* - - true - mustangproject - ZUGFeRD - - - - maven-shade-plugin - 2.4.3 - - - package - - shade - - - - - - - - - - - - org.mustangproject.toecount.Toecount - - - true - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - log4j:log4j - - ** - - - - commons-logging:commons-logging - - ** - - - - com.sun.xml.bind:jaxb-impl - - ** - - - - com.sun.xml.bind:jaxb-core - - ** - - - - - - - org.codehaus.mojo - templating-maven-plugin - 1.0.0 - - - filtering-java-templates - - filter-sources - - - - - - org.codehaus.mojo - jaxb2-maven-plugin - 2.3.1 - - - xjc - - xjc - - - - - 2.1 - org.mustangproject.ZUGFeRD.model - - src/main/resources/schema/ZUGFeRD1p0.xsd - - - - - - - - - - sonatype-oss-public - https://oss.sonatype.org/content/groups/public/ - - - - - junit - junit - 4.12 - test - - - hamcrest-core - org.hamcrest - - - - - com.helger - ph-schematron - 5.0.4 - test - - - ph-commons - com.helger - - - ph-xml - com.helger - - - ph-jaxb - com.helger - - - - - - - internal.repo - Temporary Staging Repository - file://${project.build.directory}/mvn-repo - - - - 1.7 - github - 1.7 - -Xdoclint:none - UTF-8 - 1.7 - - - diff --git a/doc/MustangDev.en.odt b/doc/MustangDev.en.odt index 4acb2eb2..0a65fcea 100644 Binary files a/doc/MustangDev.en.odt and b/doc/MustangDev.en.odt differ diff --git a/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporter.java b/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporter.java index e83be1b8..a5ad456d 100644 --- a/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporter.java +++ b/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporter.java @@ -114,6 +114,8 @@ public class ZUGFeRDExporter implements Closeable { private boolean fileAttached = false; protected boolean attachZUGFeRDHeaders = true; + private boolean documentPrepared=false; + public ZUGFeRDExporter() { init(); } @@ -312,7 +314,7 @@ public class ZUGFeRDExporter implements Closeable { * setZUGFeRDXMLData(byte[] zugferdData) */ public void PDFattachZugferdFile(IZUGFeRDExportableTransaction trans) throws IOException { - prepareDocument(doc); + prepareDocument(); xmlProvider.generateXML(trans); String filename = getFilenameForVersion(ZFVersion); @@ -333,6 +335,9 @@ public class ZUGFeRDExporter implements Closeable { } public void export(String ZUGFeRDfilename) throws IOException { + if (!documentPrepared) { + prepareDocument(); + } if ((!fileAttached)&&(attachZUGFeRDHeaders)) { throw new IOException( "File must be attached (usually with PDFattachZugferdFile) before perfoming this operation"); @@ -530,7 +535,7 @@ public class ZUGFeRDExporter implements Closeable { return buffer.toByteArray(); } - protected void prepareDocument(PDDocument doc) throws IOException { + protected void prepareDocument() throws IOException { String fullProducer = producer + " (via mustangproject.org " + org.mustangproject.ZUGFeRD.Version.VERSION + ")"; PDDocumentCatalog cat = doc.getDocumentCatalog(); @@ -571,20 +576,19 @@ public class ZUGFeRDExporter implements Closeable { pdfaid.setPart(3); } - if (attachZUGFeRDHeaders) { - addXMP(xmp); /* + addXMP(xmp); /* * this is the only line where we do something Zugferd-specific, i.e. add PDF * metadata specifically for Zugferd, not generically for a embedded file */ - } - + try { metadata.importXMPMetadata(serializeXmpMetadata(xmp)); } catch (TransformerException e) { throw new ZUGFeRDExportException("Could not export XmpMetadata", e); } + documentPrepared=true; } /**