faturas_4docs/Faturas/CustomPdfSplitter.cs
Adriano Serighelli 874eabe87a Refatora e atualiza projetos para .NET 9.0
Criado nova biblioteca de classes para os demais projetos referênciarem a classe "Fatura.cs"

Atualização de bibliotecas.
2025-12-01 15:22:22 -03:00

30 lines
1.2 KiB
C#

// <copyright file="CustomPdfSplitter.cs" company="Smart Energia">
// Copyright (c) Smart Energia. All rights reserved.
// </copyright>
namespace Faturas
{
using iText.Kernel.Pdf;
using iText.Kernel.Utils;
/// <summary>
/// Custom PDF splitter that allows specifying a function to create the next PDF writer.
/// </summary>
/// <remarks>
/// Initializes a new instance of the <see cref="CustomPdfSplitter"/> class.
/// </remarks>
/// <param name="pdfDocument">The PDF document to split.</param>
/// <param name="nextWriter">A function that returns the next PdfWriter given a PageRange.</param>
public class CustomPdfSplitter(PdfDocument pdfDocument, Func<PageRange, PdfWriter> nextWriter) : PdfSplitter(pdfDocument)
{
/// <summary>
/// Gets the next PDF writer for the specified page range.
/// </summary>
/// <param name="documentPageRange">The page range for which to get the next PDF writer.</param>
/// <returns>The next PDF writer.</returns>
protected override PdfWriter GetNextPdfWriter(PageRange documentPageRange)
{
return nextWriter.Invoke(documentPageRange);
}
}
}