RemoveBlankPages

RemoveBlankPages(string, string)

Removes empty pages from the document and saves the output. Returns a list of page numbers that were removed.

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.

Examples

Shows how to remove empty pages from the document.

// There is a several ways to remove empty pages from the document:
string doc = MyDir + "Blank pages.docx";

Splitter.RemoveBlankPages(doc, ArtifactsDir + "LowCode.RemoveBlankPages.1.docx");
Splitter.RemoveBlankPages(doc, ArtifactsDir + "LowCode.RemoveBlankPages.2.docx", SaveFormat.Docx);

See Also


RemoveBlankPages(string, string, SaveFormat)

Removes empty pages from the document and saves the output in the specified format. Returns a list of page numbers that were removed.

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.

Examples

Shows how to remove empty pages from the document.

// There is a several ways to remove empty pages from the document:
string doc = MyDir + "Blank pages.docx";

Splitter.RemoveBlankPages(doc, ArtifactsDir + "LowCode.RemoveBlankPages.1.docx");
Splitter.RemoveBlankPages(doc, ArtifactsDir + "LowCode.RemoveBlankPages.2.docx", SaveFormat.Docx);

See Also


RemoveBlankPages(Stream, Stream, SaveFormat)

Removes blank pages from a document provided in an input stream and saves the updated document to an output stream in the specified save format. Returns a list of page numbers that were removed.

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.

Examples

Shows how to remove empty pages from the document from the stream.

using (FileStream streamIn = new FileStream(MyDir + "Blank pages.docx", FileMode.Open, FileAccess.Read))
{
    using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.RemoveBlankPagesStream.docx", FileMode.Create, FileAccess.ReadWrite))
        Splitter.RemoveBlankPages(streamIn, streamOut, SaveFormat.Docx);
}

See Also