function applyMargins(callback) {
		var margin = node._margin;

		if (node.pageBreak === 'before') {
			self.writer.moveToNextPage(node.pageOrientation);
		} else if (node.pageBreak === 'beforeOdd') {
			self.writer.moveToNextPage(node.pageOrientation);
			if ((self.writer.context().page + 1) % 2 === 1) {
				self.writer.moveToNextPage(node.pageOrientation);
			}
		} else if (node.pageBreak === 'beforeEven') {
			self.writer.moveToNextPage(node.pageOrientation);
			if ((self.writer.context().page + 1) % 2 === 0) {
				self.writer.moveToNextPage(node.pageOrientation);
			}
		}

		if (margin) {
			self.writer.context().moveDown(margin[1]);
			self.writer.context().addMargin(margin[0], margin[2]);
		}

		callback();

		if (margin) {
			self.writer.context().addMargin(-margin[0], -margin[2]);
			self.writer.context().moveDown(margin[3]);
		}

		if (node.pageBreak === 'after') {
			self.writer.moveToNextPage(node.pageOrientation);
		} else if (node.pageBreak === 'afterOdd') {
			self.writer.moveToNextPage(node.pageOrientation);
			if ((self.writer.context().page + 1) % 2 === 1) {
				self.writer.moveToNextPage(node.pageOrientation);
			}
		} else if (node.pageBreak === 'afterEven') {
			self.writer.moveToNextPage(node.pageOrientation);
			if ((self.writer.context().page + 1) % 2 === 0) {
				self.writer.moveToNextPage(node.pageOrientation);
			}
		}
	}
Creates an instance of PageElementWriter - an extended ElementWriter
which can handle:
- page-breaks (it adds new pages when there's not enough space left),
- repeatable fragments (like table-headers, which are repeated everytime
                        a page-break occurs)
- transactions (used for unbreakable-blocks when we want to make sure
                whole block will be rendered on the same page)