public void RunPages(Pages pgs) // this does all the work { foreach (Page p in pgs) { //Create a Page Dictionary representing a visible page page = new PdfPage(anchor); content = new PdfContent(anchor); PdfPageSize pSize = new PdfPageSize((int)r.ReportDefinition.PageWidth.ToPoints(), (int)r.ReportDefinition.PageHeight.ToPoints()); _pSize = pSize; page.CreatePage(pageTree.objectNum, pSize); pageTree.AddPage(page.objectNum); //Create object that presents the elements in the page elements = new PdfElements(page, pSize); ProcessPage(pgs, p); // after a page content.SetStream(elements.EndElements()); page.AddResource(fonts, content.objectNum); page.AddResource(patterns, content.objectNum); //get the pattern colorspace... PatternObj po = new PatternObj(anchor); page.AddResource(po, content.objectNum); int size = 0; tw.Write(page.GetPageDict(filesize, out size), 0, size); filesize += size; tw.Write(content.GetContentDict(filesize, out size), 0, size); filesize += size; tw.Write(po.GetPatternObj(filesize, out size), 0, size); filesize += size; } return; }
internal void AddResource(PatternObj po, int contentRef) { colorSpaceRef = string.Format("/CS1 {0} 0 R", po.objectNum); }