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

19 lines
577 B
TypeScript
Raw Normal View History

2018-01-24 00:01:38 +00:00
import { XmlComponent } from "file/xml-components";
2018-06-22 23:04:03 +01:00
import { PageOrientation, PageSizeAttributes } from "./page-size-attributes";
2018-01-24 00:01:38 +00:00
export class PageSize extends XmlComponent {
constructor(width: number, height: number, orientation: PageOrientation) {
2018-01-24 00:01:38 +00:00
super("w:pgSz");
const flip = orientation === PageOrientation.LANDSCAPE;
2018-01-25 01:47:47 +00:00
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
}),
);
}
}