ImportedPageContents size issue

ImportedPageContents size issue

Forum member · Aug 11, 2008
I have, what seems like, a rather large final PDF document when that final PDF document has content laid on it from another PDF document. Document1 = 143 KB Document2 = 190 KB When I clip out a rather small portion, 1 inch by 3 inch, of Document2 and "place" it on Document1, the final "merged" PDF is 253 KB, which is the size of Document1 plus say 58% of the size of Document2. Is there additional metadata or something that would make this happen and could I get rid of this? Here is the psuedo-code: string dirWork = "C:\\Test\\ClipPattern"; Document MyDocument = new Document(); //Document1 = 143 KB PdfDocument pdf = new PdfDocument(dirWork + "\\" + "Document1.pdf"); //Document2 = 190KB PdfDocument pdf2 = new PdfDocument(dirWork + "\\" + "Document2.pdf"); //Set contents we want out of Document2 and clip it ImportedPageContents contents = new ceTe.DynamicPDF.Merger.ImportedPageContents(pdf2.Pages[0]); float x1 = 22.0F; float x2 = 263.0F; float y1 = 180.0F; float y2 = 242.0F; contents.ClipLeft = x1; contents.ClipRight = pd.Width - x2; contents.ClipTop = y1; contents.ClipBottom = pd.Height - y2; //create a blank page to put everything on with the right dimensions PageDimensions pd; ceTe.DynamicPDF.Page page; pd = pdf.Pages[0].GetDimensions(); page = new ceTe.DynamicPDF.Page(pd); //I have tried ImportedPageArea() in both references to ImportedPageData() below and still came out with the same size //Take the Document1 one and only page and add it to the blank page page.Elements.Add(new ImportedPageData(pdf.Pages[0],0,0,1f)); //Take contents from Document2 and add it to the blank page page.Elements.Add( new ImportedPageData(contents,0,0,1f)); //Add the page to a final pdf, the final PDF = 253 KB MyDocument.Pages.Add(page); MyDocument.Draw(dirWork + "\\" + "Clipped.pdf");

Re: ImportedPageContents size issue

Support · Aug 11, 2008
Hello, The output behavior you are seeing is correct. It will take most of the page contents of the page that you are clipping when adding the contents onto the page of another PDF document. Thanks, ceTe Software Support Team