Rank: Newbie Groups: Member
Joined: 2/21/2016 Posts: 8
|
Hi Team,
I have 2 types of PDF one is static and another is dynamic. When I am cloning a page from the existing PDF and merging with the dynamic pdf. In this case how can I add page number based on merging.
Example:
//Create a new PdfDocument PdfDocument doc = new PdfDocument();
//Create a new AcmRender object
AcmRender render = new AcmRender(doc, new AcmPageLayout(PdfPageSizes.A4, new AcmPadding(0.2f), new AcmColumn(0.5f, 2), new AcmColumn(2.5f,4), new AcmColumn(4.5f, 6f), new AcmColumn(6.5f, 8))); //Handle the render's BeforeRenderPage event render.BeforeRenderPage += new AcmPageEventHandler(BeforeRenderPage);
AcmParagraph p1 = new AcmParagraph(new AcmText("List Detail Report"), new AcmParagraph(new AcmText( @"The land speed record for a crocodile is 17 km/h (11 mph) measured in a galloping Australian freshwater crocodile. Maximum speed varies from species to species. Certain types of crocodiles can indeed gallop, including Cuban crocodiles, New Guinea crocodiles, African dwarf crocodiles, and even small Nile crocodiles. The fastest means by which most species can move is a kind of ""belly run"", where the body moves in a snake-like fashion, limbs splayed out to either side paddling away frantically while the tail whips to and fro. Crocodiles can reach speeds of 10 or 11 km/h ( around 7 mph) when they ""belly run"", and often faster if they're slipping down muddy riverbanks. Another form of locomotion is the ""high walk"" where the body is raised clear off the ground."))); render.Render(p1);
PdfDocument doc1 = new PdfDocument("Sample.pdf"); PdfDocument doc2 = doc1.Clone(2, 1);
//Save the PDF file
//Merge them into a single PdfDocument PdfDocument mergedDoc = PdfDocument.Merge(doc, doc2);
Now in this case doc is a dynamic pdf and doc1 is static from here I take the 3 page and merging with the dynamic pdf. How would I add pagenumber after the merge.
Expected result doc should have page no.1 and doc2 should have page no.2.
Thanks
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi, You would just write a loop to loop through all the pages and then add page numbers however you want on each page. See here for some sample code: http://www.essentialobjects.com/doc/pdf/htmltopdf/header.aspx#afterThanks!
|