Hola mi nombre es Héctor y estaré feliz de ayudarte hoy.
¿Me podrías comentar un poco del problema que tienes?, ¿está relacionado con Excel?, ¿Tienes una suscripción activa?
Estoy atento a tus comentarios para continuar el acompañamiento.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Abrir archivo
Hola mi nombre es Héctor y estaré feliz de ayudarte hoy.
¿Me podrías comentar un poco del problema que tienes?, ¿está relacionado con Excel?, ¿Tienes una suscripción activa?
Estoy atento a tus comentarios para continuar el acompañamiento.
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more
from reportlab.lib.pagesizes import legal
from reportlab.platypus import SimpleDocTemplate, Image, Spacer
from reportlab.lib.units import inch
from PIL import Image as PILImage
import os
images = [
"/mnt/data/C8BFD851-8CAC-4172-8569-48E9E331C15C.jpeg",
"/mnt/data/6AAFF5AA-5E1F-476F-A4A1-0C31BFB278BA.jpeg",
"/mnt/data/48FF8853-0FA7-4E15-BABA-6DA96C9A3002.jpeg",
"/mnt/data/8593A8A6-4664-461E-9CB2-F4A5388125DB.jpeg",
]
pdf_path = "/mnt/data/Prueba_Estructura_Exacta_Oficio.pdf"
doc = SimpleDocTemplate(
pdf_path,
pagesize=legal, # oficio aprox.
rightMargin=20,
leftMargin=20,
topMargin=20,
bottomMargin=20
)
elements = []
for img_path in images:
pil_img = PILImage.open(img_path)
width, height = pil_img.size
max_width = 7.7 * inch
max_height = 12 * inch
ratio = min(max_width / width, max_height / height)
img = Image(img_path, width=width * ratio, height=height * ratio)
elements.append(img)
elements.append(Spacer(1, 0.2 * inch))
doc.build(elements)
print(f"PDF creado: {pdf_path}")
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more
code-generated-file-3022db7b-6cc1-4b9e-a219-f2a778ac647f