Exemplo n.º 1
0
    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 = []
Exemplo n.º 2
0
    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 = []
Exemplo n.º 3
0
fontprop = ap.fm.FontProperties(family='sans-serif',
                                fname=ap.fontprop.fname,
                                size=None,
                                stretch=ap.fontprop.stretch,
                                style=ap.fontprop.style,
                                variant=ap.fontprop.variant,
                                weight=ap.fontprop.weight)

fontsize = 10
ap.matplotlib.rcParams.update({
    '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)