Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Static Private Attributes
PortalTransforms.transforms.pdf_to_text.old_pdf_to_text Class Reference
Inheritance diagram for PortalTransforms.transforms.pdf_to_text.old_pdf_to_text:
Inheritance graph
[legend]
Collaboration diagram for PortalTransforms.transforms.pdf_to_text.old_pdf_to_text:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def convert
def invokeCommand

Static Public Attributes

tuple inputs = ('application/pdf',)
string output = 'text/plain'
string output_encoding = 'utf-8'
string binaryName = "pdftotext"

Static Private Attributes

 __implements__ = itransform
string __name__ = "pdf_to_text"

Detailed Description

Definition at line 25 of file pdf_to_text.py.


Constructor & Destructor Documentation

Definition at line 35 of file pdf_to_text.py.

00035 
00036     def __init__(self):
00037         commandtransform.__init__(self, binary=self.binaryName)


Member Function Documentation

def PortalTransforms.transforms.pdf_to_text.old_pdf_to_text.convert (   self,
  data,
  cache,
  kwargs 
)

Definition at line 38 of file pdf_to_text.py.

00038 
00039     def convert(self, data, cache, **kwargs):
00040         kwargs['filename'] = 'unkown.pdf'
00041 
00042         tmpdir, fullname = self.initialize_tmpdir(data, **kwargs)
00043         text = self.invokeCommand(tmpdir, fullname)
00044         path, images = self.subObjects(tmpdir)
00045         objects = {}
00046         if images:
00047             self.fixImages(path, images, objects)
00048         self.cleanDir(tmpdir)
00049         cache.setData(text)
00050         cache.setSubObjects(objects)
00051         return cache

Here is the call graph for this function:

Definition at line 52 of file pdf_to_text.py.

00052 
00053     def invokeCommand(self, tmpdir, fullname):
00054         # FIXME: windows users...
00055         textfile = "%s/%s.txt" % (tmpdir, sansext(fullname))
00056         cmd = 'cd "%s" && %s -enc UTF-8 "%s" "%s" 2>error_log 1>/dev/null' % (
00057             tmpdir, self.binary, fullname, textfile)
00058         os.system(cmd)
00059         try:
00060             text = open(textfile).read()
00061         except:
00062             try:
00063                 return open("%s/error_log" % tmpdir, 'r').read()
00064             except:
00065                 return ''
00066         return text

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 26 of file pdf_to_text.py.

string PortalTransforms.transforms.pdf_to_text.old_pdf_to_text.__name__ = "pdf_to_text" [static, private]

Definition at line 28 of file pdf_to_text.py.

Definition at line 33 of file pdf_to_text.py.

Definition at line 29 of file pdf_to_text.py.

Definition at line 30 of file pdf_to_text.py.

Definition at line 31 of file pdf_to_text.py.


The documentation for this class was generated from the following file: