Skip to content

Commit 942c81a

Browse files
committed
Added pagecount property
1 parent b83be94 commit 942c81a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Synercoding.FileFormats.Pdf/LowLevel/PageTree.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Synercoding.FileFormats.Pdf.LowLevel.Extensions;
2-
using Synercoding.FileFormats.Pdf.LowLevel.Text;
32
using Synercoding.FileFormats.Pdf.LowLevel.XRef;
43
using System;
54
using System.Collections.Generic;
@@ -25,6 +24,9 @@ public PageTree(PdfReference id, TableBuilder tableBuilder)
2524
public void AddPage(PdfPage pdfObject)
2625
=> _pages.Add(pdfObject);
2726

27+
public int PageCount
28+
=> _pages.Count;
29+
2830
internal uint WriteToStream(PdfStream stream)
2931
{
3032
if (_isWritten)

src/Synercoding.FileFormats.Pdf/PdfWriter.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ public PdfWriter(Stream stream, bool ownsStream)
5454
/// </summary>
5555
public DocumentInformation DocumentInformation { get; }
5656

57+
/// <summary>
58+
/// Returns the number of pages already added to the writer
59+
/// </summary>
60+
public int PageCount
61+
=> _pageTree.PageCount;
62+
5763
/// <summary>
5864
/// Set meta information for this document
5965
/// </summary>

0 commit comments

Comments
 (0)