-
Notifications
You must be signed in to change notification settings - Fork 51
Class ZugferdDocumentPdfMerger
HorstOeko edited this page Dec 27, 2024
·
25 revisions
Class representing the facillity adding existing XML data (file or data-string)
to an existing PDF with conversion to PDF/A
use horstoeko\zugferd\ZugferdDocumentPdfMerger;
$existingXmlFile = "/tmp/invoice_1.xml";
$existingPdfFile = "/tmp/emptypdf.pdf";
$mergeToPdf = "/tmp/fullpdf.pdf";
if (!file_exists($existingXmlFile) || !file_exists($existingPdfFile)) {
throw new \Exception("XML and/or PDF does not exist");
}
(new ZugferdDocumentPdfMerger($existingXmlFile, $existingPdfFile))
->generateDocument()
->saveDocument($mergeToPdf);
use horstoeko\zugferd\ZugferdDocumentPdfMerger;
$xmlString= "<xml>...</xml>";
$existingPdfFile = "/tmp/emptypdf.pdf";
$mergeToPdf = "/tmp/fullpdf.pdf";
if (!file_exists($existingPdfFile)) {
throw new \Exception("XML and/or PDF does not exist");
}
(new ZugferdDocumentPdfMerger($xmlString, $existingPdfFile))
->generateDocument()
->saveDocument($mergeToPdf);
use horstoeko\zugferd\ZugferdDocumentPdfMerger;
$existingXmlFile = "/tmp/invoice_1.xml";
$pdfString = "%PDF-1.4.....";
$mergeToPdf = "/tmp/fullpdf.pdf";
if (!file_exists($existingXmlFile)) {
throw new \Exception("XML and/or PDF does not exist");
}
(new ZugferdDocumentPdfMerger($existingXmlFile, $pdfString))
->generateDocument()
->saveDocument($mergeToPdf);
use horstoeko\zugferd\ZugferdDocumentPdfMerger;
$xmlString= "<xml>...</xml>";
$pdfString = "%PDF-1.4.....";
$mergeToPdf = "/tmp/fullpdf.pdf";
(new ZugferdDocumentPdfMerger($xmlString, $pdfString))
->generateDocument()
->saveDocument($mergeToPdf);
Constructor
public function __construct(string $xmlDataOrFilename, string $pdfData): void
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
xmlDataOrFilename | string | ❌ |
The XML data as a string or the full qualified path to an XML-File containing the XML-data |
pdfData | string | ❌ |
The full filename or a string containing the binary pdf data. This is the original PDF (e.g. created by a ERP system) |
Set the the deterministic mode. This mode should only be used
for testing purposes
public function setDeterministicModeEnabled(bool $deterministicModeEnabled): static
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
deterministicModeEnabled | bool | ❌ |
Returns a value of type static
Set the template for the author meta information
public function setAuthorTemplate(string $authorTemplate): static
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
authorTemplate | string | ❌ |
Returns a value of type static
Set the template for the keyword meta information
public function setKeywordTemplate(string $keywordTemplate): static
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
keywordTemplate | string | ❌ |
Returns a value of type static
Set the template for the title meta information
public function setTitleTemplate(string $titleTemplate): static
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
titleTemplate | string | ❌ |
Returns a value of type static
Set the template for the subject meta information
public function setSubjectTemplate(string $subjectTemplate): static
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
subjectTemplate | string | ❌ |
Returns a value of type static
Set the user defined callback for generating custom meta information
public function setMetaInformationCallback(?callable $callback = null): static
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
callback | callable | ✔️ |
Returns a value of type static