{"id":418975,"date":"2021-03-21T00:43:11","date_gmt":"2021-03-20T16:43:11","guid":{"rendered":"http:\/\/4563.org\/?p=418975"},"modified":"2021-03-21T00:43:11","modified_gmt":"2021-03-20T16:43:11","slug":"%e5%92%a8%e8%af%a2%e4%b8%80%e4%b8%8b%e5%85%b3%e4%ba%8e-python-%e6%89%93%e5%8d%b0-pdf-%e7%9a%84%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=418975","title":{"rendered":"\u54a8\u8be2\u4e00\u4e0b\u5173\u4e8e Python \u6253\u5370 pdf \u7684\u95ee\u9898"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u54a8\u8be2\u4e00\u4e0b\u5173\u4e8e Python \u6253\u5370 pdf \u7684\u95ee\u9898               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : evilic <\/span>  <span><i><\/i> 3<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u5404\u4f4d\u5e2e\u5e2e\u5fd9\uff0c\u5b9e\u5728\u662f\u6ca1\u6709\u601d\u8def\u4e86\u2026\u2026<\/p>\n<p>\u95ee\u9898\u662f\u8fd9\u6837\u7684\uff0c\u6211\u6709\u4e00\u4e2a\u70ed\u654f\u6253\u5370\u673a\uff0c\u6253\u5370\u8ba2\u5355\u7528\u7684\u3002\u7528\u7684\u662f cainiao \u7684\u6253\u5370\u7ec4\u4ef6\u3002\u76f4\u63a5\u7528\u70ed\u654f\u6253\u5370\u673a\u6253\u5355\u80af\u5b9a\u662f\u6ca1\u6709\u95ee\u9898\u7684\u3002 \u73b0\u5728\u6709\u4e00\u4e2a\u9700\u6c42\uff0c\u5c31\u662f\u8981\u628a\u8ba2\u5355\u7ed9\u5206\u7c7b\u6392\u5e8f\uff0c\u8ba9\u4ed3\u5e93\u597d\u5206\u62e3\u4e00\u4e9b\uff0c\u628a\u540c\u4e00\u7c7b\u5546\u54c1\u7684\u5355\u5b50\u5728\u51fa\u5355\u7684\u65f6\u5019\u653e\u5728\u4e00\u8d77\u3002\u4e0d\u8fc7\u5355\u5b50\u5728\u5f55\u5165\u7684\u65f6\u5019\u5374\u662f\u6709\u5148\u540e\u987a\u5e8f\u7684\u3002 \u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u7684\u60f3\u6cd5\u662f\uff0c\u5148\u7528 cainiao \u628a\u5355\u5b50\u6253\u5230 pdf \u4e2d\u53bb\uff0c\u7136\u540e\u518d\u7a0b\u5e8f\u6392\u5e8f\u540e\uff0c\u6309\u5206\u7c7b\u540e\u7684\u6b63\u786e\u987a\u5e8f\uff0c\u628a pdf \u5bf9\u5e94\u7684\u9875\u9762\u53d1\u9001\u5230\u6253\u5370\u673a\u6253\u5370\u2014\u2014\u5982\u679c\u539f\u6765 pdf \u6587\u4ef6\u4e2d\u7684\u987a\u5e8f\u662f[1,2,3&#8230;]\uff0c\u53ef\u80fd\u7a0b\u5e8f\u6700\u7ec8\u5904\u7406\u7684\u7ed3\u679c\u662f\u53d1\u9001\u7ed9\u6253\u5370\u673a[2,1,3]&#8230;<\/p>\n<p>\u6211\u67e5\u627e\u89e3\u51b3\u65b9\u6848\uff0c\u8d70\u7684\u8def\u5176\u5b9e\u548c https:\/\/stackoverflow.com\/questions\/27195594\/python-silent-print-pdf-to-specific-printer \u5e16\u5b50\u91cc\u7684\u5dee\u4e0d\u591a\u3002 \u9996\u5148\u662f AcroRD32 \u603b\u662f\u542f\u52a8\uff0c\u7136\u540e\u770b\u5230\u5e16\u5b50\u91cc\u9762\u8bf4\u7684 ghostscript\uff0c\u5c31\u5f00\u59cb\u6539\u7528 ghostscript \u8fdb\u884c\u5c1d\u8bd5\uff08\u4e0d\u662f gsprint \uff09\u3002<\/p>\n<pre><code>gswin64c.exe -sDEVICE=mswinpr2 -sOutputFile=\"%printer%Deli DL-888B\" \"test.pdf\" <\/code><\/pre>\n<p>\u679c\u771f\u5355\u5b50\u662f\u80fd\u6253\u51fa\u6765\u7684\u2026\u2026\u4f46\u53e6\u5916\u7684\u95ee\u9898\u4ea7\u751f\u4e86\uff0cpdf \u7684\u5927\u5c0f\u662f A4 \u7684\u5927\u5c0f\uff0c\u70ed\u654f\u7eb8\u7684\u5927\u5c0f\u662f 76x130mm \u7684\uff0c\u4e8e\u662f\uff0c\u6253\u5370 pdf \u4e2d\u7684\u4e00\u9875\uff0c\u4f1a\u51fa 3 \u5f20\u70ed\u654f\u7eb8\uff0c\u5176\u4e2d\u7b2c 2\uff0c3 \u9875\u662f\u7a7a\u767d\u7684\u3002 \u67e5\u6587\u6863\uff0c\u770b\u6587\u7ae0 https:\/\/www.ghostscript.com\/doc\/current\/Use.htm \uff0c\u52a0\u4e0a -dDEVICEWIDTHPOINTS=w -dDEVICEHEIGHTPOINTS=h -dFIXEDMEDIA \u53c2\u6570\uff0c\u5404\u79cd\u8c03\u6574\uff0c\u6253\u5370\u51fa\u6765\u7684\u4e1c\u897f\u8981\u4e48\u662f\u53ea\u6709\u4e00\u5f20\u7eb8\u4e14\u662f\u7a7a\u767d\uff0c\u8981\u4e48\u662f\u4e00\u5f20\u7eb8\u4f46\u5b57\u513f\u662f\u7f29\u5c0f\u540e\u7684\uff0c\u8981\u4e48\u8fd8\u662f\u4e00\u4e0b\u51fa 3 \u5f20\u7eb8\u4e14\u8fd8\u662f\u7f29\u5c0f\u7684\u3002\uff08\u6253\u5370\u51fa\u6765\u7684\u6548\u679c\u5176\u5b9e\u5c31\u548c adobe reader \u9884\u89c8\u91cc\u7684\u4e00\u6837\uff0c\u4e0d\u80fd\u8dd1\u5230\u5de6\u4e0a\u89d2\uff09<\/p>\n<p>\u7ee7\u7eed\u67e5\u89e3\u51b3\u65b9\u6cd5\uff0chttps:\/\/stackoverflow.com\/questions\/3447720\/how-can-i-shift-page-images-in-pdf-files-more-to-the-left-or-to-the-right \uff0c\u77e5\u9053 ghostscript \u53ef\u4ee5\u8bbe\u7f6e PageOffset\uff0c\u4e0d\u77e5\u9053\u6211\u7406\u89e3\u7684\u5bf9\u4e0d\u5bf9\uff0c\u603b\u662f\u8bbe\u7f6e\u65e0\u679c\uff0c\u62a5\u9519\u3002<\/p>\n<p>\u7531\u4e8e chrome \u6216\u8005 edge \u4e2d\u7684\u6253\u5370\u662f\u6b63\u786e\u7684\uff08\u65e0\u8bba\u4e00\u4e2a pdf \u539f\u672c\u662f\u591a\u5927\uff0c\u603b\u662f\u4ece\u5de6\u4e0a\u6253\u5370\u5230\u4e00\u5f20\u7eb8\u4e0a\u540e\u8f6c\u5165\u4e0b\u4e00\u9875\u7684\u6253\u5370\uff09\uff0c\u4e8e\u662f\u6211\u60f3\u7740\u6709\u6ca1\u6709 headless \u7684\u5904\u7406\u529e\u6cd5\uff0c\u6216\u8005\u547d\u4ee4\u7684\u5904\u7406\u65b9\u6cd5\uff0c\u4f46\u662f\u641c\u7d22\u65e0\u679c\u3002<\/p>\n<p>\u81f3\u6b64\uff0c\u65b9\u6cd5\u7a77\u4e86\uff0c\u6765\u8fd9\u91cc\u6765\u4e86\u3002 \u6c42\u5404\u4f4d\u7ed9\u6307\u4e2a\u65b9\u5411\u5427\u3002\u8c22\u8c22\u4e86<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>13<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5591334\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : evilic <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8865\u5145\u4e00\u4e0b\uff0c\u6211\u4e4b\u6240\u4ee5\u4e0d\u5148\u6392\u5e8f\uff0c\u518d\u6253\u5355\u7684\u539f\u56e0\u662f\u6015\u6253\u4e71\u4e86\u987a\u5e8f\u4e0d\u597d\u53d1\u8d27\u2026\u2026<br \/>\u5982\u679c\u5927\u5bb6\u90fd\u6ca1\u6709\u4ec0\u4e48\u597d\u7684\u601d\u8def\u7684\u8bdd\uff0c\u6211\u8fd8\u662f\u5148\u6392\u5e8f\u518d\u6253\u5355\u5427\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5591335\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : hs0000t <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6ca1\u7528\u8fc7\u70ed\u654f\u6253\u5370\u673a\uff0c\u5e2e\u9876                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5591336\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ye4tar <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5148\u67e5\u6253\u5370\u673a\u6587\u6863\uff0c\u770b\u4ed6\u652f\u6301\u7684\u7eb8\u5f20\u5c3a\u5bf8\uff0c\u63a5\u7740\u4fdd\u5b58 pdf \u7684\u65f6\u5019\u5c31\u8981\u8bbe\u5b9a\u597d\u51fa\u591a\u3002\u7136\u540e\u6309\u7167\u4f60\u65e2\u5b9a\u7684\u65b9\u6cd5\u8d70                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5591337\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : evilic <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @hs0000t \u8c22\u8c22                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5591338\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : evilic <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @ye4tar \u8fd9\u4e2a pdf \u662f\u7531 cainiao \u7ec4\u4ef6\u76f4\u63a5\u51fa\u7684\uff0ca4 \u7eb8\u5927\u5c0f\uff0c\u6211\u65e0\u6cd5\u8c03\u6574\u2026\u2026\u2026\u2026                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5591339\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : cctrv <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             https:\/\/pypi.org\/project\/cainiao\/<\/p>\n<p>\u81ea\u5df1\u7d44\u7e54\u6578\u64da\u53bb\u6253\u5370\u4e0d\u5c31\u6c92\u6709 A4 \u90a3\u500b\u554f\u984c\u55ce\uff1f                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5591340\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : encro <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u521d\u7565\u770b\u4e86\u4e0b\u8fd9\u4e2a\u7ec4\u4ef6\uff0c\u4e0d\u662f\u6709\u6a21\u677f\u5417\uff1f\u6700\u591a\u4fee\u6539\u6216\u8005\u81ea\u5b9a\u4e49\u4e00\u4e2a\u6a21\u677f\u5c31\u884c\u4e86\u5427\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5591341\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : encro <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u66fe\u7ecf\u7528\u8fc7\u5feb\u9012\u9e1f\uff0c\u4e5f\u53ef\u4ee5\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5591342\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ScoutWang <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u628a pdf \u8f6c\u6210 jpg\uff0c\u518d\u8c03\u6574\u4e3a\u70ed\u654f\u7eb8\u7684\u5927\u5c0f\uff0c\u518d\u9001\u5165\u6253\u5370\u673a\u6253\u5370                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5591343\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : evilic <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @cctrv \u4e07\u5206\u611f\u8c22\uff01                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5591344\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : evilic <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @encro \u4e0d\u662f\u8fd9\u6837\u7684\u2026\u2026\u6a21\u677f\u662f\u53ef\u4ee5\u8c03\u6574\u7684\uff0c\u4f46\u662f\u6253\u5370\u5230 pdf \u4e2d\u7684\u8bdd\uff0cpdf \u7684\u9875\u9762\u603b\u662f a4 \u7eb8\u7684\u3002\u53ea\u662f a4 \u7eb8\u4e0a\u7684\u5185\u5bb9\uff0c\u662f\u4f60\u8bbe\u7f6e\u7684\u5927\u5c0f\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5591345\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : evilic <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @ScoutWang \u6069\u5450\uff0c\u8fd9\u4e2a\u786e\u5b9e\u5e94\u8be5\u4e5f\u662f\u53ef\u884c\u7684\u3002\u6211\u51c6\u5907\u5148\u8bd5\u8bd5\u4e0a\u7684\u65b9\u6cd5\uff0c\u76f4\u63a5\u4e0a cainiao \u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5591346\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : encro <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5176\u5b9e\u6211\u89c9\u5f97\u6ca1\u6709\u5fc5\u8981\u8fd9\u4e48\u9ebb\u70e6\uff0c\u5148\u585e\u5165\u961f\u5217 1\uff0c\u7136\u540e\u6392\u5e8f\u52a0\u5165\u961f\u5217 2\uff0c\u7136\u540e\u53d6\u51fa\u961f\u5217 2 \u6709\u5e8f\u6587\u4ef6\uff0c\u53d1\u9001\u7ed9\u6253\u5370\u673a\u3002<\/p>\n<p>\u6ca1\u5fc5\u8981\u8f6c PDF\uff0c\u867d\u7136\u6211\u77e5\u9053\u6539 pdf \u9875\u9762\u5c3a\u5bf8\u7684\u4e00\u5806\u65b9\u6cd5\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u54a8\u8be2\u4e00\u4e0b\u5173\u4e8e Python \u6253\u5370 &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/418975"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=418975"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/418975\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=418975"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=418975"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=418975"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}