Splitter.RemoveBlankPages

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

RemoveBlankPages(string, string)

Removes empty pages from the document and saves the output.

public static List<int> RemoveBlankPages(string inputFileName, string outputFileName)
ParameterTypeDescription
inputFileNameStringThe input file name.
outputFileNameStringThe output file name.

Return Value

List of page numbers has been considered as blank and removed.

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 and removes breaks that may produce empty pages during reflow. 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 remove blank pages from the document.

List<int> clearedPages = Splitter.RemoveBlankPages(MyDir + "ManyPages.docx", ArtifactsDir + "Splitter.RemoveBlankPages.docx");

See Also


RemoveBlankPages(string, string, SaveFormat)

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

public static List<int> RemoveBlankPages(string inputFileName, string outputFileName, 
    SaveFormat saveFormat)
ParameterTypeDescription
inputFileNameStringThe input file name.
outputFileNameStringThe output file name.
saveFormatSaveFormatThe save format.

Return Value

List of page numbers has been considered as blank and removed.

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 and removes breaks that may produce empty pages during reflow. 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 remove blank pages from the document and save the result in explicitly specified MS Word Xml 2003 format.

List<int> clearedPages = Splitter.RemoveBlankPages(MyDir + "ManyPages.docx", ArtifactsDir + "Splitter.RemoveBlankPages.xml", SaveFormat.WordML);

See Also


RemoveBlankPages(Stream, Stream, SaveFormat)

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

public static List<int> RemoveBlankPages(Stream inputStream, Stream outputStream, 
    SaveFormat saveFormat)
ParameterTypeDescription
inputStreamStreamThe input stream.
outputStreamStreamThe output stream.
saveFormatSaveFormatThe save format.

Return Value

List of page numbers has been considered as blank and removed.

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 and removes breaks that may produce empty pages during reflow. 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 remove blank pages from the document using streams.

using (Stream input = File.OpenRead(MyDir + "ManyPages.docx"))
using (Stream output = File.Create(ArtifactsDir + "Splitter.RemoveBlankPages.odt"))
{
    List<int> clearedPages = Splitter.RemoveBlankPages(input, output, SaveFormat.Odt);
}

See Also