On Wed, Jul 21, 2010 at 9:11 PM, Chris Pugh <nisse...@googlemail.com> wrote: > Hi, > > Unfortunately I'm not familiar with the gfx module, however > here's a couple of suggestions, from taking ab brief look at, > > http://www.swftools.org/gfx.html > > Use, > > getInfo(...)
Like Chris pointed, use getInfo See example code attached. It's a modification of your sample. Ricardo
import sys import gfx class PDFProtected(Exception): pass doc = gfx.open("pdf", sys.argv[1]) if doc.getInfo("oktocopy") == "no": if doc.getInfo("oktoprint") == "yes": doc.setparameter('asprint', '1') else: raise PDFProtected("PDF does not allow copy nor print") text = gfx.PlainText() for pagenr in range(1,doc.pages+1): page = doc.getPage(pagenr) text.startpage(page.width, page.height) page.render(text) text.endpage() text.save("document_fulltext.txt") length = len(open("document_fulltext.txt", 'r').read()) print length