attachment
attachment

Make a pdf of this

I'll read the PDF skill first, then convert the image to PDF.
Reading File
Now I'll download the image and convert it to PDF:
Running Command

mkdir -p /home/daytona/workspace/pan-pdf && curl -s "https://d361swluvexzqs.cloudfront.net/chats-attachments/IMG-20210224-WA0015-1779007210114-mxfva1.jpg" -o /home/daytona/workspace/pan-pdf/pan_card.jpg && echo "Downloaded"

Running Command

python3 -c " from PIL import Image from reportlab.lib.pagesizes import A4 from reportlab.pdfgen import canvas img_path = '/home/daytona/workspace/pan-pdf/pan_card.jpg' out_path = '/home/daytona/workspace/pan-pdf/pan_card.pdf' img = Image.open(img_path) img_w, img_h = img.size page_w, page_h = A4 margin = 40 max_w = page_w - 2 * margin max_h = page_h - 2 * margin scale = min(max_w / img_w, max_h / img_h) draw_w = img_w * scale draw_h = img_h * scale x = (page_w - draw_w) / 2 y = (page_h - draw_h) / 2 c = canvas.Canvas(out_path, pagesize=A4) c.drawImage(img_path, x, y, width=draw_w, height=draw_h) c.save() print('PDF created:', out_path) "

Your PDF is ready:

pan card

PDF Document · PDF

The image has been centered on an A4 page with margins preserved.
This is a shared conversation. Sign in to Orris to start your own chat.