Disclaimer: This presentation is prepared
by trainees of baabtra as a part of
mentoring program. This is not official
document of baabtra –Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System
Technologies Pvt . Ltd
Week Targ
et
Achieve
d
1 23 19
2 25 23
3 30 27
4 35
Typing Speed
Jobs Applied
# Company Designation Applied
Date
Current
Status
1 Skillsearch
Limited
Junior software
engineer
7/08/2013
2
3
PDF CREATION IN
PYTHON
●
Shameena
●
shameenavayoli@gmail.com
●
www.facebook.com/shameenalatheef
●
twitter.com/shameena
●
in.linkedin.com/in/shamean
●
9567135569
PDF- Portable Document Format
ReportLab :
---Open source python libraries for pdf creation.
---ReportLab is fast ,flexible, and fully cross platform
---The ReportLab library directly creates PDF based on
your graphics commands
Installing syntax:
---sudo apt-get install python-pip
---pip install reportlab
The pdfgen package is the lowest level interface for
generating PDF documents.
A pdfgen program is essentially a sequence of instructions for
"painting" a document onto a sequence of pages
The interface object which provides the painting
operations is the pdfgen canvas.
The canvas should be thought of as a sheet of
white paper with points on the sheet identified using
Cartesian (X,Y) coordinates
--default have the (0,0) origin point at the lower
bottom left corner of the page.
A simple example program that uses a canvas follows.
from reportlab.lib.pagesizes import letter
from reportlab.pdfgen import canvas
c = canvas.Canvas("form.pdf", pagesize=letter)
c.setFont('Helvetica', 12)
c.drawString(30,750,'OFFICIAL COMMUNIQUE')
c.drawString(30,735,'OF ACME INDUSTRIES')
c.drawString(500,750,"12/12/2010")
c.line(480,747,580,747)
c.drawString(275,725,'AMOUNT OWED:')
c.drawString(500,725,"$1,000.00")
c.line(378,723,580,723)
c.drawString(30,703,'RECEIVED BY:')
c.line(120,700,580,700)
c.drawString(120,703,"JOHN DOE")
c.save()
output
● If you’re in advertising or do any kind of work with form
letters
● For that we want to import the following module
from reportlab.lib.enums import TA_JUSTIFYfrom reportlab.lib.enums import TA_JUSTIFY
from reportlab.platypus import SimpleDocTemplate,from reportlab.platypus import SimpleDocTemplate,
Paragraph, Spacer, ImageParagraph, Spacer, Image
from reportlab.lib.styles import getSampleStyleSheet,from reportlab.lib.styles import getSampleStyleSheet,
ParagraphStyleParagraphStyle
from reportlab.lib.units import inchfrom reportlab.lib.units import inch
● doc=SimpleDocTemplate("form_letter.pdf",p
agesize=letter,
rightMargin=72,leftMargin=72,
topMargin=72,bottomMargin=18)
● styles=getSampleStyleSheet()
● styles.add(ParagraphStyle(name='Justify',
alignment=TA_JUSTIFY))
● Story.append(Paragraph(ptext,
styles["Normal"]))
If this presentation helped you, please
visit our page facebook.com/baabtra and
like it.
Thanks in advance. 
 
www.baabtra.com | www.massbaab.com |
www.baabte.com
Contact Us
Emarald Mall (Big
Bazar Building)
Mavoor Road,
Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25
550
NC Complex,
Near Bus
Stand
Mukkam,
Kozhikode,
Kerala, India.
Ph: + 91 –
495 40 25
550
Start up Village
Eranakulam,
Kerala, India.
Email:
info@baabtra.com

Pdf creation using python

  • 2.
    Disclaimer: This presentationis prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
  • 3.
    Week Targ et Achieve d 1 2319 2 25 23 3 30 27 4 35 Typing Speed
  • 4.
    Jobs Applied # CompanyDesignation Applied Date Current Status 1 Skillsearch Limited Junior software engineer 7/08/2013 2 3
  • 5.
  • 6.
    PDF- Portable DocumentFormat ReportLab : ---Open source python libraries for pdf creation. ---ReportLab is fast ,flexible, and fully cross platform ---The ReportLab library directly creates PDF based on your graphics commands
  • 7.
    Installing syntax: ---sudo apt-getinstall python-pip ---pip install reportlab The pdfgen package is the lowest level interface for generating PDF documents. A pdfgen program is essentially a sequence of instructions for "painting" a document onto a sequence of pages
  • 8.
    The interface objectwhich provides the painting operations is the pdfgen canvas. The canvas should be thought of as a sheet of white paper with points on the sheet identified using Cartesian (X,Y) coordinates --default have the (0,0) origin point at the lower bottom left corner of the page.
  • 9.
    A simple exampleprogram that uses a canvas follows. from reportlab.lib.pagesizes import letter from reportlab.pdfgen import canvas c = canvas.Canvas("form.pdf", pagesize=letter) c.setFont('Helvetica', 12) c.drawString(30,750,'OFFICIAL COMMUNIQUE') c.drawString(30,735,'OF ACME INDUSTRIES') c.drawString(500,750,"12/12/2010") c.line(480,747,580,747) c.drawString(275,725,'AMOUNT OWED:') c.drawString(500,725,"$1,000.00") c.line(378,723,580,723) c.drawString(30,703,'RECEIVED BY:') c.line(120,700,580,700) c.drawString(120,703,"JOHN DOE") c.save()
  • 10.
  • 11.
    ● If you’rein advertising or do any kind of work with form letters ● For that we want to import the following module from reportlab.lib.enums import TA_JUSTIFYfrom reportlab.lib.enums import TA_JUSTIFY from reportlab.platypus import SimpleDocTemplate,from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, ImageParagraph, Spacer, Image from reportlab.lib.styles import getSampleStyleSheet,from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyleParagraphStyle from reportlab.lib.units import inchfrom reportlab.lib.units import inch
  • 12.
    ● doc=SimpleDocTemplate("form_letter.pdf",p agesize=letter, rightMargin=72,leftMargin=72, topMargin=72,bottomMargin=18) ● styles=getSampleStyleSheet() ●styles.add(ParagraphStyle(name='Justify', alignment=TA_JUSTIFY)) ● Story.append(Paragraph(ptext, styles["Normal"]))
  • 13.
    If this presentationhelped you, please visit our page facebook.com/baabtra and like it. Thanks in advance.    www.baabtra.com | www.massbaab.com | www.baabte.com
  • 14.
    Contact Us Emarald Mall(Big Bazar Building) Mavoor Road, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 NC Complex, Near Bus Stand Mukkam, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 Start up Village Eranakulam, Kerala, India. Email: info@baabtra.com