#451 corrected so that file attachments are also possible if source is a PDF/A-1 (and destination PDF/A-3)

This commit is contained in:
jstaerk
2024-08-28 13:56:45 +02:00
parent 302011e23a
commit 5a963a7ecf
4 changed files with 19 additions and 6 deletions

View File

@@ -17,7 +17,10 @@
- filename of embedded file was not xrechnung.xml when using profile xrechnung #452 - filename of embedded file was not xrechnung.xml when using profile xrechnung #452
- allow legalorganisation to have a tradingbusinessname #447 - allow legalorganisation to have a tradingbusinessname #447
- JSon deserialization does not work with BankDetails #455 - JSon deserialization does not work with BankDetails #455
- Fix ClassCastException in CLI (Main.java). #451
- Re-Formatted and re-organized POMs #446
- changed additional references by line from String to List and implemented it on Item #454
2.12.0 2.12.0
======= =======
2024-07-20 2024-07-20

View File

@@ -735,11 +735,7 @@ public class Main {
ze.setXML(Files.readAllBytes(Paths.get(xmlName))); ze.setXML(Files.readAllBytes(Paths.get(xmlName)));
for (FileAttachment attachment : attachments) { for (FileAttachment attachment : attachments) {
if (((ZUGFeRDExporterFromPDFA) ze).getExporter() instanceof ZUGFeRDExporterFromA3 ) { ze.attachFile(attachment.getFilename(), attachment.getData(), attachment.getMimetype(), attachment.getRelation());
((ZUGFeRDExporterFromA3) ((ZUGFeRDExporterFromPDFA) ze).getExporter()).attachFile(attachment.getFilename(), attachment.getData(), attachment.getMimetype(), attachment.getRelation());
} else {
System.err.println("IZUGFeRDExporter ze is not of type 'ZUGFeRDExporterFromA3'");
}
} }
ze.export(outName); ze.export(outName);

View File

@@ -23,6 +23,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import jakarta.activation.DataSource; import jakarta.activation.DataSource;
import org.mustangproject.FileAttachment;
public interface IZUGFeRDExporter extends Closeable, IExporter { public interface IZUGFeRDExporter extends Closeable, IExporter {
/** /**
@@ -64,6 +65,8 @@ public interface IZUGFeRDExporter extends Closeable, IExporter {
public String getNamespaceForVersion(int ver); public String getNamespaceForVersion(int ver);
public String getPrefixForVersion(int ver) ; public String getPrefixForVersion(int ver) ;
public IZUGFeRDExporter disableAutoClose(boolean disableAutoClose); public IZUGFeRDExporter disableAutoClose(boolean disableAutoClose);
public void attachFile(FileAttachment file);
public void attachFile(String filename, byte[] data, String mimetype, String relation);
public IXMLProvider getProvider(); public IXMLProvider getProvider();
} }

View File

@@ -34,6 +34,7 @@ import org.apache.xmpbox.XMPMetadata;
import org.apache.xmpbox.schema.PDFAIdentificationSchema; import org.apache.xmpbox.schema.PDFAIdentificationSchema;
import org.apache.xmpbox.xml.DomXmpParser; import org.apache.xmpbox.xml.DomXmpParser;
import org.apache.xmpbox.xml.XmpParsingException; import org.apache.xmpbox.xml.XmpParsingException;
import org.mustangproject.FileAttachment;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -72,6 +73,7 @@ public class ZUGFeRDExporterFromPDFA implements IZUGFeRDExporter {
} }
public IZUGFeRDExporter getExporter() { public IZUGFeRDExporter getExporter() {
if (theExporter==null) { if (theExporter==null) {
throw new RuntimeException("In ZUGFeRDExporterFromPDFA, source must always be loaded before other operations are performed."); throw new RuntimeException("In ZUGFeRDExporterFromPDFA, source must always be loaded before other operations are performed.");
@@ -247,5 +249,14 @@ public class ZUGFeRDExporterFromPDFA implements IZUGFeRDExporter {
public void export(OutputStream output) throws IOException { public void export(OutputStream output) throws IOException {
getExporter().export(output); getExporter().export(output);
} }
public void attachFile(FileAttachment file) {
theExporter.attachFile(file);
}
public void attachFile(String filename, byte[] data, String mimetype, String relation) {
theExporter.attachFile(filename, data, mimetype, relation);
}
} }