I want to duplicate the content of the pdf page.

Hi.
I want to duplicate the content of the pdf page.
Using this code below will increase the file size.

// ------------------------------------------------ -----------------
PdfLoadedDocument loadedDocument = new PdfLoadedDocument (pdf_path);
PdfLoadedPage loadedPage = loadedDocument.Pages [0] as PdfLoadedPage;
PdfTemplate template = loadedPage.CreateTemplate ();

PdfDocument document = new PdfDocument ();
document.PageSettings.Width = 100f * 72f / 25.4f;
document.PageSettings.Height = 100f * 72f / 25.4f;

PdfPage page = document.Pages.Add ();
PdfGraphics graphics = page.Graphics;
graphics.DrawPdfTemplate (template, new PointF (0, 0));

document.Save (pdf_path.Replace (".", "2."));
loadedDocument.Close (true);
document.Close (true);
// ------------------------------------------------ -----------------

I want to copy multiple pages that share resources in a pdf file.
Is there another way to duplicate the page without increasing the file size?

Thank you.

1 Reply

SL Sowmiya Loganathan Syncfusion Team May 15, 2020 07:47 AM UTC

Hi sweetbook,    
  
Thank you for contacting Syncfusion support.    
  
The input document’s multiple pages share the same resources like as font, images, templates, and more. If we split the document the shared resources should be copied to every document. So this is the behavior and we could not able to proceed further. However could you please share the input PDF document, so that we will analyze further and update the details.    
   
Regards, 
Sowmiya Loganathan 


Loader.
Up arrow icon