Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Static Private Attributes
PortalTransforms.transforms.pdf_to_html.pdf_to_html Class Reference
Inheritance diagram for PortalTransforms.transforms.pdf_to_html.pdf_to_html:
Inheritance graph
[legend]
Collaboration diagram for PortalTransforms.transforms.pdf_to_html.pdf_to_html:
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/html'
string output_encoding = 'utf-8'
string binaryName = "pdftohtml"
string binaryArgs = "-noframes -enc UTF-8"

Static Private Attributes

 __implements__ = itransform
string __name__ = "pdf_to_html"

Detailed Description

Definition at line 29 of file pdf_to_html.py.


Constructor & Destructor Documentation

Definition at line 40 of file pdf_to_html.py.

00040 
00041     def __init__(self):
00042         commandtransform.__init__(self, binary=self.binaryName)


Member Function Documentation

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

Definition at line 43 of file pdf_to_html.py.

00043 
00044     def convert(self, data, cache, **kwargs):
00045         kwargs['filename'] = 'unknown.pdf'
00046 
00047         tmpdir, fullname = self.initialize_tmpdir(data, **kwargs)
00048         html = self.invokeCommand(tmpdir, fullname)
00049         path, images = self.subObjects(tmpdir)
00050         objects = {}
00051         if images:
00052             self.fixImages(path, images, objects)
00053         self.cleanDir(tmpdir)
00054         cache.setData(bodyfinder(html))
00055         cache.setSubObjects(objects)
00056         return cache

Here is the call graph for this function:

def PortalTransforms.transforms.pdf_to_html.pdf_to_html.invokeCommand (   self,
  tmpdir,
  fullname 
)

Definition at line 57 of file pdf_to_html.py.

00057 
00058     def invokeCommand(self, tmpdir, fullname):
00059         if os.name=='posix':
00060             cmd = 'cd "%s" && %s %s "%s" 2>error_log 1>/dev/null' % (
00061                    tmpdir, self.binary, self.binaryArgs, fullname)
00062         else:
00063             cmd = 'cd "%s" && %s %s "%s"' % (
00064                   tmpdir, self.binary, self.binaryArgs, fullname)
00065         os.system(cmd)
00066         try:
00067             htmlfilename = os.path.join(tmpdir, sansext(fullname) + '.html')
00068             htmlfile = open(htmlfilename, 'r')
00069             html = htmlfile.read()
00070             htmlfile.close()
00071         except:
00072             try:
00073                 return open("%s/error_log" % tmpdir, 'r').read()
00074             except:
00075                 return "transform failed while running %s (maybe this pdf file doesn't support transform)" % cmd
00076         return html

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 30 of file pdf_to_html.py.

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

Definition at line 32 of file pdf_to_html.py.

string PortalTransforms.transforms.pdf_to_html.pdf_to_html.binaryArgs = "-noframes -enc UTF-8" [static]

Definition at line 38 of file pdf_to_html.py.

Definition at line 37 of file pdf_to_html.py.

tuple PortalTransforms.transforms.pdf_to_html.pdf_to_html.inputs = ('application/pdf',) [static]

Definition at line 33 of file pdf_to_html.py.

Definition at line 34 of file pdf_to_html.py.

Definition at line 35 of file pdf_to_html.py.


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