GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing pdfsyntax.dev — PDFSyntax APIThis article introduces the principles. Quick access to specific articles: Pure functionsMost functions are pure and are exposed both as basic functions and as instance methods of a Doc object: in the function signatures found in the following sections, a >>> #Function pattern
>>> from pdfsyntax import readfile, metadata
>>> doc = readfile("samples/simple_text_string.pdf")
>>> m = metadata(doc)
>>> #Method pattern
>>> import pdfsyntax as pdf
>>> doc = pdf.readfile("samples/simple_text_string.pdf")
>>> m = doc.metadata()
Every time a function is applied to a Doc object, the function returns a new object built as a shallow copy of the input. Incremental updatesPDFSyntax tracks document incremental updates made possible by appending new or updated objects at the end of an original PDF file (and the matching XREF section). A revision, if greater than 0, indicates that incremental updates have been appended.By default, a newly opened document by PDFSyntax is ready to write modifications in the next revision.The For example this file contains 2 revisions (0 and 1) and PDFSyntax has initialized the doc object to open revision 2: >>> import pdfsyntax as pdf
>>> doc = pdf.readfile("samples/add_text_annotation.pdf")
>>> doc
<PDF Doc in revision 2 with 0 modified object(s)>
The >>> doc = pdf.rewind(doc) # to revision 1 >>> doc = pdf.rewind(doc) # to revision 0 >>> doc <PDF Doc in revision 0 with 7 modified object(s)> After one or several modifications, the >>> doc = pdf.rotate(doc) >>> doc = pdf.commit(doc) >>> doc <PDF Doc in revision 1 with 0 modified object(s)> SquashingBy default incremental updates stack up but it is possible to >>> doc90 = pdf.rotate(doc) >>> doc90 <PDF Doc in revision 1 with 1 modified object(s)> >>> docs = pdf.squash(doc90) >>> docs <PDF Doc in revision 0 with 7 modified object(s)> File I/OThe >>> from pdfsyntax import readfile, writefile
>>> doc = readfile("samples/simple_text_string.pdf")
>>> doc90 = pdf.rotate(doc)
>>> writefile(doc90, "rotated_doc.pdf")
|
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |