def setDocument(self, version="2.0.0", leftMargin=0.9, rightMargin=0.9, topMargin=0.9, bottomMargin=0.9, producer="LDM-Tool", title=None, author=None, subject=None, creator="Daimler", keywords=[]): """ :param leftMargin: Linke Randdicke in [cm] :param rightMargin: Rechte Randdicke in [cm] :param topMargin: Obere Randdicke in [cm] :param bottomMargin: Untere Randdicke in [cm] """ self.doc = ar.AutoDocTemplate( self.filename, onFirstPage=(self.refs[0], self.frames[0]), onLaterPages=(self.refs[1], self.frames[1]), onLaterSPages=(self.refs[2], self.frames[2]), leftMargin=leftMargin * ar.cm, rightMargin=rightMargin * ar.cm, topMargin=topMargin * ar.cm, bottomMargin=bottomMargin * ar.cm, title=title, producer="%s %s" % (producer, version), author=author, subject=subject, creator=creator, keywords=keywords, debug=self.debug)
def setUp(self): """ Hook method for setting up the test fixture before exercising it. Has to be run to set up the test """ # Begin of Documentation to Potable Document self.doc = ar.AutoDocTemplate(self.outname, onFirstPage=(drawFirstPage, 1), onLaterPages=(drawLaterPage, 1), onLaterSPages=(drawLaterLPage, 1)) self.styles = ar.Styles() self.styles.registerStyles() self.contents = []
def setUp(self): """ Hook method for setting up the test fixture before exercising it. Has to be run to set up the test """ self.fake = Faker() # Begin of Documentation to Potable Document self.doc = ar.AutoDocTemplate( self.outname, onFirstPage=(drawFirstPortrait, 1), onLaterPages=(drawLaterPortrait, 0), onLaterSPages=(drawLaterLandscape, 2), # leftMargin=0. * ar.cm, # rightMargin=0. * ar.cm, # topMargin=0. * ar.cm, # bottomMargin=0. * ar.cm, debug=True) self.styles = ar.Styles() self.styles.registerStyles() self.contents = []
'font.size': fontsize, 'font.family': 'sans-serif' }) styles = ar.Styles() styles.registerStyles() outname = os.path.join(os.path.dirname(__file__), "MinimalExample.pdf") # from django.http import HttpResponse # outname = HttpResponse(mimetype='application/pdf') # outname['Content-Disposition'] = 'attachment; filename=somefilename.pdf' doc = ar.AutoDocTemplate(outname, onFirstPage=ar.onFirstPage, onLaterPages=ar.onLaterPages, onLaterSPages=ar.onLaterPages, leftMargin=0.5 * ar.cm, rightMargin=0.5 * ar.cm, topMargin=0.5 * ar.cm, bottomMargin=0.5 * ar.cm) content = [] #add title para = ar.Paragraph(u"Minimal Example Title", styles.title) content.append(para) content.append(ar.PageBreak()) # Create Table Of Contents. Override the level styles (optional) # and add the object to the story toc = ar.doTabelOfContents() content.append(ar.Paragraph(u"Inhaltsverzeichnis", styles.h1))
}) styles = ar.Styles() styles.registerStyles() outname = os.path.join(os.path.dirname(__file__), "MinimalExample.pdf") # from django.http import HttpResponse # outname = HttpResponse(mimetype='application/pdf') # outname['Content-Disposition'] = 'attachment; filename=somefilename.pdf' #define page templates doc = ar.AutoDocTemplate(outname, onFirstPage=(drawFirstPage, 1), onLaterPages=(drawLaterPage,1), onLaterSPages=(drawLaterSpecialPage, 1), leftMargin=0.5*ar.cm, rightMargin=0.5*ar.cm, topMargin=0.5*ar.cm, bottomMargin=0.5*ar.cm, debug=True, producer="NuCOS") doc.addPageInfo(typ="header",pos="l", text="First Header Left", image=None, line=False,frame="First", addPageNumber=False, rightMargin=True, leftMargin=True, shift=None) doc.addPageInfo(typ="header",