Class PdfManager
Represents Documentize.PdfManager plugin. Used to Merge, Split, Optimize, Rotate, Resize, Compress PDF documents and Add Table, Add TOC to PDF documents. Can Merge multiple PDF documents into a single PDF. Can Split PDF documents into separate pages. Can Optimize, Rotate, Resize, Compress PDF documents. Can Rotate, Resize Pages of PDF document. Can Add a Table to a PDF document. Can Add a Table of Contents to PDF documents.
Represents Documentize.PdfManager plugin. Used to Merge, Split, Optimize, Rotate, Resize, Compress PDF documents and Add Table, Add TOC to PDF documents. Can Merge multiple PDF documents into a single PDF. Can Split PDF documents into separate pages. Can Optimize, Rotate, Resize, Compress PDF documents. Can Rotate, Resize Pages of PDF document. Can Add a Table to a PDF document. Can Add a Table of Contents to PDF documents.
public static class PdfManager
Inheritance
Inherited Members
- object.GetType(),
- object.MemberwiseClone(),
- object.ToString(),
- object.Equals(object?),
- object.Equals(object?, object?),
- object.ReferenceEquals(object?, object?),
- object.GetHashCode()
Examples
The example demonstrates how to Merge two PDF documents.
// Create MergeOptions object to set instructions
var options = new MergeOptions();
// Add input file paths
options.AddInput(new FileDataSource("path_to_your_pdf_file_1.pdf"));
options.AddInput(new FileDataSource("path_to_your_pdf_file_2.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// Perform the process
PdfManager.Merge(options);
The example demonstrates how to Split PDF document.
// Create SplitOptions object to set instructions
var options = new SplitOptions();
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file paths
options.AddOutput(new FileDataSource("path_to_result_pdf_file_1.pdf"));
options.AddOutput(new FileDataSource("path_to_result_pdf_file_2.pdf"));
// Perform the process
PdfManager.Split(options);
The example demonstrates how to Optimize PDF document.
// Create OptimizeOptions object to set instructions
var options = new OptimizeOptions();
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// Perform the process
PdfManager.Optimize(options);
The example demonstrates how to Rotate PDF document.
// Create RotateOptions object to set instructions
var options = new RotateOptions();
// Set new Rotation
options.Rotation = Rotation.On90;
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// Perform the process
PdfManager.Rotate(options);
The example demonstrates how to Resize PDF document.
// Create ResizeOptions object to set instructions
var options = new ResizeOptions();
// Set new PageSize
options.PageSize = PageSize.A3;
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// Perform the process
PdfManager.Resize(options);
The example demonstrates how to Compress PDF document.
// Create CompressOptions object to set instructions
var options = new CompressOptions();
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// Perform the process
PdfManager.Compress(options);
The example demonstrates how to Add Table to PDF file.
// Configure table options
var options = new TableOptions().InsertPageBefore(1)
.AddTable()
.AddRow()
.AddCell().AddParagraph("Name")
.AddCell().AddParagraph("Age")
.AddRow()
.AddCell().AddParagraph("Bob")
.AddCell().AddParagraph("12")
.AddRow()
.AddCell().AddParagraph("Sam")
.AddCell().AddParagraph("20")
.AddRow()
.AddCell().AddParagraph("Sandy")
.AddCell().AddParagraph("26")
.AddRow()
.AddCell().AddParagraph("Tom")
.AddCell().AddParagraph("12")
.AddRow()
.AddCell().AddParagraph("Jim")
.AddCell().AddParagraph("27");
// Add input file path
options.AddInput(new FileDataSource("path_to_input.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_output.pdf"));
// Perform the process
PdfManager.AddTable(options);
The example demonstrates how to add Table of Contents to PDF file.
// Create TocOptions object to set instructions
var options = new TocOptions();
// Set the Title
options.Title = "My Table of Contents";
// Design Headings
options.Headings.Add(new TocHeading("Introduction", 2));
options.Headings.Add(new TocHeading("Chapter I", 3));
options.Headings.Add(new TocHeading("Chapter II", 4));
options.Headings.Add(new TocHeading("Chapter III", 5));
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// Perform the process
PdfManager.AddTableOfContents(options);
The example demonstrates how to add Table of Contents to PDF file with generating bookmarks.
// Create TocOptions object to set instructions
var options = new TocOptions();
// Set the Title
options.Title = "My Table of Contents";
// Generate links in bookmarks
options.GenerateBookmarks = true;
// Design Headings
options.Headings.Add(new TocHeading("Introduction", 2, false, 1));
options.Headings.Add(new TocHeading("Chapter I", 3, true, 1));
options.Headings.Add(new TocHeading("Chapter II", 4, true, 1));
options.Headings.Add(new TocHeading("Example A", 4, true, 2));
options.Headings.Add(new TocHeading("Example B", 4, true, 2));
options.Headings.Add(new TocHeading("Example C", 4, true, 2));
options.Headings.Add(new TocHeading("Example D", 4, true, 2));
options.Headings.Add(new TocHeading("Chapter III", 5, true, 1));
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// Perform the process
PdfManager.AddTableOfContents(options);
The example demonstrates how to add Table of Contents to PDF file and save as stream.
// Create TocOptions object to set instructions
var options = new TocOptions();
// Set the Title
options.Title = "My Table of Contents";
// Design Headings
options.Headings.Add(new TocHeading("Introduction", 2, false, 1));
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output stream
var outputStream = new MemoryStream();
options.AddOutput(new StreamDataSource(outputStream));
options.CloseOutputStreams = false;
// Perform the process
PdfManager.AddTableOfContents(options);
Methods
AddTable(TableOptions)
Add Table to PDF document.
public static ResultContainer AddTable(TableOptions options)
Parameters
options
TableOptions: An options object containing instructions for the operation.
Returns
ResultContainer : An object containing the result of the operation.
Exceptions
If options not set.
AddTableOfContents(TocOptions)
Add Table of Contents (TOC) to PDF document.
public static ResultContainer AddTableOfContents(TocOptions options)
Parameters
options
TocOptions: An options object containing instructions for the operation.
Returns
ResultContainer : An object containing the result of the operation.
Exceptions
If options not set.
Compress(CompressOptions)
Compress PDF document. Try to reduce size of the document.
public static ResultContainer Compress(CompressOptions options)
Parameters
options
CompressOptions: An options object containing instructions for the operation.
Returns
ResultContainer : An object containing the result of the operation.
Exceptions
If options not set.
Merge(MergeOptions)
Merge PDF documents.
public static ResultContainer Merge(MergeOptions options)
Parameters
options
MergeOptions: An options object containing instructions for the operation.
Returns
ResultContainer : An object containing the result of the operation.
Exceptions
If options not set.
Optimize(OptimizeOptions)
Optimize PDF document. Linearize the document in order to
- open the first page as quickly as possible;
- display next page or follow by link to the next page as quickly as possible;
- display the page incrementally as it arrives when data for a page is delivered over a slow channel (display the most useful data first);
- permit user interaction, such as following a link, to be performed even before the entire page has been received and displayed.
public static ResultContainer Optimize(OptimizeOptions options)
Parameters
options
OptimizeOptions: An options object containing instructions for the operation.
Returns
ResultContainer : An object containing the result of the operation.
Exceptions
If options not set.
Resize(ResizeOptions)
Resize Pages of PDF document.
public static ResultContainer Resize(ResizeOptions options)
Parameters
options
ResizeOptions: An options object containing instructions for the operation.
Returns
ResultContainer : An object containing the result of the operation.
Exceptions
If options not set.
Rotate(RotateOptions)
Rotate Pages of PDF document.
public static ResultContainer Rotate(RotateOptions options)
Parameters
options
RotateOptions: An options object containing instructions for the operation.
Returns
ResultContainer : An object containing the result of the operation.
Exceptions
If options not set.
Split(SplitOptions)
Split PDF document by pages.
public static ResultContainer Split(SplitOptions options)
Parameters
options
SplitOptions: An options object containing instructions for the operation.
Returns
ResultContainer : An object containing the result of the operation.
Exceptions
If options not set.
Namespace: Documentize Assembly: Documentize.dll