Pdf - Concatenate
Codeunit 5523674 bdev.Pdf - Concatenate merges PDF documents into a single one. Two of its overloads work on Temp Blob codeunits, the other two on a list of Base64 encoded documents - which is what you want when more than two documents are involved, because the order of the list is the order of the result.
All four overloads can produce several copies of the merged document in one go.
Code
ConcatenateDocument(Codeunit, Codeunit)
Appends a second document to a document.
Code
| Parameter | Type | Description |
|---|---|---|
document | Codeunit "Temp Blob" | The base document. It is replaced by the merged result. |
document2 | Codeunit "Temp Blob" | The document to append. |
Identical documents are merged only once
Both overloads that take two Temp Blob codeunits compare the two documents and drop the second one when it is byte-identical to the first. Appending a document to itself - to print a copy, for example - therefore does nothing. Use the copies parameter for that.
Example
Code
ConcatenateDocument(Codeunit, Codeunit, Integer, Boolean)
Appends a second document to a document and produces the given number of copies.
Code
| Parameter | Type | Description |
|---|---|---|
document | Codeunit "Temp Blob" | The base document. It is replaced by the merged result. |
document2 | Codeunit "Temp Blob" | The document to append. |
copies | Integer | The number of copies of the merged document. 0 means no copy handling at all, the documents are merged once. |
grouped | Boolean | The copy order, see Copies and copy order. |
ConcatenateDocument(List of [Text])
Merges a list of Base64 encoded PDF documents into one, in the order of the list.
Code
| Parameter | Type | Description |
|---|---|---|
documents | List of [Text] | The Base64 encoded PDF documents. |
Returns the merged document as a Temp Blob codeunit.
Unlike the overloads above, the list is merged as it is - identical entries are kept and appear in the result as often as they are listed.
Example
Code
ConcatenateDocument(List of [Text], Integer, Boolean)
Merges a list of Base64 encoded PDF documents into one and produces the given number of copies.
Code
| Parameter | Type | Description |
|---|---|---|
documents | List of [Text] | The Base64 encoded PDF documents. |
copies | Integer | The number of copies of the merged document. 0 means no copy handling at all. |
grouped | Boolean | The copy order, see Copies and copy order. |
Returns the merged document as a Temp Blob codeunit.
Copies and copy order
copies is the number of copies of the merged document, produced by the PDF service rather than by the printer. grouped decides in which order they end up in the result. For a merge of the documents A and B with three copies:
grouped | Copy order | Result |
|---|---|---|
true | Grouped | A A A B B B |
false | Collated | A B A B A B |
Collated is what a user expects when the result is stapled as a set - each copy is a complete document. Grouped is what you want when the copies are separated by document afterwards.
Collated is the default of the PDF service: the copy order is only sent when grouped is true. A copies value of 0 suppresses the copy handling altogether and leaves the merge as it is.


