1
.png 이미지 목록이 있습니다. 나는 그들 모두를 하나의 pdf, 즉 페이지 당 9 개의 이미지로 변환 할 필요가 있지만 수직으로 하나씩 배치하지 않고 모든 너비를 채우고 다음 행으로 계속 진행해야합니다. 사진의 금액 내가 FPDF에게파이썬에서 하나의 pdf로 이미지 파일
from fpdf import FPDF
list_of_images = [1.png, 2.png, ... 15.png]
w = 70
h = 60
pdf = FPDF(orientation = 'L')
for image in list_of_images:
pdf.image(image, w=sizew, h=sizeh)
pdf.output("Memory_usage.pdf", "F")
을 시도하고도
template = Template('''<!doctype html>
<html>
<body>
<div style="display: flex; flex-direction: row">
{% for image in images %}
<img src="{{ image }}" />
{% endfor %}
</div>
</body>
</html>''')
list_of_images = [1.png, 2.png, ... 15.png]
html = template.render(images=list_of_pict)
with open("my_new_file.html", "wb") as fh:
fh.write(html)
p = subprocess.Popen(['wkhtmltopdf', '-', 'Memory_usage.pdf'], stdin=subprocess.PIPE, universal_newlines=True)
p.communicate(html)
p.wait()
하지만 둘 다 각각의 사진을 배치를 wkhtmltopdf 한
(... 15 12)마다 다를 수 있습니다 하나 아래