Upgrade of PDFBox to 2.0.5, Version upgrade to 1.4.0.0, add reference document to exporter interface (e.g. used for invoice corrections)
This commit is contained in:
Binary file not shown.
@@ -167,7 +167,7 @@ public class MustangWriter implements IZUGFeRDExportableTransaction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getOwnBIC() {
|
public String getOwnBIC() {
|
||||||
return "COBADEFXXX";
|
return "COBADEFFXXX";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
mustang/doc/konikmustangvergleich.odt
Normal file
BIN
mustang/doc/konikmustangvergleich.odt
Normal file
Binary file not shown.
@@ -3,24 +3,66 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.github.rayman2200</groupId>
|
<groupId>com.github.rayman2200</groupId>
|
||||||
<artifactId>mustang-sample-project</artifactId>
|
<artifactId>mustang-sample-project</artifactId>
|
||||||
<version>1.3.0-SNAPSHOT</version>
|
<version>1.3.0.1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>org.mustangproject.ZUGFeRD</groupId>
|
<groupId>org.mustangproject.ZUGFeRD</groupId>
|
||||||
<artifactId>mustang</artifactId>
|
<artifactId>mustang</artifactId>
|
||||||
<version>1.3.0-SNAPSHOT</version>
|
<version>1.3.0.1-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>Mustang</name>
|
<name>Mustang</name>
|
||||||
<description>The Mustang project is a java library to read and write ZUGFeRD meta data inside your invoice PDFs</description>
|
<description>The Mustang project is a java library to read and write ZUGFeRD meta data inside your invoice PDFs</description>
|
||||||
<url>http://www.mustangproject.org/</url>
|
<url>http://www.mustangproject.org/</url>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>2.4.3</version>
|
||||||
|
<configuration>
|
||||||
|
<minimizeJar>true</minimizeJar>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<artifactSet>
|
||||||
|
<excludes>
|
||||||
|
<!--exclude>classworlds:classworlds</exclude>
|
||||||
|
<exclude>junit:junit</exclude>
|
||||||
|
<exclude>jmock:*</exclude>
|
||||||
|
<exclude>*:xml-apis</exclude>
|
||||||
|
<exclude>org.apache.maven:lib:tests</exclude>
|
||||||
|
<exclude>log4j:log4j:jar:</exclude-->
|
||||||
|
</excludes>
|
||||||
|
</artifactSet>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.glassfish.jaxb</groupId>
|
<groupId>org.glassfish.jaxb</groupId>
|
||||||
<artifactId>jaxb-runtime</artifactId>
|
<artifactId>jaxb-runtime</artifactId>
|
||||||
<version>2.2.11</version>
|
<version>2.2.11</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.pdfbox</groupId>
|
||||||
|
<artifactId>preflight</artifactId>
|
||||||
|
<version>1.8.8</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.pdfbox</groupId>
|
||||||
|
<artifactId>pdfbox</artifactId>
|
||||||
|
<version>1.8.8</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<mailingLists>
|
<mailingLists>
|
||||||
@@ -56,5 +98,4 @@
|
|||||||
</roles>
|
</roles>
|
||||||
</developer>
|
</developer>
|
||||||
</developers>
|
</developers>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ package org.mustangproject.ZUGFeRD;
|
|||||||
* Neccessary interface for ZUGFeRD exporter
|
* Neccessary interface for ZUGFeRD exporter
|
||||||
* Licensed under the APLv2
|
* Licensed under the APLv2
|
||||||
* @date 2014-05-10
|
* @date 2014-05-10
|
||||||
* @version 1.0
|
* @version 1.2.0
|
||||||
* @author jstaerk
|
* @author jstaerk
|
||||||
* */
|
* */
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ package org.mustangproject.ZUGFeRD;
|
|||||||
* Neccessary interface for ZUGFeRD exporter
|
* Neccessary interface for ZUGFeRD exporter
|
||||||
* Licensed under the APLv2
|
* Licensed under the APLv2
|
||||||
* @date 2014-05-10
|
* @date 2014-05-10
|
||||||
* @version 1.0
|
* @version 1.2.0
|
||||||
* @author jstaerk
|
* @author jstaerk
|
||||||
* */
|
* */
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import java.math.BigDecimal;
|
|||||||
* Necessary interface for ZUGFeRD exporter
|
* Necessary interface for ZUGFeRD exporter
|
||||||
* Licensed under the APLv2
|
* Licensed under the APLv2
|
||||||
* @date 2014-05-10
|
* @date 2014-05-10
|
||||||
* @version 1.0
|
* @version 1.2.0
|
||||||
* @author jstaerk
|
* @author jstaerk
|
||||||
* */
|
* */
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ package org.mustangproject.ZUGFeRD;
|
|||||||
* Neccessary interface for ZUGFeRD exporter
|
* Neccessary interface for ZUGFeRD exporter
|
||||||
* Licensed under the APLv2
|
* Licensed under the APLv2
|
||||||
* @date 2014-05-10 to 2014-06-25
|
* @date 2014-05-10 to 2014-06-25
|
||||||
* @version 1.0.2
|
* @version 1.2.0
|
||||||
* @author jstaerk
|
* @author jstaerk
|
||||||
* */
|
* */
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ public interface IZUGFeRDExportableTransaction {
|
|||||||
* get main invoice currency used on the invoice
|
* get main invoice currency used on the invoice
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
String getInvoiceCurrency();
|
String getCurrency();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get payment information text. e.g. Bank transfer
|
* get payment information text. e.g. Bank transfer
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
package org.mustangproject.ZUGFeRD;
|
package org.mustangproject.ZUGFeRD;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
/**
|
||||||
|
* Mustangproject's ZUGFeRD implementation
|
||||||
|
* ZUGFeRD exporter helper class
|
||||||
|
* Licensed under the APLv2
|
||||||
|
* @date 2015-10-29
|
||||||
|
* @version 1.2.0
|
||||||
|
* @author jstaerk
|
||||||
|
* */
|
||||||
public class VATAmount {
|
public class VATAmount {
|
||||||
|
|
||||||
public VATAmount(BigDecimal basis, BigDecimal calculated) {
|
public VATAmount(BigDecimal basis, BigDecimal calculated) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ package org.mustangproject.ZUGFeRD;
|
|||||||
* ZUGFeRD exporter helper class
|
* ZUGFeRD exporter helper class
|
||||||
* Licensed under the APLv2
|
* Licensed under the APLv2
|
||||||
* @date 2014-05-10
|
* @date 2014-05-10
|
||||||
* @version 1.0
|
* @version 1.2.0
|
||||||
* @author jstaerk
|
* @author jstaerk
|
||||||
* */
|
* */
|
||||||
import org.apache.jempbox.impl.XMLUtil;
|
import org.apache.jempbox.impl.XMLUtil;
|
||||||
@@ -112,6 +112,12 @@ import org.w3c.dom.Element;
|
|||||||
Element propertyNode = schema.getOwnerDocument().createElement(
|
Element propertyNode = schema.getOwnerDocument().createElement(
|
||||||
"pdfaSchema:property"); //$NON-NLS-1$
|
"pdfaSchema:property"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
Element valueTypeNode = schema.getOwnerDocument().createElement(
|
||||||
|
"pdfaSchema:valueType"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
Element seqListValueType = schema.getOwnerDocument().createElement(
|
||||||
|
"rdf:Seq"); //$NON-NLS-1$
|
||||||
|
|
||||||
Element sequenceNode = schema.getOwnerDocument().createElement(
|
Element sequenceNode = schema.getOwnerDocument().createElement(
|
||||||
"rdf:Seq"); //$NON-NLS-1$
|
"rdf:Seq"); //$NON-NLS-1$
|
||||||
|
|
||||||
@@ -150,6 +156,9 @@ import org.w3c.dom.Element;
|
|||||||
|
|
||||||
bagListNode.appendChild(propertyNode);
|
bagListNode.appendChild(propertyNode);
|
||||||
|
|
||||||
|
valueTypeNode.appendChild(seqListValueType);
|
||||||
|
bagListNode.appendChild(valueTypeNode);
|
||||||
|
|
||||||
bagNode.appendChild(bagListNode);
|
bagNode.appendChild(bagListNode);
|
||||||
schemasNode.appendChild(bagNode);
|
schemasNode.appendChild(bagNode);
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ package org.mustangproject.ZUGFeRD;
|
|||||||
* ZUGFeRD exporter helper class
|
* ZUGFeRD exporter helper class
|
||||||
* Licensed under the APLv2
|
* Licensed under the APLv2
|
||||||
* @date 2014-05-10
|
* @date 2014-05-10
|
||||||
* @version 1.0
|
* @version 1.2.0s
|
||||||
* @author jstaerk
|
* @author jstaerk
|
||||||
* */
|
* */
|
||||||
import org.apache.jempbox.impl.XMLUtil;
|
import org.apache.jempbox.impl.XMLUtil;
|
||||||
@@ -15,7 +15,7 @@ import org.w3c.dom.Element;
|
|||||||
public class XMPSchemaZugferd extends XMPSchemaBasic
|
public class XMPSchemaZugferd extends XMPSchemaBasic
|
||||||
{
|
{
|
||||||
|
|
||||||
private String conformanceLevel = "COMFORT";
|
private String conformanceLevel = "EXTENDED";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is what needs to be added to the RDF metadata - basically the name of the embedded
|
* This is what needs to be added to the RDF metadata - basically the name of the embedded
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -15,6 +15,7 @@ import java.io.BufferedInputStream;
|
|||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.management.RuntimeErrorException;
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
@@ -48,10 +49,14 @@ public class ZUGFeRDImporter {
|
|||||||
private String IBAN;
|
private String IBAN;
|
||||||
private String holder;
|
private String holder;
|
||||||
private String amount;
|
private String amount;
|
||||||
|
private String dueDate;
|
||||||
/** Raw XML form of the extracted data - may be directly obtained. */
|
/** Raw XML form of the extracted data - may be directly obtained. */
|
||||||
private byte[] rawXML=null;
|
private byte[] rawXML=null;
|
||||||
private String bankName;
|
private String bankName;
|
||||||
private boolean amountFound;
|
private boolean amountFound;
|
||||||
|
private boolean extracted=false;
|
||||||
|
private boolean parsed=false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracts a ZUGFeRD invoice from a PDF document represented by a file name.
|
* Extracts a ZUGFeRD invoice from a PDF document represented by a file name.
|
||||||
@@ -106,6 +111,7 @@ public class ZUGFeRDImporter {
|
|||||||
// FileOutputStream fos = new FileOutputStream(file);
|
// FileOutputStream fos = new FileOutputStream(file);
|
||||||
rawXML = embeddedFile.getByteArray();
|
rawXML = embeddedFile.getByteArray();
|
||||||
setMeta(new String(rawXML));
|
setMeta(new String(rawXML));
|
||||||
|
extracted=true;
|
||||||
// fos.write(embeddedFile.getByteArray());
|
// fos.write(embeddedFile.getByteArray());
|
||||||
// fos.close();
|
// fos.close();
|
||||||
}
|
}
|
||||||
@@ -129,6 +135,10 @@ public class ZUGFeRDImporter {
|
|||||||
DocumentBuilder builder = null;
|
DocumentBuilder builder = null;
|
||||||
Document document = null;
|
Document document = null;
|
||||||
|
|
||||||
|
if (!extracted) {
|
||||||
|
throw new RuntimeException("extract() or extractLowLevel() must be used before parsing.");
|
||||||
|
}
|
||||||
|
|
||||||
factory = DocumentBuilderFactory.newInstance();
|
factory = DocumentBuilderFactory.newInstance();
|
||||||
factory.setNamespaceAware(true); //otherwise we can not act namespace independend, i.e. use document.getElementsByTagNameNS("*",...
|
factory.setNamespaceAware(true); //otherwise we can not act namespace independend, i.e. use document.getElementsByTagNameNS("*",...
|
||||||
try {
|
try {
|
||||||
@@ -281,7 +291,25 @@ public class ZUGFeRDImporter {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ndList = document.getElementsByTagNameNS("*","SpecifiedTradePaymentTerms"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
for (int bookingIndex = 0; bookingIndex < ndList
|
||||||
|
.getLength(); bookingIndex++) {
|
||||||
|
Node booking = ndList.item(bookingIndex);
|
||||||
|
// there are many "name" elements, so get the one below
|
||||||
|
// SellerTradeParty
|
||||||
|
NodeList bookingDetails = booking.getChildNodes();
|
||||||
|
for (int detailIndex = 0; detailIndex < bookingDetails
|
||||||
|
.getLength(); detailIndex++) {
|
||||||
|
Node detail = bookingDetails.item(detailIndex);
|
||||||
|
if ((detail.getLocalName()!=null)&&(detail.getLocalName().equals("DueDateDateTime"))) { //$NON-NLS-1$
|
||||||
|
setDueDate(detail.getTextContent().trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
parsed=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -290,18 +318,24 @@ public class ZUGFeRDImporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getForeignReference() {
|
public String getForeignReference() {
|
||||||
|
if (!parsed) {
|
||||||
|
throw new RuntimeException("use parse() before requesting a value");
|
||||||
|
}
|
||||||
return foreignReference;
|
return foreignReference;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void setForeignReference(String foreignReference) {
|
private void setForeignReference(String foreignReference) {
|
||||||
this.foreignReference = foreignReference;
|
this.foreignReference = foreignReference;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public String getBIC() {
|
public String getBIC() {
|
||||||
|
if (!parsed) {
|
||||||
|
throw new RuntimeException("use parse() before requesting a value");
|
||||||
|
}
|
||||||
return BIC;
|
return BIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -312,6 +346,11 @@ public class ZUGFeRDImporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void setDueDate(String dueDate) {
|
||||||
|
this.dueDate = dueDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void setBankName(String bankname) {
|
private void setBankName(String bankname) {
|
||||||
this.bankName = bankname;
|
this.bankName = bankname;
|
||||||
}
|
}
|
||||||
@@ -319,23 +358,32 @@ public class ZUGFeRDImporter {
|
|||||||
|
|
||||||
|
|
||||||
public String getIBAN() {
|
public String getIBAN() {
|
||||||
|
if (!parsed) {
|
||||||
|
throw new RuntimeException("use parse() before requesting a value");
|
||||||
|
}
|
||||||
return IBAN;
|
return IBAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getBankName() {
|
public String getBankName() {
|
||||||
|
if (!parsed) {
|
||||||
|
throw new RuntimeException("use parse() before requesting a value");
|
||||||
|
}
|
||||||
return bankName;
|
return bankName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void setIBAN(String IBAN) {
|
private void setIBAN(String IBAN) {
|
||||||
this.IBAN = IBAN;
|
this.IBAN = IBAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public String getHolder() {
|
public String getHolder() {
|
||||||
|
if (rawXML==null) {
|
||||||
|
throw new RuntimeException("use parse() before requesting a value");
|
||||||
|
}
|
||||||
return holder;
|
return holder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,9 +396,18 @@ public class ZUGFeRDImporter {
|
|||||||
|
|
||||||
|
|
||||||
public String getAmount() {
|
public String getAmount() {
|
||||||
|
if (rawXML==null) {
|
||||||
|
throw new RuntimeException("use parse() before requesting a value");
|
||||||
|
}
|
||||||
return amount;
|
return amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDueDate() {
|
||||||
|
if (rawXML==null) {
|
||||||
|
throw new RuntimeException("use parse() before requesting a value");
|
||||||
|
}
|
||||||
|
return dueDate;
|
||||||
|
}
|
||||||
|
|
||||||
private void setAmount(String amount) {
|
private void setAmount(String amount) {
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
|
|||||||
@Override
|
@Override
|
||||||
public String getOwnBIC()
|
public String getOwnBIC()
|
||||||
{
|
{
|
||||||
return "COBADEFXXX";
|
return "COBADEFFXXX";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -119,6 +119,12 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCurrency()
|
||||||
|
{
|
||||||
|
return "EUR";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IZUGFeRDExportableItem[] getZFItems()
|
public IZUGFeRDExportableItem[] getZFItems()
|
||||||
{
|
{
|
||||||
@@ -133,11 +139,6 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
|
|||||||
return allItems;
|
return allItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getInvoiceCurrency() {
|
|
||||||
return "EUR";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getOwnPaymentInfoText() {
|
public String getOwnPaymentInfoText() {
|
||||||
return "Überweisung";
|
return "Überweisung";
|
||||||
@@ -368,6 +369,7 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
|
|||||||
String iban = null;
|
String iban = null;
|
||||||
String holder = null;
|
String holder = null;
|
||||||
String ref = null;
|
String ref = null;
|
||||||
|
String dueDate = null;
|
||||||
|
|
||||||
if (zi.canParse())
|
if (zi.canParse())
|
||||||
{
|
{
|
||||||
@@ -376,6 +378,7 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
|
|||||||
bic = zi.getBIC();
|
bic = zi.getBIC();
|
||||||
iban = zi.getIBAN();
|
iban = zi.getIBAN();
|
||||||
holder = zi.getHolder();
|
holder = zi.getHolder();
|
||||||
|
dueDate = zi.getDueDate();
|
||||||
ref = zi.getForeignReference();
|
ref = zi.getForeignReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -383,6 +386,8 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
|
|||||||
assertEquals(bic, getOwnBIC());
|
assertEquals(bic, getOwnBIC());
|
||||||
assertEquals(iban, getOwnIBAN());
|
assertEquals(iban, getOwnIBAN());
|
||||||
assertEquals(holder, getOwnOrganisationName());
|
assertEquals(holder, getOwnOrganisationName());
|
||||||
|
|
||||||
|
assertEquals(dueDate, "20141029");
|
||||||
assertEquals(ref, getNumber());
|
assertEquals(ref, getNumber());
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -401,16 +406,13 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
|
|||||||
final String TARGET_PDF = "./target/testout-MustangGnuaccountingBeispielRE-20151008_504newEdge.pdf";
|
final String TARGET_PDF = "./target/testout-MustangGnuaccountingBeispielRE-20151008_504newEdge.pdf";
|
||||||
// the writing part
|
// the writing part
|
||||||
|
|
||||||
PDDocument doc;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
doc = PDDocument.load(SOURCE_PDF);
|
|
||||||
// automatically add Zugferd to all outgoing invoices
|
// automatically add Zugferd to all outgoing invoices
|
||||||
ZUGFeRDExporter ze = new ZUGFeRDExporter();
|
ZUGFeRDExporter ze = new ZUGFeRDExporter();
|
||||||
ze.PDFmakeA3compliant(doc, "My Application", System.getProperty("user.name"), true);
|
ze.PDFmakeA3compliant(SOURCE_PDF, "My Application", System.getProperty("user.name"), true);
|
||||||
ze.PDFattachZugferdFile(doc, this);
|
ze.PDFattachZugferdFile(this);
|
||||||
doc.save(TARGET_PDF);
|
ze.export(TARGET_PDF);
|
||||||
doc.close();
|
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
|
|||||||
@Override
|
@Override
|
||||||
public String getOwnBIC()
|
public String getOwnBIC()
|
||||||
{
|
{
|
||||||
return "COBADEFXXX";
|
return "COBADEFFXXX";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -118,6 +118,12 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCurrency()
|
||||||
|
{
|
||||||
|
return "EUR";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IZUGFeRDExportableItem[] getZFItems()
|
public IZUGFeRDExportableItem[] getZFItems()
|
||||||
{
|
{
|
||||||
@@ -132,11 +138,6 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
|
|||||||
return allItems;
|
return allItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getInvoiceCurrency() {
|
|
||||||
return "EUR";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getOwnPaymentInfoText() {
|
public String getOwnPaymentInfoText() {
|
||||||
return "Überweisung";
|
return "Überweisung";
|
||||||
@@ -403,16 +404,13 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
|
|||||||
final String TARGET_PDF = "./target/testout-MustangGnuaccountingBeispielRE-20151008_504new.pdf";
|
final String TARGET_PDF = "./target/testout-MustangGnuaccountingBeispielRE-20151008_504new.pdf";
|
||||||
|
|
||||||
// the writing part
|
// the writing part
|
||||||
PDDocument doc;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
doc = PDDocument.load(SOURCE_PDF);
|
|
||||||
// automatically add Zugferd to all outgoing invoices
|
// automatically add Zugferd to all outgoing invoices
|
||||||
ZUGFeRDExporter ze = new ZUGFeRDExporter();
|
ZUGFeRDExporter ze = new ZUGFeRDExporter();
|
||||||
ze.PDFmakeA3compliant(doc, "My Application", System.getProperty("user.name"), true);
|
ze.PDFmakeA3compliant(SOURCE_PDF, "My Application", System.getProperty("user.name"), true);
|
||||||
ze.PDFattachZugferdFile(doc, this);
|
ze.PDFattachZugferdFile(this);
|
||||||
doc.save(TARGET_PDF);
|
ze.export(TARGET_PDF);
|
||||||
doc.close();
|
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
|
|||||||
Binary file not shown.
@@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.mustangproject.ZUGFeRD</groupId>
|
<groupId>org.mustangproject.ZUGFeRD</groupId>
|
||||||
<artifactId>toecount</artifactId>
|
<artifactId>toecount</artifactId>
|
||||||
<version>0.0.6-SNAPSHOT</version>
|
<version>0.0.8-SNAPSHOT</version>
|
||||||
<name>ZUGFeRD PDF checker</name>
|
<name>ZUGFeRD PDF checker</name>
|
||||||
<description>Shows statistics on how many PDFs in a directory are ZUGFeRD-Compliant</description>
|
<description>Shows statistics on how many PDFs in a directory are ZUGFeRD-Compliant</description>
|
||||||
<repositories>
|
<repositories>
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mustangproject.ZUGFeRD</groupId>
|
<groupId>org.mustangproject.ZUGFeRD</groupId>
|
||||||
<artifactId>mustang</artifactId>
|
<artifactId>mustang</artifactId>
|
||||||
<version>1.2.1-SNAPSHOT</version>
|
<version>1.3.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.pdfbox</groupId>
|
<groupId>org.apache.pdfbox</groupId>
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ public class FileChecker {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ZUGFeRDImporter zi=new ZUGFeRDImporter();
|
ZUGFeRDImporter zi=new ZUGFeRDImporter();
|
||||||
|
try {
|
||||||
zi.extract(filename);
|
zi.extract(filename);
|
||||||
if (zi.canParse()) {
|
if (zi.canParse()) {
|
||||||
thisRun.incZUGFeRDCount();
|
thisRun.incZUGFeRDCount();
|
||||||
@@ -37,6 +38,28 @@ public class FileChecker {
|
|||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
// something really rare happened -- corrupted ZF?
|
||||||
|
/***
|
||||||
|
* e.g. Exception in thread "main" java.lang.NullPointerException
|
||||||
|
at org.mustangproject.ZUGFeRD.ZUGFeRDImporter.extractLowLevel(ZUGFeRDImporter.java:90)
|
||||||
|
at org.mustangproject.ZUGFeRD.ZUGFeRDImporter.extract(ZUGFeRDImporter.java:64)
|
||||||
|
at toecount.FileChecker.checkForZUGFeRD(FileChecker.java:33)
|
||||||
|
at toecount.Toecount.main(Toecount.java:111)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
// Ignore nevertheless, most likely we're batch processing
|
||||||
|
return false;
|
||||||
|
} catch (Exception e2) {
|
||||||
|
/**
|
||||||
|
* probably thrown up from
|
||||||
|
AM org.apache.pdfbox.pdfparser.PDFParser parse, most likely
|
||||||
|
INFORMATION: Document is encrypted
|
||||||
|
but also other internal PDF errors possible like
|
||||||
|
..Okt 23, 2015 11:17:53 AM org.apache.pdfbox.pdfparser.XrefTrailerResolver setStartxref
|
||||||
|
*/
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPDF() {
|
public boolean isPDF() {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class Toecount {
|
|||||||
}
|
}
|
||||||
private static void printHelp() {
|
private static void printHelp() {
|
||||||
System.out
|
System.out
|
||||||
.println("Mustangproject.org's Toecount 0.0.6 \r\n"
|
.println("Mustangproject.org's Toecount 0.0.7 \r\n"
|
||||||
+ "A Apache Public License command line tool for statistics on PDF invoices with\r\n"
|
+ "A Apache Public License command line tool for statistics on PDF invoices with\r\n"
|
||||||
+ "ZUGFeRD Metadata (http://www.zugferd.de)\r\n"
|
+ "ZUGFeRD Metadata (http://www.zugferd.de)\r\n"
|
||||||
+ "\r\n"
|
+ "\r\n"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.github.rayman2200</groupId>
|
<groupId>com.github.rayman2200</groupId>
|
||||||
<artifactId>mustang-sample-project</artifactId>
|
<artifactId>mustang-sample-project</artifactId>
|
||||||
<version>1.3.0-SNAPSHOT</version>
|
<version>1.3.0.1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>pdfa3-samples</artifactId>
|
<artifactId>pdfa3-samples</artifactId>
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import org.apache.jempbox.xmp.XMPSchemaBasic;
|
|||||||
import org.apache.jempbox.xmp.XMPSchemaDublinCore;
|
import org.apache.jempbox.xmp.XMPSchemaDublinCore;
|
||||||
import org.apache.jempbox.xmp.XMPSchemaPDF;
|
import org.apache.jempbox.xmp.XMPSchemaPDF;
|
||||||
import org.apache.jempbox.xmp.pdfa.XMPSchemaPDFAId;
|
import org.apache.jempbox.xmp.pdfa.XMPSchemaPDFAId;
|
||||||
|
import org.apache.pdfbox.cos.COSArray;
|
||||||
import org.apache.pdfbox.cos.COSDictionary;
|
import org.apache.pdfbox.cos.COSDictionary;
|
||||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||||
import org.apache.pdfbox.pdmodel.PDDocumentCatalog;
|
import org.apache.pdfbox.pdmodel.PDDocumentCatalog;
|
||||||
@@ -120,6 +121,10 @@ public class PDFA3FileAttachment
|
|||||||
// cosArray.add(fs);
|
// cosArray.add(fs);
|
||||||
// catalog.setItem("AF", cosArray);
|
// catalog.setItem("AF", cosArray);
|
||||||
|
|
||||||
|
COSDictionary dict2 = catalog.getCOSDictionary();
|
||||||
|
COSArray array = new COSArray();
|
||||||
|
array.add(fs.getCOSDictionary()); // see below
|
||||||
|
dict2.setItem("AF",array);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
24
pom.xml
24
pom.xml
@@ -2,13 +2,13 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.github.rayman2200</groupId>
|
<groupId>com.github.rayman2200</groupId>
|
||||||
<artifactId>mustang-sample-project</artifactId>
|
<artifactId>mustang-sample-project</artifactId>
|
||||||
<version>1.3.0-SNAPSHOT</version>
|
<version>1.3.3-SNAPSHOT</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<scm>
|
<scm>
|
||||||
<connection>scm:git:https://github.com/AlexanderSchmidt/PDFA3.git</connection>
|
<connection>scm:git:https://github.com/jstaerk/mustangproject.git</connection>
|
||||||
<developerConnection>scm:git:https://github.com/AlexanderSchmidt/PDFA3.git</developerConnection>
|
<developerConnection>scm:git:https://github.com/jstaerk/mustangproject.git</developerConnection>
|
||||||
<url>https://github.com/AlexanderSchmidt/PDFA3.git</url>
|
<url>https://github.com/jstaerk/mustangproject</url>
|
||||||
<tag>HEAD</tag>
|
<tag>HEAD</tag>
|
||||||
</scm>
|
</scm>
|
||||||
|
|
||||||
@@ -24,6 +24,7 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<github.global.server>github</github.global.server>
|
<github.global.server>github</github.global.server>
|
||||||
<additionalparam>-Xdoclint:none</additionalparam><!-- Skip error check for javadoc -->
|
<additionalparam>-Xdoclint:none</additionalparam><!-- Skip error check for javadoc -->
|
||||||
|
<maven.compiler.compilerVersion>1.6</maven.compiler.compilerVersion>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
@@ -35,7 +36,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.pdfbox</groupId>
|
<groupId>org.apache.pdfbox</groupId>
|
||||||
<artifactId>pdfbox</artifactId>
|
<artifactId>pdfbox</artifactId>
|
||||||
<version>1.8.10</version>
|
<version>1.8.8</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
@@ -47,15 +48,6 @@
|
|||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>3.2</version>
|
|
||||||
<configuration>
|
|
||||||
<source>1.6</source>
|
|
||||||
<target>1.6</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-deploy-plugin</artifactId>
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
<version>2.8.2</version>
|
<version>2.8.2</version>
|
||||||
@@ -76,8 +68,8 @@
|
|||||||
<include>**/*</include>
|
<include>**/*</include>
|
||||||
</includes>
|
</includes>
|
||||||
<merge>true</merge>
|
<merge>true</merge>
|
||||||
<repositoryName>PDFA3</repositoryName> <!-- github repo name -->
|
<repositoryName>mustangproject</repositoryName> <!-- github repo name -->
|
||||||
<repositoryOwner>AlexanderSchmidt</repositoryOwner> <!-- github username -->
|
<repositoryOwner>jstaerk</repositoryOwner> <!-- github username -->
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
<!-- run site-maven-plugin's 'site' target as part of the build's normal
|
<!-- run site-maven-plugin's 'site' target as part of the build's normal
|
||||||
|
|||||||
Reference in New Issue
Block a user