I'm using the DOCXJS library and was wondering if it was possible to reduce the default document margins.
I found that the docs briefly mention that you can alter margins of sections, though they don't explain how.
Fixed it by checking out the demos. The syntax that should be used is:
const doc = new Document({
sections: [
{
properties: {
page: {
margin: {
top: 0,
right: 0,
bottom: 0,
left: 0,
},
},
},
children: [new docx.Paragraph({text:"Hello World!"})],
},
],
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With