def get_page_images (self):

            tf = mktempfile(".pnm")
            cmd = ('"%s" --input-format jp2 --input "%s" --output-format pnm --output "%s"'
                   % (JASPER, self.doc, tf))
            try:
                status, output, tsignal = subproc(cmd)
                if status == 0:
                    # success
                    img = Image.open(tf)
                    imagespath = self.images_path()
                    os.mkdir(imagespath)
                    if self.uses_png:
                        png_file_name = os.path.join(imagespath, "page00001.png")
                        img.save(png_file_name, "PNG")
                    else:
                        if (convert_image_to_tiff(tf, imagespath)):
                            note(3, "created tiff file in %s", imagespath)
                else:
                    note("Can't convert %s.  Output was %s.", self.doc, output)
                    note(4, "cmd was %s", cmd)
                    note(4, "tfile %s %s", tf, (os.path.exists(tf) and "exists") or "does not exist")
                    raise RuntimeError(output)
            finally:
                if os.path.exists(tf):
                    os.unlink(tf)
 def get_pdf_version(self):
     if not (self.pdffile and os.path.exists(self.pdffile)):
         tfile = mktempfile()
         self.format_vcard(tfile, self.__card)
         self.pdffile = tfile
     return self.pdffile