Package: python-xdoc
XDocThis tool is for converting various document formats to PDF format. Generate PDF documents from files such as Markdown, HTML, and CSS by combining them.Key FeaturesGenerate PDFs by combining Markdown, HTML, and CSS.Add custom headers and footers.User-friendly Gradio web interface.Getting started# Installpipinstallpython-xdoc

xdoc-iinput_*.md-ooutput_file.pdf# CLI: Convert markdowns to PDFxdoc--webui# Web UIxdoc--helpUsage:[Examples]Generate:Fromlocalfile:xdoc-iin_*.html--verboseFromremotefile:setgisthttps://gist.githubusercontent.com/.../gistfile.mdxdoc-i$gistStyling:xdoc-iin_*.html--scale0.8--css' h1 { color: red }'--margin'top bottom 50mm left right 20mm'LoadConfig:xdoc--configconfig.yamlModify:Extractpages:xdoc-iin.pdf--extract2-3metaxdoc-iin.md--meta'/Title Untitled'Encrypt/Decrypto:xdoc-idemo.pdf-odemo.encrypted.pdf--encrypto--autogenxdoc-idemo.encrypted.pdf-odemo.decrypted.pdf--decryptoShare:python-i$gist-oout.pdf--sharemega[Units]Youcanusethefollowingunitsforwidth,height,andmarginoptions:-px(pixels)-Defaultunit.,in(inches).,cm(centimeters).,mm(millimeters).[Formats]Thefollowingpaperformatsareavailablefortheformatoption:-Letter,Legal,Tabloid,Ledger,A0,A1,A2,A3,A4(default),A5[PDFmeta]metaformat:"/Key Value"pairsseparatedbyspace.-/Title,/Author,/Subject,/Author,/Keyword,/Creator,/Producer,/CreateDate,/ModDate,/TrappedGeneratePDFfromHTMLpages.

options:-h,--helpshowthishelpmessageandexit-iINPUT[INPUT...],--inputINPUT[INPUT...]Inputfiles.-oOUTPUT[OUTPUT...],--outputOUTPUT[OUTPUT...]Outputfilepath.--scaleSCALEScaleoftheprintedpage|0.8for80percent.--displayHeaderFooterDisplayheaderandfooter.--headerTemplateHEADERTEMPLATEAddheadertemplateas[url|path|content].--footerTemplateFOOTERTEMPLATEAddfootertemplateas[url|path|content].--printBackgroundPrintbackgroundimages.--landscapeUselandscapepaperorientation.--pageRangesPAGERANGESPagerangestoprint|'1-5,8,11-13'.--formatFORMATPaperformat|'A4'.--widthWIDTHPaperwidth|'10cm'.--heightHEIGHTPaperheight|'10mm'.--marginMARGINMarginvalues(e.g.,'top 10mm right 10mm')--cssCSSAddcssas[url|path|content]--configCONFIGPathtotheconfigfile.--emulateMedia{screen,print}Typeofemulatemedia.--qrQRAddQRafterlink.--mergeMERGE[MERGE...]MergePDFfilesintoanoutputfile--extractEXTRACTExtractpagesfromaPDFfile(e.g.,'1-3')--splitSplitaPDFfileatspecifiedpages--extract-textExtracttextfromaPDFfile--redact-textREDACT_TEXT[REDACT_TEXT...]RedacttextinthePDFfiles--metaMETAAddmetaintheformat'/Key: Value'.Example:'/TitleDocument'--remove-metaRemovemetafromaPDFfile--select-metaSELECT_META[SELECT_META...]Selectivelyremovemetafields--verbosePrintparameterswhenverbose.--encryptoEncryptPDFfile.--autogenAutomaticallygeneratepasswordforencryption.--decryptoDecryptPDFfile.--regenRegenerateandsendrecoverykeyfordecryption.--webui[WIP]LaunchGradiowebUI.--share{mega,google_drive,slideshare}SpecifythecloudservicetouseforsharingLicenseThis project is provided under the MIT License. See the LICENSE file for details.SupportFor inquiries regarding support, including questions and bug reports, please use GitHub Issues.See alsoThere are other similar projects that you may be interested in:single-file-cli- Convert a web page to a single file.monolith- Save web pages as a single HTML file.markdown-pdf- Convert markdown to PDF with HTML and CSS.