Changeset 4ec242e in sasview for src/sas/perspectives/fitting
- Timestamp:
- Feb 17, 2015 10:45:44 AM (10 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- e843a1c
- Parents:
- 5dfdfa7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/perspectives/fitting/report_dialog.py
rd06ae30 r4ec242e 17 17 import os 18 18 import wx.html as html 19 import logging 19 20 20 21 _STATICBOX_WIDTH = 480 … … 297 298 """ 298 299 Create a PDF file from html source string. 300 Returns True is the file creation was successful. 299 301 300 302 : data: html string 301 303 : filename: name of file to be saved 302 304 """ 303 import ho.pisa as pisa 304 f = file(filename, "wb") 305 # pisa requires some extra packages, see their web-site 306 pdf = pisa.CreatePDF(data, f) 307 308 # close the file here otherwise it will be open until quitting 309 #the application. 310 f.close() 311 self.Update() 312 return not pdf.err 305 try: 306 from xhtml2pdf import pisa 307 # open output file for writing (truncated binary) 308 resultFile = open(filename, "w+b") 309 # convert HTML to PDF 310 pisaStatus = pisa.CreatePDF(data, dest=resultFile) 311 # close output file 312 resultFile.close() 313 self.Update() 314 return pisaStatus.err 315 except: 316 logging.error("Error creating pdf: %s" % sys.exc_value) 317 return False
Note: See TracChangeset
for help on using the changeset viewer.