You are here

You are here

Splitting Documents

The DocumentSplit method enables the the creation of a new PDF document from specified pages in an existing PDF document.  The method takes the document Id of the original document, an array of page numbers to extract, and the name of the new PDF file that will be created from the specified pages.  The new document will be placed in the same folder as the original document and it's document Id is returned.

This method only works with PDF documents.  If a non-PDF document is specified as the original document Id, an exception with the message "Cannot operate on this document" will be returned.

Vertical Tabs

c#
string originalPDFDocumentId = "<Document Id retrieved by other method calls>";
int[] pagesFromOriginalDocument = new int[] {1, 5, 7, 11};
 
string newDocumentId = springCMService.DocumentSplit(token, originalPDFDocumentId, pagesFromOriginalDocument, "Split Document");
Console.WriteLine("Created new document with Id {0} from pages 1,5,7,11.",newDocumentId);
java
String originalPDFDocumentId = "<Document Id retrieved by other method calls>";
int[] pagesFromOriginalDocument = new int[] {1, 5, 7, 11};
 
String newDocumentId = springCMService.documentSplit(token, originalPDFDocumentId, pagesFromOriginalDocument, "Split Document");
System.out.format("Created new document with Id %s from pages 1,5,7,11.\n",newDocumentId);