Class TocGenerator

Информация

Представляет плагин Documentize.TocGenerator. Используется для добавления оглавления в PDF‑документы.

[Obsolete("The class will be deleted soon. Please use PdfManager class.")]
public static class TocGenerator

Наследование

object
TocGenerator

Унаследованные члены

Примеры

Пример демонстрирует, как добавить оглавление в 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);

Пример демонстрирует, как добавить оглавление в PDF‑файл с генерацией закладок.

// 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);

Пример демонстрирует, как добавить оглавление в 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, 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);

Методы

Process(TocOptions)

Запускает обработку Documentize.TocGenerator с указанными параметрами.

public static ResultContainer Process(TocOptions options)

Параметры

  • options TocOptions: Объект параметров, содержащий инструкции для выполнения операции.

Возвращаемое значение

ResultContainer : Объект Documentize.ResultContainer, содержащий результат операции.

Пространство имён: Documentize
Сборка: Documentize.dll

 Русский