SlideShare a Scribd company logo
1 of 14
Download to read offline
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

More Related Content

Viewers also liked (7)

Encapsulation
EncapsulationEncapsulation
Encapsulation
 
DOM Structure
DOM StructureDOM Structure
DOM Structure
 
How to setup android development environment baabtra Android Workshop Kit?
How to setup android development environment baabtra Android Workshop Kit?How to setup android development environment baabtra Android Workshop Kit?
How to setup android development environment baabtra Android Workshop Kit?
 
Industrial training project management session2
Industrial training project management session2Industrial training project management session2
Industrial training project management session2
 
Statistics
StatisticsStatistics
Statistics
 
Cascade.ss
Cascade.ssCascade.ss
Cascade.ss
 
Leadership Qualities
Leadership QualitiesLeadership Qualities
Leadership Qualities
 

Similar to Pdf creation using python

Creating attachments to work items or to user decisions in workflows
Creating attachments to work items or to user decisions in workflowsCreating attachments to work items or to user decisions in workflows
Creating attachments to work items or to user decisions in workflows
Hicham Khallouki
 
Arithmetic operator
Arithmetic operatorArithmetic operator
Arithmetic operator
Md Masudur Rahman
 
Management Cockpit (SEM-CPM-MC) Step by Step Creation
Management Cockpit (SEM-CPM-MC) Step by Step CreationManagement Cockpit (SEM-CPM-MC) Step by Step Creation
Management Cockpit (SEM-CPM-MC) Step by Step Creation
Rahul Desai
 

Similar to Pdf creation using python (20)

Adobe Edge Animate and Captivate 8 Redux
Adobe Edge Animate and Captivate 8 ReduxAdobe Edge Animate and Captivate 8 Redux
Adobe Edge Animate and Captivate 8 Redux
 
Creating attachments to work items or to user decisions in workflows
Creating attachments to work items or to user decisions in workflowsCreating attachments to work items or to user decisions in workflows
Creating attachments to work items or to user decisions in workflows
 
Programming in c
Programming in cProgramming in c
Programming in c
 
PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...
PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...
PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerC...
 
How we manage React Microfrontends at JobMatchMe
How we manage React Microfrontends at JobMatchMeHow we manage React Microfrontends at JobMatchMe
How we manage React Microfrontends at JobMatchMe
 
InterConnect2016: WebApp Architectures with Java and Node.js
InterConnect2016: WebApp Architectures with Java and Node.jsInterConnect2016: WebApp Architectures with Java and Node.js
InterConnect2016: WebApp Architectures with Java and Node.js
 
Arithmetic operator
Arithmetic operatorArithmetic operator
Arithmetic operator
 
Visual Exploration of Large Data sets with D3, crossfilter and dc.js
Visual Exploration of Large Data sets with D3, crossfilter and dc.jsVisual Exploration of Large Data sets with D3, crossfilter and dc.js
Visual Exploration of Large Data sets with D3, crossfilter and dc.js
 
Management Cockpit (SEM-CPM-MC) Step by Step Creation
Management Cockpit (SEM-CPM-MC) Step by Step CreationManagement Cockpit (SEM-CPM-MC) Step by Step Creation
Management Cockpit (SEM-CPM-MC) Step by Step Creation
 
Lsmw
LsmwLsmw
Lsmw
 
Citt Wf@Tb V 0 4
Citt Wf@Tb V 0 4Citt Wf@Tb V 0 4
Citt Wf@Tb V 0 4
 
Trigger bi process chain from ecc
Trigger bi process chain from eccTrigger bi process chain from ecc
Trigger bi process chain from ecc
 
Data Analysis in Python
Data Analysis in PythonData Analysis in Python
Data Analysis in Python
 
Bdc
BdcBdc
Bdc
 
Precomputing recommendations with Apache Beam
Precomputing recommendations with Apache BeamPrecomputing recommendations with Apache Beam
Precomputing recommendations with Apache Beam
 
Labsheet_3
Labsheet_3Labsheet_3
Labsheet_3
 
Computer graphics practical(jainam)
Computer graphics practical(jainam)Computer graphics practical(jainam)
Computer graphics practical(jainam)
 
Zebra -bar one label printing
Zebra -bar one label printingZebra -bar one label printing
Zebra -bar one label printing
 
Rits Brown Bag - Salesforce Lightning
Rits Brown Bag - Salesforce LightningRits Brown Bag - Salesforce Lightning
Rits Brown Bag - Salesforce Lightning
 
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORYCS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
CS6311- PROGRAMMING & DATA STRUCTURE II LABORATORY
 

More from baabtra.com - No. 1 supplier of quality freshers

More from baabtra.com - No. 1 supplier of quality freshers (20)

Agile methodology and scrum development
Agile methodology and scrum developmentAgile methodology and scrum development
Agile methodology and scrum development
 
Best coding practices
Best coding practicesBest coding practices
Best coding practices
 
Core java - baabtra
Core java - baabtraCore java - baabtra
Core java - baabtra
 
Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
 
Php sessions & cookies
Php sessions & cookiesPhp sessions & cookies
Php sessions & cookies
 
Php database connectivity
Php database connectivityPhp database connectivity
Php database connectivity
 
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
 
Chapter 5 transactions and dcl statements
Chapter 5  transactions and dcl statementsChapter 5  transactions and dcl statements
Chapter 5 transactions and dcl statements
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 3 stored procedures
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Microsoft holo lens
 
Blue brain
Blue brainBlue brain
Blue brain
 
5g
5g5g
5g
 
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra
Aptitude skills baabtra
 
Gd baabtra
Gd baabtraGd baabtra
Gd baabtra
 

Recently uploaded

BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
SoniaTolstoy
 

Recently uploaded (20)

Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 

Pdf creation using python

  • 1.
  • 2. 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
  • 3. Week Targ et Achieve d 1 23 19 2 25 23 3 30 27 4 35 Typing Speed
  • 4. Jobs Applied # Company Designation Applied Date Current Status 1 Skillsearch Limited Junior software engineer 7/08/2013 2 3
  • 6. 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
  • 7. 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
  • 8. 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.
  • 9. 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()
  • 11. ● 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
  • 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 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
  • 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