corrected Producer and added Producer unit test
This commit is contained in:
@@ -33,6 +33,7 @@ import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -298,6 +299,10 @@ public class ZUGFeRDExporter implements Closeable {
|
||||
public void export(String ZUGFeRDfilename) throws IOException {
|
||||
doc.save(ZUGFeRDfilename);
|
||||
}
|
||||
|
||||
public void export(OutputStream output) throws IOException {
|
||||
doc.save(output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Embeds an external file (generic - any type allowed) in the PDF.
|
||||
|
||||
@@ -88,7 +88,7 @@ public class ZUGFeRDExporterFromA1Factory {
|
||||
}
|
||||
|
||||
private void makePDFA3compliant(PDDocument doc) throws IOException {
|
||||
String fullProducer = producer + " (via mustangproject.org " + Version.getVersion() + ")";
|
||||
String fullProducer = producer + " (via mustangproject.org "+org.mustangproject.ZUGFeRD.Version.VERSION+")";
|
||||
|
||||
PDDocumentCatalog cat = doc.getDocumentCatalog();
|
||||
PDMetadata metadata = new PDMetadata(doc);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.mustangproject.ZUGFeRD;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
@@ -50,7 +51,7 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
|
||||
*/
|
||||
public void testZExport() throws Exception {
|
||||
|
||||
final String TARGET_PDF = "./target/testout-MustangGnuaccountingBeispielRE-20170509_505newEdge.pdf";
|
||||
final String TARGET_PDF = "./target/testout-MustangGnuaccountingBeispielRE-20170509_505custom.pdf";
|
||||
// the writing part
|
||||
|
||||
try {
|
||||
@@ -58,7 +59,7 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
|
||||
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505blanko.pdf");
|
||||
|
||||
ZUGFeRDExporter zea1 = new ZUGFeRDExporterFromA1Factory().setProducer("My Application").setCreator("Test")
|
||||
.loadFromPDFA1("./Source.pdf");
|
||||
.loadFromPDFA1(SOURCE_PDF);
|
||||
String ownZUGFeRDXML = "<rsm:CrossIndustryDocument xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:ram=\"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:12\" xmlns:udt=\"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15\" xmlns:rsm=\"urn:ferd:CrossIndustryDocument:invoice:1p0\">\n"
|
||||
+ "<rsm:SpecifiedExchangedDocumentContext>\n" + "<ram:TestIndicator>\n"
|
||||
+ "<udt:Indicator>false</udt:Indicator>\n" + "</ram:TestIndicator>\n"
|
||||
@@ -191,7 +192,12 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
|
||||
zea1.setZUGFeRDXMLData(ownZUGFeRDXML.getBytes());
|
||||
zea1.PDFattachZugferdFile(null);
|
||||
|
||||
ByteArrayOutputStream baos=new ByteArrayOutputStream();
|
||||
|
||||
zea1.export(TARGET_PDF);
|
||||
zea1.export(baos);
|
||||
String pdfContent=baos.toString("UTF-8");
|
||||
assertFalse(pdfContent.indexOf("(via mustangproject.org")==-1);
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
|
||||
Reference in New Issue
Block a user