# Path: competencies/models.py
# class SubjectArea(CoreElement):
#     subject_area = models.CharField(max_length=500)
#     organization = models.ForeignKey(Organization)
# 
#     def __str__(self):
#         return self.subject_area
# 
#     class Meta:
#         order_with_respect_to = 'organization'
# 
#     def is_parent_public(self):
#         return True
# 
#     def get_parent(self):
#         return self.organization
# 
#     def get_organization(self):
#         return self.organization


from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.rl_config import defaultPageSize
from reportlab.lib.units import inch
from competencies.models import SubjectArea
import os
        canvas.setFont('Times-Roman',9)
        canvas.drawString(inch, 0.75 * inch,"First Page / %s" % self.pageinfo)
        canvas.restoreState()

    def myLaterPages(self, canvas, doc):
        canvas.saveState()
        canvas.setFont('Times-Roman', 9)
        canvas.drawString(inch, 0.75 * inch,"Page %d %s" % (doc.page, self.pageinfo))
        canvas.restoreState()

    def go(self, sa_id):
        sa = SubjectArea.objects.get(id=sa_id)
        org = sa.organization
        self.Title = org.name
        self.subtitle = sa.subject_area

        doc = SimpleDocTemplate("phello.pdf")
        Story = [Spacer(1,2*inch)]
        style = self.styles["Normal"]



        for i in range(100):
            bogustext = ("Paragraph number %s. " % i) *20
            p = Paragraph(bogustext, style)
            Story.append(p)
            Story.append(Spacer(1,0.2*inch))
        doc.build(Story, onFirstPage=self.myFirstPage, onLaterPages=self.myLaterPages)



# Path: competencies/models.py
# class SubjectArea(CoreElement):
#     subject_area = models.CharField(max_length=500)
#     organization = models.ForeignKey(Organization)
# 
#     def __str__(self):
#         return self.subject_area
# 
#     class Meta:
#         order_with_respect_to = 'organization'
# 
#     def is_parent_public(self):
#         return True
# 
#     def get_parent(self):
#         return self.organization
# 
#     def get_organization(self):
#         return self.organization


# Path: pdf_test.py
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.rl_config import defaultPageSize
from reportlab.lib.units import inch
from competencies.models import SubjectArea
import os

        canvas.setFont('Times-Roman',9)
        canvas.drawString(inch, 0.75 * inch,"First Page / %s" % self.pageinfo)
        canvas.restoreState()

    def myLaterPages(self, canvas, doc):
        canvas.saveState()
        canvas.setFont('Times-Roman', 9)
        canvas.drawString(inch, 0.75 * inch,"Page %d %s" % (doc.page, self.pageinfo))
        canvas.restoreState()

    def go(self, sa_id):
        sa = SubjectArea.objects.get(id=sa_id)
        org = sa.organization
        self.Title = org.name
        self.subtitle = sa.subject_area

        doc = SimpleDocTemplate("phello.pdf")
        Story = [Spacer(1,2*inch)]
        style = self.styles["Normal"]



        for i in range(100):
            bogustext = ("Paragraph number %s. " % i) *20
            p = Paragraph(bogustext, style)
            Story.append(p)
            Story.append(Spacer(1,0.2*inch))
        doc.build(Story, onFirstPage=self.myFirstPage, onLaterPages=self.myLaterPages)



pdftest = PDFTest()