Skip to content

Commit

Permalink
🤖 Merge PR DefinitelyTyped#68471 [pdfmake] Add QR code padding and do…
Browse files Browse the repository at this point in the history
…cument language by @kryops

* [pdfmake] Add QR code padding

* [pdfmake] Add document language
  • Loading branch information
kryops authored Feb 5, 2024
1 parent 801a18a commit 53d9177
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
14 changes: 14 additions & 0 deletions types/pdfmake/interfaces.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1356,6 +1356,15 @@ export interface ContentQr extends ContentBase, ForbidOtherElementProperties<"qr
* avoid problematic patterns in the resulting QR code.
*/
mask?: number | undefined;

/**
* Padding on all sides of the QR code, specified as multiples of the size of a QR code pixel.
*
* The padding does not affect the size of the QR code itself, even if {@link fit} is specified.
*
* Defaults to `0`.
*/
padding?: number | undefined;
}

/**
Expand Down Expand Up @@ -2143,6 +2152,11 @@ export interface TDocumentDefinitions {
* Dictionary of reusable pattern definitions that can be referenced by their key.
*/
patterns?: Record<string, Pattern> | undefined;

/**
* Document language as BCP 47 language tag, e.g. `en-US`.
*/
language?: string | undefined;
}

/**
Expand Down
10 changes: 10 additions & 0 deletions types/pdfmake/test/pdfmake-examples-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,15 @@ const qrCode: TDocumentDefinitions = {
fit: 100,
alignment: "right",
},
{
text: "same long text with fit = 100 and padding = 1 modules in pixel",
style: "header",
},
{
qr: "The amount of data that can be stored in the QR code symbol depends on the datatype (mode, or input character set), version (1, …, 40, indicating the overall dimensions of the symbol), and error correction level. The maximum storage capacities occur for 40-L symbols (version 40, error correction level L):",
fit: 100,
padding: 1,
},
],
styles: {
header: {
Expand Down Expand Up @@ -1306,6 +1315,7 @@ const stylingInlines: TDocumentDefinitions = {
italics: true,
},
},
language: "en-AU",
};

const stylingNamedStylesWithOverrides: TDocumentDefinitions = {
Expand Down

0 comments on commit 53d9177

Please sign in to comment.