Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GroupDocsGists/e16475c2d74c0d5f2aa3a3ea85b6833a to your computer and use it in GitHub Desktop.
Save GroupDocsGists/e16475c2d74c0d5f2aa3a3ea85b6833a to your computer and use it in GitHub Desktop.
// For complete examples and data files, please go to https://github.com/groupdocs-merger/GroupDocs.Merger-for-.NET
string sourceFile = CommonUtilities.sourcePath + fileName;
// Preparation.
string password = "SomePasswordString";
int pageNumber1 = 3;
int pageNumber2 = 6;
List<int> pages = new List<int>();
pages.Add(pageNumber1);
pages.Add(pageNumber2);
TrimOptions trimOptions = new TrimOptions(FileFormat.Vsdx, password, pages);
Stream openFile = new FileStream(sourceFile, FileMode.Open);
// Main method.
DocumentResult result = new DocumentHandler().Trim(openFile, trimOptions);
Stream documentStream = result.Stream;
var fileStream = File.Create(CommonUtilities.outputPath + "OutPut." + FileFormat.Vsdx);
documentStream.CopyTo(fileStream);
documentStream.Close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment