mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-10-15 19:54:52 +08:00
Moved some internal properties to fields
This commit is contained in:
@@ -16,26 +16,30 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class PdfDocument : IDisposable
|
public class PdfDocument : IDisposable
|
||||||
{
|
{
|
||||||
private bool isDisposed = false;
|
private bool isDisposed;
|
||||||
|
|
||||||
|
private readonly bool isLenientParsing;
|
||||||
|
|
||||||
[NotNull]
|
[NotNull]
|
||||||
private readonly HeaderVersion version;
|
private readonly HeaderVersion version;
|
||||||
|
|
||||||
[NotNull]
|
[NotNull]
|
||||||
private readonly CrossReferenceTable crossReferenceTable;
|
private readonly CrossReferenceTable crossReferenceTable;
|
||||||
|
|
||||||
private readonly ILog log;
|
private readonly ILog log;
|
||||||
|
|
||||||
private readonly IInputBytes inputBytes;
|
private readonly IInputBytes inputBytes;
|
||||||
private readonly bool isLenientParsing;
|
|
||||||
[NotNull]
|
[NotNull]
|
||||||
private readonly ParsingCachingProviders cachingProviders;
|
private readonly ParsingCachingProviders cachingProviders;
|
||||||
|
|
||||||
private readonly IPdfTokenScanner pdfScanner;
|
private readonly IPdfTokenScanner pdfScanner;
|
||||||
|
|
||||||
[NotNull]
|
[NotNull]
|
||||||
internal Catalog Catalog { get; }
|
private readonly Catalog catalog;
|
||||||
|
|
||||||
[NotNull]
|
[NotNull]
|
||||||
internal Pages Pages { get; }
|
private readonly Pages pages;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The metadata associated with this document.
|
/// The metadata associated with this document.
|
||||||
@@ -51,7 +55,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the number of pages in this document.
|
/// Get the number of pages in this document.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int NumberOfPages => Pages.Count;
|
public int NumberOfPages => pages.Count;
|
||||||
|
|
||||||
internal PdfDocument(ILog log,
|
internal PdfDocument(ILog log,
|
||||||
IInputBytes inputBytes,
|
IInputBytes inputBytes,
|
||||||
@@ -71,8 +75,8 @@
|
|||||||
this.cachingProviders = cachingProviders ?? throw new ArgumentNullException(nameof(cachingProviders));
|
this.cachingProviders = cachingProviders ?? throw new ArgumentNullException(nameof(cachingProviders));
|
||||||
this.pdfScanner = pdfScanner;
|
this.pdfScanner = pdfScanner;
|
||||||
Information = information ?? throw new ArgumentNullException(nameof(information));
|
Information = information ?? throw new ArgumentNullException(nameof(information));
|
||||||
Catalog = catalog ?? throw new ArgumentNullException(nameof(catalog));
|
catalog = catalog ?? throw new ArgumentNullException(nameof(catalog));
|
||||||
Pages = new Pages(log, Catalog, pageFactory, isLenientParsing, pdfScanner);
|
pages = new Pages(log, catalog, pageFactory, isLenientParsing, pdfScanner);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -82,6 +86,7 @@
|
|||||||
/// <param name="options">Optional parameters controlling parsing.</param>
|
/// <param name="options">Optional parameters controlling parsing.</param>
|
||||||
/// <returns>A <see cref="PdfDocument"/> providing access to the file contents.</returns>
|
/// <returns>A <see cref="PdfDocument"/> providing access to the file contents.</returns>
|
||||||
public static PdfDocument Open(byte[] fileBytes, ParsingOptions options = null) => PdfDocumentFactory.Open(fileBytes, options);
|
public static PdfDocument Open(byte[] fileBytes, ParsingOptions options = null) => PdfDocumentFactory.Open(fileBytes, options);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Opens a file and creates a <see cref="PdfDocument"/> for reading from the provided file path.
|
/// Opens a file and creates a <see cref="PdfDocument"/> for reading from the provided file path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -89,6 +94,7 @@
|
|||||||
/// <param name="options">Optional parameters controlling parsing.</param>
|
/// <param name="options">Optional parameters controlling parsing.</param>
|
||||||
/// <returns>A <see cref="PdfDocument"/> providing access to the file contents.</returns>
|
/// <returns>A <see cref="PdfDocument"/> providing access to the file contents.</returns>
|
||||||
public static PdfDocument Open(string filePath, ParsingOptions options = null) => PdfDocumentFactory.Open(filePath, options);
|
public static PdfDocument Open(string filePath, ParsingOptions options = null) => PdfDocumentFactory.Open(filePath, options);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a <see cref="PdfDocument"/> for reading from the provided stream.
|
/// Creates a <see cref="PdfDocument"/> for reading from the provided stream.
|
||||||
/// The caller must manage disposing the stream. The created PdfDocument will not dispose the stream.
|
/// The caller must manage disposing the stream. The created PdfDocument will not dispose the stream.
|
||||||
@@ -115,7 +121,7 @@
|
|||||||
|
|
||||||
log.Debug($"Accessing page {pageNumber}.");
|
log.Debug($"Accessing page {pageNumber}.");
|
||||||
|
|
||||||
return Pages.GetPage(pageNumber);
|
return pages.GetPage(pageNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
Reference in New Issue
Block a user