Skip to content

Commit 15bdfbd

Browse files
author
Ihsan Nurul Iman
committed
f/dynamic-page-margin: add
1 parent 87c4c35 commit 15bdfbd

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

examples/dynamicPageMargins.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,24 @@ var pdfmake = require('../js/index'); // only during development, otherwise use
66
var Roboto = require('../fonts/Roboto');
77
pdfmake.addFonts(Roboto);
88

9-
// pdfmake.setUrlAccessPolicy((url) => {
10-
// // this can be used to restrict allowed domains
11-
// return url.startsWith('https://');
12-
// });
9+
pdfmake.setUrlAccessPolicy((url) => {
10+
// this can be used to restrict allowed domains
11+
return url.startsWith('https://');
12+
});
1313

1414
var loremIpsum = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ';
1515

1616
var docDefinition = {
1717
// Stable usage: page-local rules based on currentPage do not feed pagination
1818
// back into the callback, so layout converges naturally.
19-
// pageMargins: function(currentPage, pageCount, pageSize) {
20-
// return {
21-
// left: (currentPage % 2 === 0) ? 80 : 40,
22-
// top: 40,
23-
// right: (currentPage % 2 === 0) ? 40 : 80,
24-
// bottom: 40
25-
// };
26-
// },
19+
pageMargins: function(currentPage, pageCount, pageSize) {
20+
return {
21+
left: (currentPage % 2 === 0) ? 80 : 40,
22+
top: 40,
23+
right: (currentPage % 2 === 0) ? 40 : 80,
24+
bottom: 40
25+
};
26+
},
2727
content: [
2828
{ text: loremIpsum.repeat(42) },
2929
'',
1.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)