Added setCreatorTool (fix for https://github.com/ZUGFeRD/mustangproject/issues/38 Distinguish between creator, creatorTool and producer)

This commit is contained in:
andreas.vef
2018-11-14 15:04:54 +01:00
committed by joehni
parent 970436cf41
commit 6bb4ccaff0
2 changed files with 23 additions and 1 deletions

View File

@@ -100,8 +100,12 @@ public class ZUGFeRDExporter implements Closeable {
protected PDMetadata metadata = null;
protected PDFAIdentificationSchema pdfaid = null;
protected XMPMetadata xmp = null;
/** Producer attribute for PDF */
protected String producer = "mustangproject";
/** Author/Creator attribute for PDF for PDF */
protected String creator = "mustangproject";
/** CreatorTool */
protected String creatorTool = "mustangproject";
@Deprecated
private boolean ignoreA1Errors;
@@ -558,7 +562,7 @@ public class ZUGFeRDExporter implements Closeable {
XMPBasicSchema xsb = xmp.createAndAddXMPBasicSchema();
xsb.setCreatorTool(creator);
xsb.setCreatorTool(creatorTool);
xsb.setCreateDate(GregorianCalendar.getInstance());
// PDDocumentInformation pdi=doc.getDocumentInformation();
PDDocumentInformation pdi = new PDDocumentInformation();
@@ -619,6 +623,13 @@ public class ZUGFeRDExporter implements Closeable {
public void setCreator(String creator) {
this.creator = creator;
}
/**
* the CreatorTool attribute for the PDF
* @param creator
*/
protected void setCreatorTool(String creatorTool) {
this.creatorTool = creatorTool;
}
/**
* the authoring software (use factory method instead)

View File

@@ -36,8 +36,12 @@ public class ZUGFeRDExporterFromA3Factory implements IExporterFactory {
protected boolean ignorePDFAErrors = false;
protected ZUGFeRDConformanceLevel zugferdConformanceLevel = ZUGFeRDConformanceLevel.EXTENDED;
protected PDFAConformanceLevel conformanceLevel = PDFAConformanceLevel.UNICODE;
/** Producer (attribute for PDF */
protected String producer = "mustangproject";
/** Human creator (attribute for PDF) */
protected String creator = "mustangproject";
/** Creator tool (attribute for PDF) */
protected String creatorTool = null;
protected int ZFVersion=ZUGFeRDExporter.DefaultZUGFeRDVersion;
protected boolean ensurePDFisUpgraded=false;
@@ -58,6 +62,8 @@ public class ZUGFeRDExporterFromA3Factory implements IExporterFactory {
zugFeRDExporter.setZUGFeRDVersion(ZFVersion);
zugFeRDExporter.setZUGFeRDConformanceLevel(zugferdConformanceLevel);
zugFeRDExporter.setCreator(creator);
// Use creator as default for compatibility
zugFeRDExporter.setCreatorTool(creatorTool != null ? creatorTool : creator);
zugFeRDExporter.setProducer(producer);
zugFeRDExporter.setAttachZUGFeRDHeaders(attachZUGFeRDHeaders);
zugFeRDExporter.setPDFA3(ensurePDFisUpgraded);
@@ -190,6 +196,11 @@ public class ZUGFeRDExporterFromA3Factory implements IExporterFactory {
this.creator = creator;
return this;
}
public IExporterFactory setCreatorTool(String creatorTool) {
this.creatorTool = creatorTool;
return this;
}
public IExporterFactory setProducer(String producer) {
this.producer = producer;