Skip to content

Instantly share code, notes, and snippets.

@leotada
Last active September 25, 2017 13:47
Show Gist options
  • Save leotada/2b1779f707f8b6a0a4f84d60e4cc0ae3 to your computer and use it in GitHub Desktop.
Save leotada/2b1779f707f8b6a0a4f84d60e4cc0ae3 to your computer and use it in GitHub Desktop.
from reportlab.pdfgen import canvas
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.lib.units import cm
from reportlab.lib.pagesizes import A4
c = canvas.Canvas("hello.pdf", pagesize=A4)
# auto generated elements
texto = c.drawString(1*cm, 2*cm, "Teste 1")
texto = c.drawString(30, 200, "Segunda frase")
texto = c.drawString(50, 400, "Terceira frase")
texto = c.drawString(80, 600, "Esta frase contêm acentos.")
texto = c.drawString(150, 800, "Teste: #$#$(#$*@*%@#L$PTOI$). Ok")
# Save
c.showPage()
c.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment