Files
docx-js/src/file/document/body/section-properties/page-size/page-size.ts

19 lines
537 B
TypeScript
Raw Normal View History

2018-01-24 00:01:38 +00:00
import { XmlComponent } from "file/xml-components";
import { PageSizeAttributes } from "./page-size-attributes";
export class PageSize extends XmlComponent {
2018-01-25 01:47:47 +00:00
constructor(width: number, height: number, orientation: string) {
2018-01-24 00:01:38 +00:00
super("w:pgSz");
2018-01-25 01:47:47 +00:00
const flip = orientation === "landscape";
2018-01-24 00:01:38 +00:00
this.root.push(
new PageSizeAttributes({
2018-01-25 01:47:47 +00:00
width: flip ? height : width,
height: flip ? width : height,
orientation: orientation,
2018-01-24 00:01:38 +00:00
}),
);
}
}