[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Swftools-common] Trouble when gfx rendering a protected PDF file.
From: |
Chris Pugh |
Subject: |
Re: [Swftools-common] Trouble when gfx rendering a protected PDF file. Application exits. |
Date: |
Wed, 21 Jul 2010 21:11:24 +0100 |
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(...)
to check for a protected ( how? ) document?
Raise the logging level of the gfx module with
verbose(...)
verbose(level)
to get a handle on what's actually happening?
HTH a little.
Regards,
Chris.
On 20 July 2010 19:21, Joel Shapiro <address@hidden> wrote:
> Trouble when gfx rendering a protected PDF file. Application exits.
>
> Hello All,
>
> The following snippet from my Python app works perfectly - until a protected
>
> .PDF file is encountered - The application exits and I can't seem to find an
> exception
>
> that covers it. Also is the snippet from the Idle Shell :
>
> try:
> doc = gfx.open("pdf", ComnPDF)
>
> text = gfx.PlainText()
>
> # gfx.setparameter("zoom", "400")
> # text = gfx.OCR()
>
> 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("G:/MovableIdle-Python-2.5/document_fulltext.txt")
> f = open("G:/MovableIdle-Python-2.5/document_fulltext.txt", 'r')
>
> CurrentText = f.read()
>
> f.close()
> LengthBytes = len(CurrentText)
>
> except socket.timeout:
> print "PDF Socket timeout error"
> except ValueError:
> print "PDF Value error"
> except TypeError:
> print "PDF TypeError error"
> except Exception:
> print "gfx open exception"
> except IOError:
> print "PDF IO error"
> except SystemExit:
> print "system Exit exception"
> except:
> print "PDF unexpected error:", sys.exc_info()[0]
> raise
>
>
> Here's from my Python IDLE:
>
>
> Current URL:
> http://cultureblog.homeword.com/weblog/2010/06/early-school-start-times-raise-risk-of-teen-car-crashes.html
>
> Length Current URL: 39087 bytes
>
> {'confidence': 1.0, 'encoding': 'ascii'}
>
> ISO-8559-X still under construction
>
> Number matches latin-1 count: later: 2 later ENGLISH: en
> Number matches latin-1 count: school: 31 school ENGLISH: en
> Number matches latin-1 count: start: 22 start ENGLISH: en
> Number matches latin-1 count: time: 26 time ENGLISH: en
> Number matches latin-1 count: increased: 3 increased ENGLISH: en
> Number matches latin-1 count: health: 11 health ENGLISH: en
> Number matches latin-1 count: alert: 7 alert ENGLISH: en
> Number matches latin-1 count: sleep: 14 sleep ENGLISH: en
> Number matches latin-1 count: accident: 3 accident ENGLISH: en
> Number matches latin-1 count: rate: 8 rate ENGLISH: en
> Number matches latin-1 count: better: 4 better ENGLISH: en
> Number matches latin-1 count: grades: 4 grades ENGLISH: en
> Number matches latin-1 count: reference: 1 reference ENGLISH: en
> Number matches latin-1 count: rates: 4 rates ENGLISH: en
> Number matches latin-1 count: adolescent: 3 adolescent ENGLISH: en
>
>
>
> Current run time: 883 seconds
>
> Start scan key press to halt processing for: 1 seconds
> End scan key press to halt processing.
>
> Current URL:
> http://www.wayland.k12.ma.us/district/district_info/departments/superintendent/reports/schoolstarttimes.pdf
>
>>>> ================================ RESTART
>>>> ================================
>>>>
>
> Thanks,
>
> Joel S.
>
>