Document document = new Document(new Rectangle(
(float) bounds.getWidth(), (float) bounds.getHeight()));
PdfWriter writer = PdfWriter.getInstance(document, out);
document.open();
for (int i = 0; i < pageStore.getPageCount(); ++i) {
document.newPage();
PdfContentByte pcb = writer.getDirectContent();
Graphics2D g = pcb.createGraphics(
(float) pf.getWidth(), (float) pf.getHeight());
Page page = pageStore.getPage(i);
page.resolveForwards(context);