Documentation updated.

pull/1/head
Yusuke Shinyama 2014-03-24 21:03:10 +09:00
parent 4b2beba398
commit 62eab0048b
2 changed files with 10 additions and 7 deletions

View File

@ -9,7 +9,7 @@
<div align=right class=lastmod>
<!-- hhmts start -->
Last Modified: Mon Mar 24 10:19:52 UTC 2014
Last Modified: Mon Mar 24 12:02:47 UTC 2014
<!-- hhmts end -->
</div>
@ -374,6 +374,12 @@ no stream header is displayed for the ease of saving it to a file.
<h2><a name="changes">Changes</a></h2>
<ul>
<li> 2014/03/24: Bugfixes and improvements for fauly PDFs.<br>
API changes:
<ul>
<li> <code>PDFDocument.initialize()</code> method is removed and no longer needed.
A password is given as an argument of a PDFDocument constructor.
</ul>
<li> 2013/11/13: Bugfixes and minor improvements.<br>
As of November 2013, there were a few changes made to the PDFMiner API
prior to October 2013. This is the result of code restructuring. Here

View File

@ -9,7 +9,7 @@
<div align=right class=lastmod>
<!-- hhmts start -->
Last Modified: Wed Nov 13 05:50:56 UTC 2013
Last Modified: Mon Mar 24 11:49:28 UTC 2014
<!-- hhmts end -->
</div>
@ -88,10 +88,8 @@ fp = open('mypdf.pdf', 'rb')
<span class="comment"># Create a PDF parser object associated with the file object.</span>
parser = PDFParser(fp)
<span class="comment"># Create a PDF document object that stores the document structure.</span>
document = PDFDocument(parser)
<span class="comment"># Supply the password for initialization.</span>
<span class="comment"># (If no password is set, give an empty string.)</span>
document.initialize(password)
document = PDFDocument(parser, password)
<span class="comment"># Check if the document allows text extraction. If not, abort.</span>
if not document.is_extractable:
raise PDFTextExtractionNotAllowed
@ -198,8 +196,7 @@ from pdfminer.pdfdocument import PDFDocument
<span class="comment"># Open a PDF document.</span>
fp = open('mypdf.pdf', 'rb')
parser = PDFParser(fp)
document = PDFDocument(parser)
document.initialize(password)
document = PDFDocument(parser, password)
<span class="comment"># Get the outlines of the document.</span>
outlines = document.get_outlines()