//
// This code is part of GrapeCity Documents for PDF samples.
// Copyright (c) GrapeCity, Inc. All rights reserved.
//
using System;
using System.IO;
using System.Drawing;
using GrapeCity.Documents.Pdf;
using GrapeCity.Documents.Text;
namespace GcPdfWeb.Samples
{
// This example shows how to duplicate a page of a PDF using the PageCollection.ClonePage() method.
public class ClonePage
{
public void CreatePDF(Stream stream)
{
var doc = new GcPdfDocument();
using var fs = File.OpenRead(Path.Combine("Resources", "PDFs", "Wetlands.pdf"));
doc.Load(fs);
// Clone the first page of the PDF, insert it into the beginning of the document:
doc.Pages.ClonePage(0, 0, true, true);
// Save the PDF:
doc.Save(stream);
}
}
}