Splitter.ExtractPages

Splitter ExtractPages method. Removes empty pages from the document and saves the output.

ExtractPages(string, string, int, int)

Removes empty pages from the document and saves the output.

public static void ExtractPages(string inputFileName, string outputFileName, int startPageIndex, 
    int pageCount)
ParameterTypeDescription
inputFileNameStringThe input file name.
outputFileNameStringThe output file name.
startPageIndexInt32The zero-based index of the first page to extract.
pageCountInt32Number of pages to be extracted.

Remarks

Note that Microsoft Word documents are flow-based by nature and do not have a fixed “page” concept. Consumer applications reflow the content into pages dynamically.

This method builds the document layout to extract pages content. The result of execution depends on the fonts available in the environment, as they are required to correctly build the document layout.

Examples

Shows how to extract the first page from the document.

Splitter.ExtractPages(MyDir + "Simple.docx", ArtifactsDir + "Splitter.ExtractPages.docx", 0, 1);

See Also


ExtractPages(string, string, SaveFormat, int, int)

Removes empty pages from the document and saves the output in the specified format.

public static void ExtractPages(string inputFileName, string outputFileName, SaveFormat saveFormat, 
    int startPageIndex, int pageCount)
ParameterTypeDescription
inputFileNameStringThe input file name.
outputFileNameStringThe output file name.
saveFormatSaveFormatThe save format.
startPageIndexInt32The zero-based index of the first page to extract.
pageCountInt32Number of pages to be extracted.

Remarks

Note that Microsoft Word documents are flow-based by nature and do not have a fixed “page” concept. Consumer applications reflow the content into pages dynamically.

This method builds the document layout to extract pages content. The result of execution depends on the fonts available in the environment, as they are required to correctly build the document layout.

Examples

Shows how to extract the first page from the document and save the result in explicitly specified MS Word Xml 2007 format.

Splitter.ExtractPages(MyDir + "Simple.docx", ArtifactsDir + "Splitter.ExtractPages.xml", SaveFormat.FlatOpc, 0, 1);

See Also


ExtractPages(Stream, Stream, SaveFormat, int, int)

Removes empty pages from the document and saves the output in the specified format.

public static void ExtractPages(Stream inputStream, Stream outputStream, SaveFormat saveFormat, 
    int startPageIndex, int pageCount)
ParameterTypeDescription
inputStreamStreamThe input stream.
outputStreamStreamThe output stream.
saveFormatSaveFormatThe save format.
startPageIndexInt32The zero-based index of the first page to extract.
pageCountInt32Number of pages to be extracted.

Remarks

Note that Microsoft Word documents are flow-based by nature and do not have a fixed “page” concept. Consumer applications reflow the content into pages dynamically.

This method builds the document layout to extract pages content. The result of execution depends on the fonts available in the environment, as they are required to correctly build the document layout.

Examples

Shows how to extract the first page from the document using streams.

using (Stream input = File.OpenRead(MyDir + "Simple.docx"))
using (Stream output = File.Create(ArtifactsDir + "Splitter.ExtractPages.rtf"))
{
    Splitter.ExtractPages(input, output, SaveFormat.Rtf, 0, 1);
}

See Also