Files
docx-js/demo/15-page-break-before.ts
2019-08-06 23:08:21 +01:00

23 lines
537 B
TypeScript

// Page break before example
// Import from 'docx' rather than '../build' if you install from npm
import * as fs from "fs";
import { Document, Packer, Paragraph } from "../build";
const doc = new Document();
doc.addSection({
children: [
new Paragraph("Hello World"),
new Paragraph({
text: "Hello World on another page",
pageBreakBefore: true,
}),
],
});
const packer = new Packer();
packer.toBuffer(doc).then((buffer) => {
fs.writeFileSync("My Document.docx", buffer);
});