예제 #1
0
파일: loapp.py 프로젝트: sonnysk76/easydev
 def exportPDF(self, doc, path_save, options):
     """
         Export to PDF
         http://wiki.services.openoffice.org/wiki/API/Tutorials/PDF_export
     """
     close = False
     if isinstance(doc, str):
         close = True
         doc = self.openDoc(doc, (('Hidden', True), ))
     if path_save:
         if comun.isdir(path_save):
             path_save = comun.replace_name_ext(path_save, doc.getURL(),
                                                EXT_PDF)
     else:
         path_save = comun.replace_ext(doc.getURL(), EXT_PDF)
     path_save = comun.path_to_url(path_save)
     try:
         filter_name = '{}_pdf_Export'.format(self.getTypeDoc(doc))
         if options:
             filter_data = comun.set_properties(options)
             filter_options = (
                 ('FilterName', filter_name),
                 ('FilterData', filter_data),
             )
         else:
             filter_options = (('FilterName', filter_name), )
         media_descriptor = comun.set_properties(filter_options)
         doc.storeToURL(path_save, media_descriptor)
     except:
         log.error('PDF', exc_info=True)
     if close:
         doc.dispose()
     if comun.exists(path_save):
         return comun.path_to_os(path_save)
     return ''
예제 #2
0
 def exportPDF(self, doc, path_save, options):
     """
         Export to PDF
         http://wiki.services.openoffice.org/wiki/API/Tutorials/PDF_export
     """
     close = False
     if isinstance(doc, str):
         close = True
         doc = self.openDoc(doc, (('Hidden', True),))
     if path_save:
         if comun.isdir(path_save):
             path_save = comun.replace_name_ext(path_save, doc.getURL(), EXT_PDF)
     else:
         path_save = comun.replace_ext(doc.getURL(), EXT_PDF)
     path_save = comun.path_to_url(path_save)
     try:
         filter_name = '{}_pdf_Export'.format(self.getTypeDoc(doc))
         if options:
             filter_data = comun.set_properties(options)
             filter_options = (
                 ('FilterName', filter_name),
                 ('FilterData', filter_data),
             )
         else:
             filter_options = (('FilterName', filter_name),)
         media_descriptor = comun.set_properties(filter_options)
         doc.storeToURL(path_save, media_descriptor)
     except:
         log.error('PDF', exc_info=True)
     if close:
         doc.dispose()
     if comun.exists(path_save):
         return comun.path_to_os(path_save)
     return ''
예제 #3
0
 def zip(self, source, target):
     if comun.isdir(source):
         comun.zip_dir(source, target)
     else:
         comun.zip_file(source, target)
     return
예제 #4
0
파일: tools.py 프로젝트: sonnysk76/easydev
 def zip(self, source, target):
     if comun.isdir(source):
         comun.zip_dir(source, target)
     else:
         comun.zip_file(source, target)
     return