mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-06-28 15:30:17 +08:00
add method to get all pages from document
This commit is contained in:
parent
3fbfc1130e
commit
0cd7795bff
@ -1,5 +1,6 @@
|
||||
namespace UglyToad.PdfPig.Tests.Integration
|
||||
{
|
||||
using System.Linq;
|
||||
using Xunit;
|
||||
|
||||
public class FarmerMacTests
|
||||
@ -18,6 +19,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetPagesWorks()
|
||||
{
|
||||
using (var document = PdfDocument.Open(GetFilename()))
|
||||
{
|
||||
var pageCount = document.GetPages().Count();
|
||||
|
||||
Assert.Equal(5, pageCount);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void HasCorrectContentAfterReadingPreviousPage()
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
namespace UglyToad.PdfPig
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using AcroForms;
|
||||
using Content;
|
||||
@ -159,6 +160,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all pages in this document in order.
|
||||
/// </summary>
|
||||
public IEnumerable<Page> GetPages()
|
||||
{
|
||||
for (var i = 0; i < NumberOfPages; i++)
|
||||
{
|
||||
yield return GetPage(i + 1);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the document level metadata if present.
|
||||
/// The metadata is XML in the (Extensible Metadata Platform) XMP format.
|
||||
|
Loading…
Reference in New Issue
Block a user