{"id":2699,"date":"2024-10-02T19:57:59","date_gmt":"2024-10-02T10:57:59","guid":{"rendered":"https:\/\/secondlife.lol\/?p=2699"},"modified":"2024-09-29T21:43:39","modified_gmt":"2024-09-29T12:43:39","slug":"converting-multiple-images-to-pdf-python","status":"publish","type":"post","link":"https:\/\/secondlife.lol\/zh\/converting-multiple-images-to-pdf-python\/","title":{"rendered":"\u91cd\u590d\u591a\u4e2a\u56fe\u50cf\u5230 PDF \u7684\u8f6c\u6362\uff1a\u4f7f\u7528 Python \u4ee3\u7801\u8f7b\u677e\u5b9e\u73b0\u81ea\u52a8\u5316"},"content":{"rendered":"<p class=\"wp-block-paragraph\"><a href=\"https:\/\/secondlife.lol\/zh\/python-pdf-image-processing-pillow-reportlab\/\" data-type=\"link\" data-id=\"https:\/\/secondlife.lol\/python-pdf-image-processing-pillow-reportlab\/\">\u4e0a\u4e00\u7bc7\u6587\u7ae0<\/a>\u5982\u4f55\u5c06\u591a\u4e2a\u56fe\u50cf\u8f6c\u6362\u4e3a PDF\uff1f\u4eca\u5929\uff0c\u6211\u4eec\u5c06\u66f4\u8fdb\u4e00\u6b65\uff1a\u5982\u679c\u60a8\u4ece\u7279\u5b9a\u6587\u4ef6\u5939\u4e2d\u7684\u5b50\u6587\u4ef6\u5939\uff08A\uff09\u521b\u5efa\u4e86\u4e00\u4e2a\u591a\u56fe\u50cf PDF \u6587\u4ef6\uff0c\u800c\u8be5\u7279\u5b9a\u6587\u4ef6\u5939\u7684\u53e6\u4e00\u4e2a\u5b50\u6587\u4ef6\u5939\uff08B\uff09\u4e2d\u8fd8\u6709\u5176\u4ed6\u56fe\u50cf\uff0c\u8be5\u600e\u4e48\u529e\uff1f\u5982\u679c\u4e00\u4e2a\u7279\u5b9a\u6587\u4ef6\u5939\u4e2d\u6df7\u5408\u4e86\u5df2\u521b\u5efa PDF \u6587\u4ef6\u7684\u6587\u4ef6\u5939\u548c\u672a\u521b\u5efa PDF \u6587\u4ef6\u7684\u6587\u4ef6\u5939\uff0c\u800c\u60a8\u60f3\u5c06\u6bcf\u4e2a\u6587\u4ef6\u5939\u8f6c\u6362\u4e3a PDF \u6587\u4ef6\uff0c\u8be5\u600e\u4e48\u529e\uff1f\u5199\u4e0b\u6765\u540e\u5c31\u6bd4\u8f83\u96be\u89e3\u91ca\u4e86\uff0c\u8bf7\u770b\u4e0b\u9762\u7684\u5185\u5bb9\uff0c\u5c31\u660e\u767d\u6211\u7684\u610f\u601d\u4e86\u3002 <\/p>\n\n\n<style>.kb-image2699_6099ec-df .kb-image-has-overlay:after{opacity:0.3;}<\/style>\n<div class=\"wp-block-kadence-image kb-image2699_6099ec-df\"><figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"506\" height=\"217\" src=\"https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/09\/image-6.png\" alt=\"\uc5ec\ub7ec \uc774\ubbf8\uc9c0 PDF \ubcc0\ud658 \ud3ec\uc2a4\ud2b8 \uadf8\ub9bc\" class=\"kb-img wp-image-2700\" srcset=\"https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/09\/image-6.png 506w, https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/09\/image-6-300x129.png 300w\" sizes=\"(max-width: 506px) 100vw, 506px\" \/><\/figure><\/div>\n\n\n<style>.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-content-wrap{padding-top:var(--global-kb-spacing-sm, 1.5rem);padding-right:var(--global-kb-spacing-sm, 1.5rem);padding-bottom:var(--global-kb-spacing-sm, 1.5rem);padding-left:var(--global-kb-spacing-sm, 1.5rem);border-top:3px solid var(--global-palette2, #2B6CB0);border-right:3px solid var(--global-palette2, #2B6CB0);border-bottom:3px solid var(--global-palette2, #2B6CB0);border-left:3px solid var(--global-palette2, #2B6CB0);border-top-left-radius:5px;border-top-right-radius:5px;border-bottom-right-radius:5px;border-bottom-left-radius:5px;box-shadow:0px 0px 14px 0px rgba(0, 0, 0, 0.2);}.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-contents-title-wrap{padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;}.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-contents-title-wrap{color:var(--global-palette2, #2B6CB0);}.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-contents-title{color:var(--global-palette2, #2B6CB0);font-size:28px;font-weight:regular;font-style:normal;}.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-content-wrap .kb-table-of-content-list{color:var(--global-palette1, #3182CE);line-height:2em;font-weight:regular;font-style:normal;margin-top:var(--global-kb-spacing-sm, 1.5rem);margin-right:0px;margin-bottom:0px;margin-left:0px;}.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-content-wrap .kb-table-of-content-list .kb-table-of-contents__entry:hover{color:var(--global-palette6, #718096);}@media all and (max-width: 1024px){.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-content-wrap{border-top:3px solid var(--global-palette2, #2B6CB0);border-right:3px solid var(--global-palette2, #2B6CB0);border-bottom:3px solid var(--global-palette2, #2B6CB0);border-left:3px solid var(--global-palette2, #2B6CB0);}}@media all and (max-width: 1024px){.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-contents-title{font-size:28px;}}@media all and (max-width: 767px){.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-content-wrap{border-top:3px solid var(--global-palette2, #2B6CB0);border-right:3px solid var(--global-palette2, #2B6CB0);border-bottom:3px solid var(--global-palette2, #2B6CB0);border-left:3px solid var(--global-palette2, #2B6CB0);}.kb-table-of-content-nav.kb-table-of-content-id83_5f28a6-34 .kb-table-of-contents-title{font-size:28px;}}<\/style>\n\n\n<h2 class=\"wp-block-heading\">\u4ee3\u7801\u8bf4\u660e\uff1a\u7528 Python \u8fdb\u884c\u591a\u56fe\u50cf PDF \u8f6c\u6362<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u8be5\u4ee3\u7801\u4e2d\uff0c <strong><a href=\"https:\/\/python-pillow.org\/\" target=\"_blank\" rel=\"noopener\">\u6795\u5934<\/a><\/strong>\u548c <strong><a href=\"https:\/\/docs.reportlab.com\/\" data-type=\"link\" data-id=\"https:\/\/docs.reportlab.com\/\" target=\"_blank\" rel=\"noopener\">\u62a5\u544a\u5b9e\u9a8c\u5ba4<\/a><\/strong> \u4f7f\u7528\u5e93\u5c06\u591a\u4e2a\u56fe\u50cf\u81ea\u52a8\u8f6c\u6362\u4e3a PDF\u3002\u5728\u56fe\u50cf\u5904\u7406\u548c PDF \u521b\u5efa\u8fc7\u7a0b\u4e2d\uff0c\u60a8\u53ef\u4ee5\u6d4f\u89c8\u76ee\u5f55\u7ed3\u6784\uff0c\u5c06\u591a\u4e2a\u56fe\u50cf\u5355\u72ec\u8f6c\u6362\u4e3a PDF\u3002<\/p>\n\n\n<style>.kb-image2699_863a93-4f .kb-image-has-overlay:after{opacity:0.3;}.kb-image2699_863a93-4f img.kb-img, .kb-image2699_863a93-4f .kb-img img{box-shadow:0px 0px 14px 0px rgba(0, 0, 0, 0.2);}<\/style>\n<div class=\"wp-block-kadence-image kb-image2699_863a93-4f\"><figure class=\"aligncenter size-medium_large\"><img decoding=\"async\" width=\"768\" height=\"520\" src=\"https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/09\/image-7-7-768x520.jpg\" alt=\"\uc5ec\ub7ec \uc774\ubbf8\uc9c0 PDF \ubcc0\ud658 \ud3ec\uc2a4\ud2b8 \uadf8\ub9bc\" class=\"kb-img wp-image-2714\" srcset=\"https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/09\/image-7-7-768x520.jpg 768w, https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/09\/image-7-7-300x203.jpg 300w, https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/09\/image-7-7-600x406.jpg 600w, https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/09\/image-7-7.jpg 1200w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/figure><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">1. \u52a0\u8f7d\u6240\u9700\u7684 Python \u5e93<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>\u5bfc\u5165 os\n\u4ece PIL \u5bfc\u5165\u56fe\u50cf\n\u4ece reportlab.pdfgen \u5bfc\u5165 canvas\n\u4ece reportlab.lib.pagesizes \u5bfc\u5165 portrait<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u7b2c\u4e00\u6b65\u662f\u52a0\u8f7d\u5fc5\u8981\u7684\u5e93\uff0c\u5728\u672c\u4f8b\u4e2d\u662f\u52a0\u8f7d <strong>\u5965\u65af\uff0cPIL<\/strong>\"(\u300a\u4e16\u754c\u4eba\u6743\u5ba3\u8a00\u300b) <strong>\u56fe\u7247<\/strong>\u548c <strong>\u62a5\u544a\u5b9e\u9a8c\u5ba4<\/strong>\"(\u300a\u4e16\u754c\u4eba\u6743\u5ba3\u8a00\u300b) <strong>\u5e06\u5e03<\/strong> \u548c <strong>\u8096\u50cf<\/strong> \u4f7f\u7528\u9875\u9762\u5927\u5c0f\u9009\u9879\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>os<\/code>:\u6d4f\u89c8\u76ee\u5f55\u4e2d\u7684\u6587\u4ef6\u5e76\u521b\u5efa\u8def\u5f84\u3002<\/li>\n\n\n\n<li><code>\u6795\u5934 (PIL)<\/code>\u8bf4\u660e\uff1a\u6253\u5f00\u5e76\u5904\u7406\u56fe\u50cf\u6587\u4ef6\u3002<\/li>\n\n\n\n<li><code>\u62a5\u544a\u5b9e\u9a8c\u5ba4<\/code>PDF\uff1a\u521b\u5efa PDF \u6587\u4ef6\u5e76\u63d2\u5165\u56fe\u50cf\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2. \u7f16\u5199\u4e00\u4e2a\u56fe\u50cf\u5904\u7406\u51fd\u6570<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>def process_images(c, dir_path)\uff1a\n    img_list = sorted([img_name for img_name in os.listdir(dir_path) if img_name.endswith(\".png\")])\n    if img_list\uff1a\n        for img_name in img_list[1:]\uff1a\n            img_path = os.path.join(dir_path, img_name)\n            img = Image.open(img_path)\n            img_width, img_height = img.size\n            c.setPageSize((img_width, img_height))\n            c.showPage()\n            c.drawInlineImage(img_path, 0, 0, width=img_width, height=img_height)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8be5\u529f\u80fd\u662f\u5904\u7406\u56fe\u50cf\u6587\u4ef6\u5e76\u5c06\u5176\u8f6c\u6362\u4e3a PDF \u7684\u5173\u952e\u90e8\u5206\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u56fe\u50cf\u5217\u8868<\/strong>\u4ece\u7ed9\u5b9a\u76ee\u5f55\u4e2d\u53ea\u83b7\u53d6\".png \"\u6587\u4ef6\uff0c\u5e76\u5bf9\u5176\u8fdb\u884c\u6392\u5e8f\u3002<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>os.listdir(dir_path)<\/code>\u5c06\u83b7\u53d6\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\u3001 <code>if img_name.endswith(\".png\")<\/code> \u8be5\u6761\u4ef6\u53ea\u9009\u62e9 PNG \u6587\u4ef6\u3002<\/li>\n\n\n\n<li><strong>\u6253\u5f00\u56fe\u50cf\u6587\u4ef6<\/strong>\uff1a\u521b\u5efa\u56fe\u50cf\u8def\u5f84\u540e <code>\u56fe\u50cf.open()<\/code>\u6253\u5f00\u56fe\u50cf\u3002<\/li>\n\n\n\n<li><strong>\u8bbe\u7f6e\u9875\u9762\u5927\u5c0f<\/strong>: <code>setPageSize()<\/code>\u6765\u8bbe\u7f6e\u9875\u9762\u5927\u5c0f\u4ee5\u9002\u5e94\u56fe\u50cf\u5927\u5c0f\u3002<\/li>\n\n\n\n<li><strong>\u6dfb\u52a0\u56fe\u50cf<\/strong>: <code>drawInlineImage()<\/code>\u5c06\u56fe\u50cf\u63d2\u5165 PDF \u9875\u9762\u3002<\/li>\n\n\n\n<li><strong>showPage()<\/strong>:\u5b8c\u6210\u9875\u9762\u5e76\u51c6\u5907\u65b0\u9875\u9762\u3002<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">\u6b64\u8fc7\u7a0b\u53ef\u5c06\u6bcf\u4e2a PNG \u6587\u4ef6\u8f6c\u6362\u6210\u4e00\u4e2a PDF \u9875\u9762\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. \u5904\u7406\u76ee\u5f55\u5185\u7684\u5b50\u76ee\u5f55<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>def process_subdirs(main_dir, output_dir)\uff1a\n    for subdir in os.listdir(main_dir)\uff1a\n        subdir_path = os.path.join(main_dir, subdir)\n        if os.path.isdir(subdir_path)\uff1a\n            for second_subdir in os.listdir(subdir_path)\uff1a\n                second_subdir_path = os.path.join(subdir_path, second_subdir)\n                \u5982\u679c os.path.isdir(second_subdir_path)\uff1a\n                    pdf_path = os.path.join(output_dir, subdir, f\"{second_subdir}.pdf\")\n                    if not os.path.exists(pdf_path)\uff1a\n                        os.makedirs(os.path.dirname(pdf_path), exist_ok=True)\n                        c = canvas.Canvas(pdf_path, pagesize=None)\n                        process_images(c, second_subdir_path)\n                        c.save()\n                        print(f \"Generated PDF file: {pdf_path}\")<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8be5\u51fd\u6570\u8d1f\u8d23\u5904\u7406\u7ed9\u5b9a\u4e3b\u76ee\u5f55\u4e0b\u7684\u6240\u6709\u5b50\u76ee\u5f55\uff0c\u4e3a\u6bcf\u4e2a\u76ee\u5f55\u751f\u6210\u4e00\u4e2a PDF \u6587\u4ef6\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>os.listdir()<\/strong>:\u83b7\u53d6\u4e3b\u76ee\u5f55\u548c\u5b50\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\u5217\u8868\u3002<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>os.path.isdir()<\/code> \u6761\u4ef6\u6765\u68c0\u67e5\u5b83\u662f\u5426\u662f\u4e00\u4e2a\u76ee\u5f55\u3002<\/li>\n\n\n\n<li><strong>\u521b\u5efa PDF \u6587\u4ef6\u8def\u5f84<\/strong>: <code>os.path.join()<\/code>\u6765\u521b\u5efa PDF \u6587\u4ef6\u7684\u8def\u5f84\uff0c\u5e76\u4e14\u53ea\u6709\u5728 PDF \u6587\u4ef6\u4e0d\u5b58\u5728\u7684\u60c5\u51b5\u4e0b\u624d\u4f1a\u521b\u5efa\u8be5\u6587\u4ef6\u3002<\/li>\n\n\n\n<li><strong>\u521b\u5efa\u548c\u4fdd\u5b58 PDF \u6587\u4ef6<\/strong>\u65b9\u6cd5\u662f\u521b\u5efa\u4e00\u4e2a\u753b\u5e03\u5bf9\u8c61\u3001 <code>process_images()<\/code> \u51fd\u6570\u6765\u5904\u7406\u56fe\u50cf\u5e76\u4fdd\u5b58 PDF \u6587\u4ef6\u3002<\/li>\n\n\n\n<li><strong>os.makedirs()<\/strong>\u521b\u5efa\u4e00\u4e2a\u6587\u4ef6\u5939\u6765\u5b58\u50a8 PDF \u6587\u4ef6\uff08\u5982\u679c\u8fd8\u4e0d\u5b58\u5728\uff09\u3002<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">\u8be5\u529f\u80fd\u4f1a\u904d\u5386\u76ee\u5f55\u7ed3\u6784\uff0c\u5e76\u81ea\u52a8\u5c06\u6bcf\u4e2a\u5b50\u76ee\u5f55\u4e2d\u7684 PNG \u6587\u4ef6\u8f6c\u6362\u4e3a PDF\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. \u8c03\u7528\u4e3b\u51fd\u6570<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>main_dir = \"C:\\Users\\user\\Documents\\Book\"\noutput_dir = \"C:\\Users\\user\\Documents\\Book_pdf\"\nprocess_subdirs(main_dir, output_dir)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u6700\u540e\uff0c\u5728\u6307\u5b9a\u8def\u5f84\u4e0a\u8fd0\u884c PDF \u8f6c\u6362\u4efb\u52a1\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u4e3b\u76ee\u5f55<\/strong>\u4e3b\u76ee\u5f55\u7684\u8def\u5f84\uff0c\u5305\u62ec\u56fe\u50cf\u3002<\/li>\n\n\n\n<li><strong>\u8f93\u51fa\u76ee\u5f55<\/strong>\uff1a\u4fdd\u5b58 PDF \u6587\u4ef6\u7684\u8def\u5f84\u3002<\/li>\n\n\n\n<li><strong>process_subdirs()<\/strong> \u51fd\u6570\uff0c\u8be5\u51fd\u6570\u7528\u4e8e\u8f6c\u6362\u4e3b\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u56fe\u50cf\u5e76\u5c06\u5176\u4fdd\u5b58\u4e3a PDF \u6587\u4ef6\u3002<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b8c\u6574\u7684 Python \u4ee3\u7801<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>\u5bfc\u5165 os\n\u4ece PIL \u5bfc\u5165\u56fe\u50cf\n\u4ece reportlab.pdfgen \u5bfc\u5165 canvas\n\u4ece reportlab.lib.pagesizes \u5bfc\u5165 portrait\n\ndef process_images(c, dir_path)\uff1a\n    img_list = sorted([img_name for img_name in os.listdir(dir_path) if img_name.endswith(\".png\")])\n    if img_list\uff1a\n        for img_name in img_list[1:]\uff1a\n            img_path = os.path.join(dir_path, img_name)\n            img = Image.open(img_path)\n            img_width, img_height = img.size\n            c.setPageSize((img_width, img_height))\n            c.showPage()\n            c.drawInlineImage(img_path, 0, 0, width=img_width, height=img_height)\n\ndef process_subdirs(main_dir, output_dir)\uff1a\n    for subdir in os.listdir(main_dir)\uff1a\n        subdir_path = os.path.join(main_dir, subdir)\n        if os.path.isdir(subdir_path)\uff1a\n            for second_subdir in os.listdir(subdir_path)\uff1a\n                second_subdir_path = os.path.join(subdir_path, second_subdir)\n                \u5982\u679c os.path.isdir(second_subdir_path)\uff1a\n                    pdf_path = os.path.join(output_dir, subdir, f\"{second_subdir}.pdf\")\n                    if not os.path.exists(pdf_path)\uff1a  <strong># \u4ec5\u5728\u672a\u521b\u5efa PDF \u6587\u4ef6\u65f6\u8fd0\u884c<\/strong>\n                        os.makedirs(os.path.dirname(pdf_path), exist_ok=True)\n                        c = canvas.Canvas(pdf_path, pagesize=None)\n                        process_images(c, second_subdir_path)\n                        c.save()\n                        print(f \"Generated PDF file: {pdf_path}\")\n\n# \u8d77\u59cb\u70b9\nmain_dir = \"C:\\Users\\user\\Documents\\\\Book\"\noutput_dir = \"C:\\Users\\user\\Documents\\Book_pdf\"\nprocess_subdirs(main_dir, output_dir)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8be5\u4ee3\u7801\u53ef\u81ea\u52a8\u67e5\u627e\u591a\u4e2a\u76ee\u5f55\u4e2d\u7684 PNG \u56fe\u50cf\u6587\u4ef6\u5e76\u5c06\u5176\u8f6c\u6362\u4e3a PDF\u3002\u73b0\u5728\uff0c\u60a8\u4e5f\u53ef\u4ee5\u4f7f\u7528 Python \u9ad8\u6548\u5730\u5904\u7406\u591a\u4e2a\u56fe\u50cf\u5230 PDF \u7684\u8f6c\u6362\u4efb\u52a1\u4e86\uff01<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"># \u5176\u4ed6\u8bf4\u660e<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u8981\u7528 Python \u4ee3\u7801\u6765\u89e3\u91ca\u6211\u60f3\u505a\u7684\u4e8b\u60c5\uff0c\u8fd9\u53ef\u80fd\u4f1a\u589e\u52a0\u96be\u5ea6\uff0c\u6240\u4ee5\u6211\u8981\u5199\u4e00\u4e9b\u989d\u5916\u7684\u7ec6\u8282\u3002\u4f8b\u5982\uff0c\u5047\u8bbe\u6587\u4ef6\u5939 A \u4e0b\u6709 1\u30012\u30013......\u4e2a\u5b50\u6587\u4ef6\u5939\uff0c\u6587\u4ef6\u5939 B \u4e0b\u4e5f\u6709\u540c\u6837\u7684 1\u30012\u30013......\u4e2a\u5b50\u6587\u4ef6\u5939\u3002\u6587\u4ef6\u5939 A \u4e2d\u7684\u6bcf\u4e2a\u5b50\u6587\u4ef6\u5939\u90fd\u5305\u542b png \u56fe\u50cf\u6587\u4ef6\uff0c\u56e0\u6b64\u5728\u5b8c\u6210\u4e0a\u8ff0\u64cd\u4f5c\u540e\uff0c\u60a8\u5c06\u5728\u5355\u4e2a pdf \u6587\u4ef6\u4e2d\u770b\u5230\u6587\u4ef6\u5939 B \u4e2d\u7684\u591a\u4e2a\u56fe\u50cf\uff0c\u6bcf\u4e2a\u56fe\u50cf\u7684\u6587\u4ef6\u5939\u540d\u79f0\u76f8\u540c\u3002 <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f46\u662f\uff0c\u5982\u679c\u6211\u4eec\u60f3\u4e0d\u5220\u9664\u6587\u4ef6\u5939 A \u4e2d\u7684\u56fe\u7247\uff08pdf \u6587\u4ef6\u5df2\u5728\u6587\u4ef6\u5939 B \u4e2d\u521b\u5efa\uff09\uff0c\u6211\u4eec\u5c31\u9700\u8981\u7f16\u5199 Python \u4ee3\u7801\uff0c\u4ee5\u4fbf\u5728\u6267\u884c\u4e0a\u8ff0\u64cd\u4f5c\u65f6\u8df3\u8fc7\u521b\u5efa pdf \u6587\u4ef6\u7684\u6587\u4ef6\u5939 A \u7684\u5b50\u6587\u4ef6\u5939\u3002\u5728\u4e0a\u9762\u7684\u5b8c\u6574\u4ee3\u7801\u4e2d\uff0c\u60a8\u53ef\u4ee5\u770b\u5230 \"#<strong>\u4ec5\u5728\u672a\u521b\u5efa PDF \u6587\u4ef6\u65f6\u8fd0\u884c<\/strong>'\u5c31\u53ef\u4ee5\u4e86\u3002\u73b0\u5728\u4f60\u5e94\u8be5\u53ef\u4ee5\u8f7b\u677e\u5730\u5c06\u6bcf\u4e2a\u6587\u4ef6\u5939\u4e2d\u7684\u591a\u4e2a\u56fe\u50cf\u8f6c\u6362\u4e3a PDF \u4e86\u3002<\/p>","protected":false},"excerpt":{"rendered":"<p>\uc774\uc804 \ud3ec\uc2a4\ud2b8\uc5d0\uc11c \uc5ec\ub7ec \uc774\ubbf8\uc9c0 PDF \ubcc0\ud658 \ubc29\ubc95\uc744 \ud655\uc778\ud574 \ubcf4\uc168\ub098\uc694? \uc624\ub298\uc740&#8230;<\/p>","protected":false},"author":3,"featured_media":2717,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[3],"tags":[291,297,293,295,298,299],"class_list":["post-2699","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python-coding","tag-python-pdf","tag---pdf-","tag--pdf-","tag-295","tag-299"],"taxonomy_info":{"category":[{"value":3,"label":"\ud30c\uc774\uc36c(Python)"}],"post_tag":[{"value":291,"label":"Python PDF"},{"value":297,"label":"\uc5ec\ub7ec \uc774\ubbf8\uc9c0 PDF \ubcc0\ud658"},{"value":293,"label":"\uc774\ubbf8\uc9c0 PDF \ubcc0\ud658"},{"value":295,"label":"\uc774\ubbf8\uc9c0 \ucc98\ub9ac"},{"value":298,"label":"\ud30c\uc774\uc36c PDF \uc0dd\uc131"},{"value":299,"label":"\ud30c\uc774\uc36c \uc790\ub3d9\ud654"}]},"featured_image_src_large":["https:\/\/secondlife.lol\/wp-content\/uploads\/2024\/10\/\uc5ec\ub7ec-\uc774\ubbf8\uc9c0-PDF-\ubcc0\ud658-\ud3ec\uc2a4\ud2b8-\uc378\ub124\uc77c-600x600.webp",600,600,true],"author_info":{"display_name":"TERE","author_link":"https:\/\/secondlife.lol\/zh\/author\/tere\/"},"comment_info":0,"category_info":[{"term_id":3,"name":"\ud30c\uc774\uc36c(Python)","slug":"python-coding","term_group":0,"term_taxonomy_id":3,"taxonomy":"category","description":"","parent":20,"count":119,"filter":"raw","cat_ID":3,"category_count":119,"category_description":"","cat_name":"\ud30c\uc774\uc36c(Python)","category_nicename":"python-coding","category_parent":20}],"tag_info":[{"term_id":291,"name":"Python PDF","slug":"python-pdf","term_group":0,"term_taxonomy_id":290,"taxonomy":"post_tag","description":"","parent":0,"count":2,"filter":"raw"},{"term_id":297,"name":"\uc5ec\ub7ec \uc774\ubbf8\uc9c0 PDF \ubcc0\ud658","slug":"%ec%97%ac%eb%9f%ac-%ec%9d%b4%eb%af%b8%ec%a7%80-pdf-%eb%b3%80%ed%99%98","term_group":0,"term_taxonomy_id":297,"taxonomy":"post_tag","description":"","parent":0,"count":1,"filter":"raw"},{"term_id":293,"name":"\uc774\ubbf8\uc9c0 PDF \ubcc0\ud658","slug":"%ec%9d%b4%eb%af%b8%ec%a7%80-pdf-%eb%b3%80%ed%99%98","term_group":0,"term_taxonomy_id":293,"taxonomy":"post_tag","description":"","parent":0,"count":2,"filter":"raw"},{"term_id":295,"name":"\uc774\ubbf8\uc9c0 \ucc98\ub9ac","slug":"%ec%9d%b4%eb%af%b8%ec%a7%80-%ec%b2%98%eb%a6%ac","term_group":0,"term_taxonomy_id":295,"taxonomy":"post_tag","description":"","parent":0,"count":2,"filter":"raw"},{"term_id":298,"name":"\ud30c\uc774\uc36c PDF \uc0dd\uc131","slug":"%ed%8c%8c%ec%9d%b4%ec%8d%ac-pdf-%ec%83%9d%ec%84%b1","term_group":0,"term_taxonomy_id":298,"taxonomy":"post_tag","description":"","parent":0,"count":1,"filter":"raw"},{"term_id":299,"name":"\ud30c\uc774\uc36c \uc790\ub3d9\ud654","slug":"%ed%8c%8c%ec%9d%b4%ec%8d%ac-%ec%9e%90%eb%8f%99%ed%99%94","term_group":0,"term_taxonomy_id":299,"taxonomy":"post_tag","description":"","parent":0,"count":2,"filter":"raw"}],"_links":{"self":[{"href":"https:\/\/secondlife.lol\/zh\/wp-json\/wp\/v2\/posts\/2699","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/secondlife.lol\/zh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/secondlife.lol\/zh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/secondlife.lol\/zh\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/secondlife.lol\/zh\/wp-json\/wp\/v2\/comments?post=2699"}],"version-history":[{"count":6,"href":"https:\/\/secondlife.lol\/zh\/wp-json\/wp\/v2\/posts\/2699\/revisions"}],"predecessor-version":[{"id":2725,"href":"https:\/\/secondlife.lol\/zh\/wp-json\/wp\/v2\/posts\/2699\/revisions\/2725"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/secondlife.lol\/zh\/wp-json\/wp\/v2\/media\/2717"}],"wp:attachment":[{"href":"https:\/\/secondlife.lol\/zh\/wp-json\/wp\/v2\/media?parent=2699"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/secondlife.lol\/zh\/wp-json\/wp\/v2\/categories?post=2699"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/secondlife.lol\/zh\/wp-json\/wp\/v2\/tags?post=2699"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}