Skip to content

Commit 4042649

Browse files
committed
update the readme for 0.0.10 release
1 parent 6ee7c09 commit 4042649

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

README.md

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@ The simplest usage at this stage is to open a document, reading the words from e
1717

1818
using (PdfDocument document = PdfDocument.Open(@"C:\Documents\document.pdf"))
1919
{
20-
for (var i = 0; i < document.NumberOfPages; i++)
20+
foreach (Page page in document.GetPages())
2121
{
22-
// This starts at 1 rather than 0.
23-
var page = document.GetPage(i + 1);
22+
string pageText = page.Text;
2423

25-
foreach (var word in page.GetWords())
24+
foreach (Word word in page.GetWords())
2625
{
2726
Console.WriteLine(word.Text);
2827
}
@@ -69,6 +68,7 @@ The ```PdfDocument``` class provides access to the contents of a document loaded
6968
{
7069
int pageCount = document.NumberOfPages;
7170

71+
// Page number starts from 1, not 0.
7272
Page page = document.GetPage(1);
7373

7474
decimal widthInPoints = page.Width;
@@ -79,7 +79,9 @@ The ```PdfDocument``` class provides access to the contents of a document loaded
7979

8080
```PdfDocument``` should only be used in a ```using``` statement since it implements ```IDisposable``` (unless the consumer disposes of it elsewhere).
8181

82-
Documents which are encrypted using the RC4 algorithm can be opened with PdfPig (AES is unsupported at the moment). To provide an owner or user password provide the optional `ParsingOptions` when calling `Open` with the `Password` property defined.
82+
Encrypted documents can be opened by PdfPig. To provide an owner or user password provide the optional `ParsingOptions` when calling `Open` with the `Password` property defined. For example:
83+
84+
using (PdfDocument document = PdfDocument.Open(@"C:\my-file.pdf", new ParsingOptions { Password = "password here" }))
8385

8486
Since this is alpha software the consumer should wrap all access in a ```try catch``` block since it is extremely likely to throw exceptions. As a fallback you can try running PDFBox using [IKVM](https://www.ikvm.net/) or using [PDFsharp](http://www.pdfsharp.net) or by a native library wrapper using [docnet](https://github.com/GowenGit/docnet).
8587

@@ -213,14 +215,32 @@ These letters contain:
213215

214216
Letter position is measured in PDF coordinates where the origin is the lower left corner of the page. Therefore a higher Y value means closer to the top of the page.
215217

216-
### Annotations ###
218+
### Annotations (0.0.5) ###
217219

218-
New in v0.0.5 - Early support for retrieving annotations on each page is provided using the method:
220+
Early support for retrieving annotations on each page is provided using the method:
219221

220222
page.ExperimentalAccess.GetAnnotations()
221223

222224
This call is not cached and the document must not have been disposed prior to use. The annotations API may change in future.
223225

226+
### Bookmarks (0.0.10) ###
227+
228+
The bookmarks (outlines) of a document may be retrieved at the document level:
229+
230+
bool hasBookmarks = document.TryGetBookmarks(out Bookmarks bookmarks);
231+
232+
This will return `false` if the document does not define any bookmarks.
233+
234+
### Forms (0.0.10) ###
235+
236+
Form fields for interactive forms (AcroForms) can be retrieved using:
237+
238+
bool hasForm = document.TryGetForm(out AcroForm form);
239+
240+
This will return `false` if the document does not contain a form.
241+
242+
The fields can be accessed using the `AcroForm`'s `Fields` property. Since the form is defined at the document level this will return fields from all pages in the document. Fields are of the types defined by the enum `AcroFieldType`, for example `PushButton`, `Checkbox`, `Text`, etc.
243+
224244
## Issues ##
225245

226246
At this stage the software is in Alpha. In order to proceed to Beta and production we need to see a wide variety of document types.

0 commit comments

Comments
 (0)