Releases resources associated with this document.
Releases resources associated with this document.
You must call this method when you're done with the object.
The number of pages in the document.
The number of pages in the document.
This method will not block or throw an exception.
Iterates over the pages of the document.
Iterates over the pages of the document.
Each returned element has yet to be parsed; that's why iterator.next
returns a Future. Here's an example usage:
val it = pdfDocument.pages def step(result: Seq[String])(implicit ec: ExecutionContext): Future[Seq[String]] = { if (it.hasNext) { it.next // May be a Future.failed[PdfInvalidException] .flatMap { page => step(result :+ page.toText) // May throw PdfInvalidException } } else { Future.successful(result) } } val pageTexts: Seq[String] = step(Seq()) .recover { case ex: PdfInvalidException => ... }
Writes the document to a file.
Writes the document to a file.
The intended usage is:
1. Load a PdfDocument. 2. Mutate its pages. 3. Write it to a new location (this method).
A PDF document.
This class is intended to be created via
PdfDocument.load(...), and its asynchronous methods use the ExecutionContext passed toPdfDocument.load(...).You must call PdfDocument.close when finished.