feat: added additional meta data attributes
This commit is contained in:
Regular → Executable
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Regular → Executable
Binary file not shown.
Regular → Executable
Regular → Executable
Regular → Executable
@@ -15,3 +15,30 @@
|
|||||||
2024-08-22 22:24:08 pdfInput: './Verkauf_Rechnung_Neu.pdf' xmlInput: 'appended.xml' output: 'test.pdf'
|
2024-08-22 22:24:08 pdfInput: './Verkauf_Rechnung_Neu.pdf' xmlInput: 'appended.xml' output: 'test.pdf'
|
||||||
2024-08-22 22:26:44 enter appendToPdf(./Verkauf_Rechnung_Neu.pdf, ./appended.xml, test.pdf)
|
2024-08-22 22:26:44 enter appendToPdf(./Verkauf_Rechnung_Neu.pdf, ./appended.xml, test.pdf)
|
||||||
2024-08-22 22:26:44 pdfInput: './Verkauf_Rechnung_Neu.pdf' xmlInput: './appended.xml' output: 'test.pdf'
|
2024-08-22 22:26:44 pdfInput: './Verkauf_Rechnung_Neu.pdf' xmlInput: './appended.xml' output: 'test.pdf'
|
||||||
|
2025-12-23 12:46:16 enter appendToPdf(./Verkauf_Rechnung_Neu.pdf, ./appended.xml, test.pdf)
|
||||||
|
2025-12-23 12:46:16 pdfInput: './Verkauf_Rechnung_Neu.pdf' xmlInput: './appended.xml' output: 'test.pdf'
|
||||||
|
2025-12-23 12:46:16 leave appendToPdf
|
||||||
|
2025-12-23 12:47:31 enter appendToPdf(./Verkauf_Rechnung_Neu.pdf, ./appended.xml, test.pdf)
|
||||||
|
2025-12-23 12:47:45 pdfInput: './Verkauf_Rechnung_Neu.pdf' xmlInput: './appended.xml' output: 'test.pdf'
|
||||||
|
2025-12-23 12:47:52 leave appendToPdf
|
||||||
|
2025-12-23 12:54:59 enter appendToPdf(./Verkauf_Rechnung_Neu.pdf, ./appended.xml, test.pdf)
|
||||||
|
2025-12-23 12:54:59 pdfInput: './Verkauf_Rechnung_Neu.pdf' xmlInput: './appended.xml' output: 'test.pdf'
|
||||||
|
2025-12-23 12:59:27 leave appendToPdf
|
||||||
|
2025-12-23 12:59:37 enter appendToPdf(./Verkauf_Rechnung_Neu.pdf, ./appended.xml, test.pdf)
|
||||||
|
2025-12-23 12:59:37 pdfInput: './Verkauf_Rechnung_Neu.pdf' xmlInput: './appended.xml' output: 'test.pdf'
|
||||||
|
2025-12-23 12:59:42 leave appendToPdf
|
||||||
|
2025-12-23 13:53:49 enter appendToPdf(./Verkauf_Rechnung_Neu.pdf, ./appended.xml, test.pdf)
|
||||||
|
2025-12-23 13:53:49 pdfInput: './Verkauf_Rechnung_Neu.pdf' xmlInput: './appended.xml' output: 'test.pdf'
|
||||||
|
2025-12-23 13:53:49 leave appendToPdf
|
||||||
|
2025-12-23 13:54:19 enter appendToPdf(./Verkauf_Rechnung_Neu.pdf, ./appended.xml, test.pdf)
|
||||||
|
2025-12-23 13:54:19 pdfInput: './Verkauf_Rechnung_Neu.pdf' xmlInput: './appended.xml' output: 'test.pdf'
|
||||||
|
2025-12-23 13:54:26 leave appendToPdf
|
||||||
|
2025-12-23 13:55:26 enter appendToPdf(./Verkauf_Rechnung_Neu.pdf, ./appended.xml, test.pdf)
|
||||||
|
2025-12-23 13:55:26 pdfInput: './Verkauf_Rechnung_Neu.pdf' xmlInput: './appended.xml' output: 'test.pdf'
|
||||||
|
2025-12-23 13:55:26 leave appendToPdf
|
||||||
|
2026-02-05 19:47:45 enter appendToPdf(./Verkauf_Rechnung_Neu.pdf, ./appended.xml, test.pdf)
|
||||||
|
2026-02-05 19:47:45 pdfInput: './Verkauf_Rechnung_Neu.pdf' xmlInput: './appended.xml' output: 'test.pdf'
|
||||||
|
2026-02-05 19:47:45 leave appendToPdf
|
||||||
|
2026-02-05 19:48:32 enter appendToPdf(./Verkauf_Rechnung_Neu.pdf, ./appended.xml, test.pdf)
|
||||||
|
2026-02-05 19:48:32 pdfInput: './Verkauf_Rechnung_Neu.pdf' xmlInput: './appended.xml' output: 'test.pdf'
|
||||||
|
2026-02-05 19:48:32 leave appendToPdf
|
||||||
|
|||||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
+44
-3
@@ -1,8 +1,11 @@
|
|||||||
package lib
|
package lib
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -41,9 +44,17 @@ func AppendToPdf(inputPdfFilePath string, inputXmlFilePath string, outputFilePat
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
err := api.AddAttachmentsFile(
|
inputFile, err := os.Open(inputPdfFilePath)
|
||||||
inputPdfFilePath,
|
if err != nil {
|
||||||
outputFilePath,
|
return err
|
||||||
|
}
|
||||||
|
defer inputFile.Close()
|
||||||
|
|
||||||
|
dest := bytes.Buffer{}
|
||||||
|
|
||||||
|
err = api.AddAttachments(
|
||||||
|
inputFile,
|
||||||
|
&dest,
|
||||||
[]string{inputXmlFilePath},
|
[]string{inputXmlFilePath},
|
||||||
true,
|
true,
|
||||||
model.NewDefaultConfiguration(),
|
model.NewDefaultConfiguration(),
|
||||||
@@ -52,5 +63,35 @@ func AppendToPdf(inputPdfFilePath string, inputXmlFilePath string, outputFilePat
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
source := bytes.NewReader(dest.Bytes())
|
||||||
|
dest = bytes.Buffer{}
|
||||||
|
|
||||||
|
err = api.AddProperties(source, &dest, map[string]string{
|
||||||
|
"DocumentFileName": path.Base(inputXmlFilePath),
|
||||||
|
"DocumentType": "INVOICE",
|
||||||
|
"ConformanceLevel": "EN 16931",
|
||||||
|
"SchemasSchema": "Factur-X PDFA Extension Schema",
|
||||||
|
"SchemasPrefix": "fx",
|
||||||
|
"SchemasPropertyName": "DocumentFileName",
|
||||||
|
"SchemasPropertyValueType": "Text",
|
||||||
|
"SchemasPropertyCategory": "external",
|
||||||
|
"SchemasPropertyDescription": "The name of the embedded XML document",
|
||||||
|
}, model.NewDefaultConfiguration())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
var outputFile *os.File
|
||||||
|
outputFile, err = os.Create(outputFilePath)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer outputFile.Close()
|
||||||
|
|
||||||
|
_, err = outputFile.Write(dest.Bytes())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Regular → Executable
Regular → Executable
Reference in New Issue
Block a user