加入分页,逆序排列帖子

This commit is contained in:
liuwei
2025-03-03 15:37:05 +08:00
parent 77b5b7e2bb
commit 47e7ade2f7

View File

@@ -124,13 +124,13 @@ def fetch_and_create_pdf(url):
# 添加标题 # 添加标题
content.append(Paragraph(f" {post_title}", title_style)) content.append(Paragraph(f" {post_title}", title_style))
content.append(Spacer(1, 12)) content.append(Spacer(1, 5))
# 添加磁力链接 # 添加磁力链接
if magnet_links: if magnet_links:
for magnet_link in magnet_links: for magnet_link in magnet_links:
content.append(Paragraph(f"<br /><b>{magnet_link}</b><br />", normal_style)) content.append(Paragraph(f"<br /><b>{magnet_link}</b><br />", normal_style))
content.append(Spacer(1, 12)) content.append(Spacer(1, 5))
# 添加图片 # 添加图片
image_links = [] image_links = []
@@ -145,7 +145,7 @@ def fetch_and_create_pdf(url):
if image: if image:
img = PILImage.open(image) img = PILImage.open(image)
img_width, img_height = img.size img_width, img_height = img.size
image_width = 500 image_width = 450
image_height = int((img_height / img_width) * image_width) image_height = int((img_height / img_width) * image_width)
img_stream = BytesIO(image.getvalue()) img_stream = BytesIO(image.getvalue())
content.append(Image(img_stream, width=image_width, height=image_height)) content.append(Image(img_stream, width=image_width, height=image_height))