also accept pdf/a3 from inputstream

This commit is contained in:
jstaerk
2023-12-12 16:53:55 +01:00
parent a11a79333c
commit a4361e5c45
2 changed files with 6 additions and 3 deletions

View File

@@ -137,8 +137,9 @@ public class ZUGFeRDExporterFromPDFA implements IZUGFeRDExporter {
* @throws IOException if anything is wrong with inputstream
*/
public IZUGFeRDExporter load(InputStream pdfSource) throws IOException {
determineAndSetExporter(getPDFAVersion(inputstreamToByteArray(pdfSource)));
return theExporter.load(pdfSource);
byte[] byteArray=inputstreamToByteArray(pdfSource);
determineAndSetExporter(getPDFAVersion(byteArray));
return theExporter.load(byteArray);
}
public IZUGFeRDExporter setCreator(String creator) {

View File

@@ -26,6 +26,7 @@ import org.junit.runners.MethodSorters;
import org.mustangproject.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.Date;
@@ -101,7 +102,8 @@ public class PDFAWriteTest extends ResourceCase {
File tempFile = getResourceAsFile("MustangGnuaccountingBeispielRE-20201121_508blanko.pdf");
int exceptions=0;
try {
IZUGFeRDExporter zea3 = new ZUGFeRDExporterFromPDFA().load(tempFile.getAbsolutePath());
FileInputStream fis=new FileInputStream(tempFile);
IZUGFeRDExporter zea3 = new ZUGFeRDExporterFromPDFA().load(fis);
zea3.setTransaction(i);
zea3.setProfile(Profiles.getByName("EN16931"));
zea3.export(TARGET_PDF_FROM_A1_UNKNOWN);