GdPicture.NET.14.API
GdPicture14 Namespace / GdPicturePDF Class / ClonePages Method
A GdPicturePDF object. The source PDF document, which contains the page range you want to clone into the currently loaded PDF document.
The page range to be cloned, for example, "1;4;5" to clone pages 1, 4 and 5 or "1-5;10" to clone pages from 1 to 5 and page 10. Set this parameter to "*" to clone all pages from the specified document.
Example





In This Topic
ClonePages Method (GdPicturePDF)
In This Topic
Clones a range of pages located in the specified source PDF document into the currently loaded PDF document. The new pages are added at the end of the current document and the last page is automatically selected as the current page.

Just to inform you, that the toolkit offers the adaptive file caching mechanism to significantly reduce memory usage while cloning large documents. The feature is available in both 32-bit and 64-bit mode by default.

This method is a alternative to GdPicturePDF.ClonePage method in cases where multiple pages need to be cloned together.

Syntax
'Declaration
 
Public Function ClonePages( _
   ByVal FromPDF As GdPicturePDF, _
   ByVal PageRange As String _
) As GdPictureStatus
public GdPictureStatus ClonePages( 
   GdPicturePDF FromPDF,
   string PageRange
)
public function ClonePages( 
    FromPDF: GdPicturePDF;
    PageRange: String
): GdPictureStatus; 
public function ClonePages( 
   FromPDF : GdPicturePDF,
   PageRange : String
) : GdPictureStatus;
public: GdPictureStatus ClonePages( 
   GdPicturePDF* FromPDF,
   string* PageRange
) 
public:
GdPictureStatus ClonePages( 
   GdPicturePDF^ FromPDF,
   String^ PageRange
) 

Parameters

FromPDF
A GdPicturePDF object. The source PDF document, which contains the page range you want to clone into the currently loaded PDF document.
PageRange
The page range to be cloned, for example, "1;4;5" to clone pages 1, 4 and 5 or "1-5;10" to clone pages from 1 to 5 and page 10. Set this parameter to "*" to clone all pages from the specified document.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.

We strongly recommend always checking this status first.

Remarks
This method is only allowed for use with non-encrypted documents, both source and destination ones.

This method will keep internal document link references intact.

Example
How to clone range of pages to a new document.
Using sourcePDF As GdPicturePDF = New GdPicturePDF()
    sourcePDF.LoadFromFile("test.pdf")
    Using destPDF As GdPicturePDF = New GdPicturePDF()
        destPDF.NewPDF()
        destPDF.ClonePages(sourcePDF, "2-5;8")
        destPDF.SaveToFile("test_2-5,8.pdf")
    End Using
End Using
using (GdPicturePDF sourcePDF = new GdPicturePDF())
{
    sourcePDF.LoadFromFile("test.pdf");
    using (GdPicturePDF destPDF = new GdPicturePDF())
    {
        destPDF.NewPDF();
        destPDF.ClonePages(sourcePDF, "2-5;8");
        destPDF.SaveToFile("test_2-5,8.pdf");
    }
}
See Also