F
F
F1eex2021-06-28 18:14:47
IT education
F1eex, 2021-06-28 18:14:47

How to make a program for printing numbered business cards?

From all that I know in programming - what are variables, branches, conditions, loops, arrays, functions.
In order to learn a little Python, I want to write a program on it for printing business cards with different numbers on a printer. I want to make the picture of the business card loaded into the window. After that, the window indicated how this business card would be distributed on an A4 sheet, as well as numbers on separate business cards. For example, 100 business cards with numbers 0001-0100 will be printed on 10 sheets, 10 pieces per sheet.
What do you need to learn in Python to do this? What libraries?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
1
12rbah, 2021-06-29
@F1eex

Just write the correct path to the image, font.

from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw

img = Image.open("chapter04/cat.jpg")
draw = ImageDraw.Draw(img)
font = ImageFont.truetype("/home/us/.local/share/fonts/SyneMono-Regular.ttf", 16)
draw.text((0, 0),"Sample Text",(255,255,255),font=font)
img.save('sample-out.jpg')

see more details here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question