{"id":356546,"date":"2024-05-20T23:32:03","date_gmt":"2024-05-20T23:32:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=356546"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-05-20T23:32:03","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=356546","title":{"rendered":"<span>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 markdown \u0432 pdf \u043d\u0430 Python<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041a\u0430\u0436\u0434\u043e\u043c\u0443, \u043a\u0442\u043e \u0445\u043e\u0434\u0438\u043b \u0438\u0437\u0432\u0438\u043b\u0438\u0441\u0442\u043e\u0439 \u0442\u0440\u043e\u043f\u043a\u043e\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 pdf \u0438\u0437 markdown \u0444\u0430\u0439\u043b\u043e\u0432 \u0432\u0435\u0434\u043e\u043c\u044b \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 <s>\u043f\u0435\u043d\u044c\u043a\u0438<\/s> \u0440\u0435\u0448\u0435\u043d\u0438\u044f: Pandoc, LaTex, wkhtmltopdf \u0438 \u0442.\u043f.<\/p>\n<p>\u0425\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e\u043c \u043d\u043e\u0432\u044b\u043c (\u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u0434\u043b\u044f \u043c\u0435\u043d\u044f) \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 Python.<\/p>\n<p>\u042d\u0442\u043e\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0438\u043c\u0435\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u043b\u044e\u0441\u044b.<\/p>\n<ul>\n<li>\n<p>\u0412\u0441\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 requrments.txt, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0431\u0438\u043d\u0430\u0440\u043d\u0438\u043a\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u043a\u0438\u0440\u0438\u043b\u043b\u0438\u0446\u0435\u0439, \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430\u043c\u0438 \u0438 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u043c\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0432\u043d\u0443\u0442\u0440\u0438 \u043e\u0434\u043d\u043e\u0433\u043e pdf.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u0440\u0435\u0436\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u044f (bookmarks).<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a <a href=\"https:\/\/github.com\/executablebooks\/markdown-it-py\" rel=\"noopener noreferrer nofollow\">markdown-it-py<\/a> (md -> html) \u0438 <a href=\"https:\/\/github.com\/pymupdf\/PyMuPDF\" rel=\"noopener noreferrer nofollow\">PyMuPDF<\/a> (html -> pdf). \u0421\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u0445 \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 <a href=\"https:\/\/github.com\/vb64\/markdown-pdf\/\" rel=\"noopener noreferrer nofollow\">\u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441<\/a> Python.<\/p>\n<p>\u0421\u0442\u0430\u0432\u0438\u043c:<\/p>\n<pre><code class=\"bash\">pip install markdown-pdf<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c pdf \u0441 \u043e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c (bookmarks) \u0438\u0437 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u0434\u043e 2 \u0443\u0440\u043e\u0432\u043d\u044f.<\/p>\n<pre><code class=\"python\">from markdown_pdf import MarkdownPdf  pdf = MarkdownPdf(toc_level=2)<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 pdf \u0442\u0440\u0438 \u0441\u0435\u043a\u0446\u0438\u0438 markdown. \u041a\u0430\u0436\u0434\u0430\u044f \u0441\u0435\u043a\u0446\u0438\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u043d\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0438\u0437 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0435\u043a\u0446\u0438\u0438 \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0432 \u043e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"python\">from markdown_pdf import Section  pdf.add_section(Section(\"# Title\\n\", toc=False)) pdf.add_section(Section(\"# Head1\\n\\nbody\\n\")) pdf.add_section(Section(\"## Head2\\n\\n### Head3\\n\\n\"))<\/code><\/pre>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 pdf \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430.<\/p>\n<pre><code class=\"python\">pdf.meta[\"title\"] = \"\u0420\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\" pdf.meta[\"author\"] = \"\u0410.C.\u041f\u0443\u0448\u043a\u0438\u043d\"<\/code><\/pre>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0432 \u0444\u0430\u0439\u043b.<\/p>\n<pre><code class=\"python\">pdf.save(\"guide.pdf\")<\/code><\/pre>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/765136\/\"> https:\/\/habr.com\/ru\/articles\/765136\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041a\u0430\u0436\u0434\u043e\u043c\u0443, \u043a\u0442\u043e \u0445\u043e\u0434\u0438\u043b \u0438\u0437\u0432\u0438\u043b\u0438\u0441\u0442\u043e\u0439 \u0442\u0440\u043e\u043f\u043a\u043e\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 pdf \u0438\u0437 markdown \u0444\u0430\u0439\u043b\u043e\u0432 \u0432\u0435\u0434\u043e\u043c\u044b \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 <s>\u043f\u0435\u043d\u044c\u043a\u0438<\/s> \u0440\u0435\u0448\u0435\u043d\u0438\u044f: Pandoc, LaTex, wkhtmltopdf \u0438 \u0442.\u043f.<\/p>\n<p>\u0425\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e\u043c \u043d\u043e\u0432\u044b\u043c (\u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u0434\u043b\u044f \u043c\u0435\u043d\u044f) \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 Python.<\/p>\n<p>\u042d\u0442\u043e\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0438\u043c\u0435\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u043b\u044e\u0441\u044b.<\/p>\n<ul>\n<li>\n<p>\u0412\u0441\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 requrments.txt, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0431\u0438\u043d\u0430\u0440\u043d\u0438\u043a\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u043a\u0438\u0440\u0438\u043b\u043b\u0438\u0446\u0435\u0439, \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430\u043c\u0438 \u0438 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u043c\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0432\u043d\u0443\u0442\u0440\u0438 \u043e\u0434\u043d\u043e\u0433\u043e pdf.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u0440\u0435\u0436\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u044f (bookmarks).<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a <a href=\"https:\/\/github.com\/executablebooks\/markdown-it-py\" rel=\"noopener noreferrer nofollow\">markdown-it-py<\/a> (md -> html) \u0438 <a href=\"https:\/\/github.com\/pymupdf\/PyMuPDF\" rel=\"noopener noreferrer nofollow\">PyMuPDF<\/a> (html -> pdf). \u0421\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u0445 \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 <a href=\"https:\/\/github.com\/vb64\/markdown-pdf\/\" rel=\"noopener noreferrer nofollow\">\u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441<\/a> Python.<\/p>\n<p>\u0421\u0442\u0430\u0432\u0438\u043c:<\/p>\n<pre><code class=\"bash\">pip install markdown-pdf<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c pdf \u0441 \u043e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c (bookmarks) \u0438\u0437 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u0434\u043e 2 \u0443\u0440\u043e\u0432\u043d\u044f.<\/p>\n<pre><code class=\"python\">from markdown_pdf import MarkdownPdf  pdf = MarkdownPdf(toc_level=2)<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 pdf \u0442\u0440\u0438 \u0441\u0435\u043a\u0446\u0438\u0438 markdown. \u041a\u0430\u0436\u0434\u0430\u044f \u0441\u0435\u043a\u0446\u0438\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u043d\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0438\u0437 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0435\u043a\u0446\u0438\u0438 \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0432 \u043e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u0435.<\/p>\n<pre><code class=\"python\">from markdown_pdf import Section  pdf.add_section(Section(\"# Title\\n\", toc=False)) pdf.add_section(Section(\"# Head1\\n\\nbody\\n\")) pdf.add_section(Section(\"## Head2\\n\\n### Head3\\n\\n\"))<\/code><\/pre>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 pdf \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430.<\/p>\n<pre><code class=\"python\">pdf.meta[\"title\"] = \"\u0420\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\" pdf.meta[\"author\"] = \"\u0410.C.\u041f\u0443\u0448\u043a\u0438\u043d\"<\/code><\/pre>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0432 \u0444\u0430\u0439\u043b.<\/p>\n<pre><code class=\"python\">pdf.save(\"guide.pdf\")<\/code><\/pre>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/765136\/\"> https:\/\/habr.com\/ru\/articles\/765136\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-356546","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/356546","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=356546"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/356546\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=356546"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=356546"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=356546"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}