View Single Post
Old 08-20-2008, 01:45 AM   #83
xiblack
Junior Member
xiblack began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Aug 2008
Device: iPhone
Quote:
Originally Posted by nrapallo View Post
Overall, pi version 0.3 works well, but I ran into some obstacles trying to 'windows-ize' it.

I succeeded in converting the sample .pdf using 'pi_format chap6.conf' on a Windows PC, but it was a brute-force finish that cannot be used in general. More testing/exploring is required to yield a windows only solution (in addition to the working linux based solution offered by the original poster).

In pi.py, I had to change the bold line to conform with pdftoppm.exe (from xpdf) output of the form "chap6-004-page-000004.pgm" i.e 6 digit page number prior to .pgm.
Code:
def get_img(self, dpi = 150, out_prefix = None):
        pdf_fn = self.doc.pdf_fn
        if out_prefix is None:
            out_prefix = '%spage' % (self.output_prefix,)
        spage = '%d' % (self.page_no,)
        sdpi = '%d' % (dpi,)
        ret = call(['pdftoppm', '-r', sdpi, '-f', spage, '-l', spage, '-gray',
                    pdf_fn, out_prefix])
        assert(ret == 0)
        img_fn = '%s-%06d.pgm' % (out_prefix, self.page_no)
        return img_fn
Hi,

I try the latest pi_06 on my SuSE OSS 10.0.0, it didnt work until I try the fix above.

After the fix, pi_06 works well but I encounter this error after some pages generated:

Quote:
...
page: 30
page: 31
page: 32
Traceback (most recent call last):
File "/home/name/download/pi/bin/pi_format.py", line 67, in ?
test_all(sys.argv[1])
File "/home/name/download/pi/bin/pi_format.py", line 16, in test_all
doc.reformat()
File "/home/name/download/pi/bin/pi.py", line 1495, in reformat
page.rend()
File "/home/name/download/pi/bin/pi.py", line 761, in rend
self.img = self.img.filter(ImageFilter.MinFilter(3))
File "/usr/lib/python2.4/site-packages/PIL/Image.py", line 715, in filter
self.load()
File "/usr/lib/python2.4/site-packages/PIL/ImageFile.py", line 148, in load
self.im = Image.core.map_buffer(
ValueError: buffer is not large enough
I wonder where I can set the buffer larger or is it a limit of anything?

Last edited by xiblack; 08-20-2008 at 01:49 AM.
xiblack is offline   Reply With Quote