Changeset 7054


Ignore:
Timestamp:
9 Nov 2011, 06:42:13 (13 years ago)
Author:
uli
Message:

Insert passport image in PDF output.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/branches/ulif-extimgstore/src/waeup/sirp/applicants/browser.py

    r7050 r7054  
    656656        frame_body = Frame(1*cm,1*cm,width-(2*cm),height-(3.5*cm))
    657657        story.append(Paragraph(self.label, style["Heading2"]))
    658         #story.append(HRFlowable())
    659658        story.append(Spacer(1, 18))
    660659        for msg in self.context.history.messages:
     
    662661            story.append(Paragraph(f_msg, style["Normal"]))
    663662        story.append(Spacer(1, 24))
     663
     664        data = []
     665        # insert passport photograph
     666        img = getUtility(IExtFileStore).getFileByContext(self.context)
     667        if img is None:
     668            img = open(os.path.join(IMAGE_PATH, 'placeholder_m.jpg'), 'rb')
     669        doc_img = Image(img.name, width=4*cm, height=3*cm, kind='bound')
     670        data.append(['', doc_img])
     671
     672        # render widget fields
    664673        self.setUpWidgets()
    665         data = []
    666674        for widget in self.widgets:
    667675            f_label = '<font size=12>%s</font>:' % widget.label.strip()
    668676            f_label = Paragraph(f_label, style["Normal"])
    669             if widget.name != 'form.passport':
    670                 f_text = '<font size=12>%s</font>' % widget()
    671                 f_text = Paragraph(f_text, style["Normal"])
    672                 data.append([f_label,f_text])
    673             else:
    674                 filename = widget._data.file.name
    675                 im = Image(filename,width=4*cm, height=3*cm,kind='bound')
    676                 data.append([f_label,im])
     677            f_text = '<font size=12>%s</font>' % widget()
     678            f_text = Paragraph(f_text, style["Normal"])
     679            data.append([f_label,f_text])
    677680        f_label = '<font size=12>Admitted Course of Study:</font>'
    678681        f_text = '<font size=12>%s</font>' % self.getCourseAdmitted()
Note: See TracChangeset for help on using the changeset viewer.