Class TocGenerator
Thông tin
Biểu diễn plugin Documentize.TocGenerator. Được sử dụng để thêm Mục Lục vào các tài liệu PDF.
[Obsolete("The class will be deleted soon. Please use PdfManager class.")]
public static class TocGeneratorKế thừa
Thành viên được kế thừa
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object?)
- object.Equals(object?, object?)
- object.ReferenceEquals(object?, object?)
- object.GetHashCode()
Ví dụ
Ví dụ minh họa cách thêm Mục Lục vào tệp PDF.
// 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 FileData("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
// Perform the process
TocGenerator.Process(options);Ví dụ minh họa cách thêm Mục Lục vào tệp PDF kèm theo việc tạo dấu trang.
// 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 FileData("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileData("path_to_result_pdf_file.pdf"));
// Perform the process
TocGenerator.Process(options);Ví dụ minh họa cách thêm Mục Lục vào tệp PDF và lưu dưới dạng luồng.
// 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 FileData("path_to_your_pdf_file.pdf"));
// Set output stream
var outputStream = new MemoryStream();
options.AddOutput(new StreamData(outputStream));
options.CloseOutputStreams = false;
// Perform the process
TocGenerator.Process(options);Phương thức
Process(TocOptions)
Bắt đầu quá trình Documentize.TocGenerator với các tham số được chỉ định.
public static ResultContainer Process(TocOptions options)Tham số
optionsTocOptions: Một đối tượng tùy chọn chứa các hướng dẫn cho thao tác.
Trả về
ResultContainer : Một đối tượng Documentize.ResultContainer chứa kết quả của thao tác.
Không gian tên: Documentize
Tập hợp: Documentize.dll