Popular recipes tagged "pdf" but not "mupdf" and "files"http://code.activestate.com/recipes/tags/pdf-mupdf-files/2016-11-17T15:01:12-08:00ActiveState Code RecipesConvert Microsot Excel (XLSX) to PDF with Python and xtopdf (Python) 2015-11-22T22:15:25-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/579128-convert-microsot-excel-xlsx-to-pdf-with-python-and/ <p style="color: grey"> Python recipe 579128 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/excel/">excel</a>, <a href="/recipes/tags/formats/">formats</a>, <a href="/recipes/tags/openpyxl/">openpyxl</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/xlsx/">xlsx</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>). </p> <p>This recipe shows how the basics of to convert the text data in a Microsoft Excel file (XLSX format) to PDF (Portable Document Format). It uses openpyxl to read the XLSX file and xtopdf to generate the PDF file.</p> Extract images of a PDF - optionally by page using PyMuPDF / fitz (Python) 2016-09-28T12:03:59-07:00Jorj X. McKiehttp://code.activestate.com/recipes/users/4193772/http://code.activestate.com/recipes/580703-extract-images-of-a-pdf-optionally-by-page-using-p/ <p style="color: grey"> Python recipe 580703 by <a href="/recipes/users/4193772/">Jorj X. McKie</a> (<a href="/recipes/tags/fitz/">fitz</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/png/">png</a>). </p> <p>Two small scripts to extract images contained in a PDF document as PNG files. (1) Script 1 extracts <strong>all</strong> images (2) Script 2 extracts only images that are referenced by a page</p> Put Peewee ORM data to PDF with xtopdf (Python) 2016-09-29T18:04:57-07:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/580704-put-peewee-orm-data-to-pdf-with-xtopdf/ <p style="color: grey"> Python recipe 580704 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/conversion/">conversion</a>, <a href="/recipes/tags/converter/">converter</a>, <a href="/recipes/tags/database/">database</a>, <a href="/recipes/tags/formats/">formats</a>, <a href="/recipes/tags/orm/">orm</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/pdf_generation/">pdf_generation</a>, <a href="/recipes/tags/peewee/">peewee</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/python2/">python2</a>, <a href="/recipes/tags/sqlite/">sqlite</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>). </p> <p>This recipe shows how some basics of how to fetch data from database tables managed by the Peewee ORM (a lightweight expressive ORM for Python) and write that data, formatted, to a PDF file. The recipe uses Python, the Peewee ORM and the xtopdf toolkit for PDF creation.</p> Convert from Html To Pdf in ASP.NET MVC C# with SelectPdf Free Community Edition (C++) 2016-11-17T15:01:12-08:00SelectPdfhttp://code.activestate.com/recipes/users/4193129/http://code.activestate.com/recipes/580719-convert-from-html-to-pdf-in-aspnet-mvc-c-with-sele/ <p style="color: grey"> C++ recipe 580719 by <a href="/recipes/users/4193129/">SelectPdf</a> (<a href="/recipes/tags/aspnet/">aspnet</a>, <a href="/recipes/tags/mvc/">mvc</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/selectpdf/">selectpdf</a>). </p> <p>It’s very easy to use SelectPdf SDK for .NET in ASP.NET MVC applications. Take a look at the simple code below.</p> Simple PDF Bookmark / Table of Contents Maintenance (Python) 2016-06-20T18:14:38-07:00Jorj X. McKiehttp://code.activestate.com/recipes/users/4193772/http://code.activestate.com/recipes/580684-simple-pdf-bookmark-table-of-contents-maintenance/ <p style="color: grey"> Python recipe 580684 by <a href="/recipes/users/4193772/">Jorj X. McKie</a> (<a href="/recipes/tags/bookmarks/">bookmarks</a>, <a href="/recipes/tags/fitz/">fitz</a>, <a href="/recipes/tags/incremental/">incremental</a>, <a href="/recipes/tags/metadata/">metadata</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/pymupdf/">pymupdf</a>). </p> <p>PyMuPDF now supports a simple interface for maintaining table of contents / bookmarks and metadata for PDF documents. By manipulating ordinary, elementary lists and dictionaries you can add, delete, modify a PDF's metadata and table of contents.</p> Decrypt a PDF using fitz / MuPDF (PyMuPDF) (Python) 2016-03-17T12:22:10-07:00Harald Liederhttp://code.activestate.com/recipes/users/4191581/http://code.activestate.com/recipes/580627-decrypt-a-pdf-using-fitz-mupdf-pymupdf/ <p style="color: grey"> Python recipe 580627 by <a href="/recipes/users/4191581/">Harald Lieder</a> (<a href="/recipes/tags/decompression/">decompression</a>, <a href="/recipes/tags/decryption/">decryption</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/repair/">repair</a>). </p> <p>It's more a code snippet. Shows how to dynamically check whether a PDF is password protected. If it is, decrypt it and save it back to disk un-encrypted.</p> Publish a Windows Process List to PDF with xtopdf (Batch) 2015-12-27T20:45:32-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/579142-publish-a-windows-process-list-to-pdf-with-xtopdf/ <p style="color: grey"> Batch recipe 579142 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/pdfwriter/">pdfwriter</a>, <a href="/recipes/tags/pdf_generation/">pdf_generation</a>, <a href="/recipes/tags/processes/">processes</a>, <a href="/recipes/tags/process_management/">process_management</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/windows/">windows</a>). </p> <p>This recipe shows how you can generate a Windows process list or task list (basically, a list of running processes, with some information about each of them), to a PDF file, using the Windows TASKLIST command along with the xtopdf toolkit. The list is sorted in ascending order of memory usage of the processes, before writing it to PDF.</p> <p>It differs somewhat from other xtopdf recipes, in that no additional code needs to be written, over and above what is already in the xtopdf package. We just have to use the needed commands there, in a series of commands or a pipeline.</p> <p>However, one can still write additional code, by modifying the program used (StdinToPDF.py), if needed, to customize the PDF output.</p> Create PDF control break reports with itertools.groupby and xtopdf (Python) 2016-07-23T22:17:29-07:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/580692-create-pdf-control-break-reports-with-itertoolsgro/ <p style="color: grey"> Python recipe 580692 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/control/">control</a>, <a href="/recipes/tags/database/">database</a>, <a href="/recipes/tags/grouping/">grouping</a>, <a href="/recipes/tags/iterators/">iterators</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/pdfwriter/">pdfwriter</a>, <a href="/recipes/tags/pdf_generation/">pdf_generation</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/reportgeneration/">reportgeneration</a>, <a href="/recipes/tags/reporting/">reporting</a>, <a href="/recipes/tags/sql/">sql</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>). </p> <p>This recipe shows how to create the classic control break style of report (a staple of data processing) using Python along with the groupby function from the itertools module, and xtopdf, a Python toolkit for PDF creation.</p> Find all fonts used in a PDF document by page (Python) 2016-08-26T00:02:48-07:00Jorj X. McKiehttp://code.activestate.com/recipes/users/4193772/http://code.activestate.com/recipes/580651-find-all-fonts-used-in-a-pdf-document-by-page/ <p style="color: grey"> Python recipe 580651 by <a href="/recipes/users/4193772/">Jorj X. McKie</a> (<a href="/recipes/tags/pdf/">pdf</a>). Revision 3. </p> <p>Finds all fonts used in a PDF document by page. This new script is based on PyMuDF v1.9.2 and works for PDF files only. However, it is a lot simpler, speed has drastically improved and there is no dependency on other packages any more.</p> PDF Joiner / Splitter using wxPython, PyMuPDF (fitz / MuPDF) (Python) 2016-03-15T19:07:35-07:00Harald Liederhttp://code.activestate.com/recipes/users/4191581/http://code.activestate.com/recipes/580622-pdf-joiner-splitter-using-wxpython-pymupdf-fitz-mu/ <p style="color: grey"> Python recipe 580622 by <a href="/recipes/users/4191581/">Harald Lieder</a> (<a href="/recipes/tags/join/">join</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/split/">split</a>). </p> <p>Full featured PDF joiner. Join several PDF files into one output PDF. Page ranges can be specified as well as page orientation for each output page range. Tables of contents are intelligently preserved for each page range (can also be switched off). Output PDF metadata editable.</p> Python-controlled Unix pipeline to generate PDF (Python) 2016-01-07T18:02:52-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/579146-python-controlled-unix-pipeline-to-generate-pdf/ <p style="color: grey"> Python recipe 579146 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/pdf_generation/">pdf_generation</a>, <a href="/recipes/tags/pipe/">pipe</a>, <a href="/recipes/tags/pipelining/">pipelining</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/python2/">python2</a>, <a href="/recipes/tags/unix/">unix</a>). </p> <p>This recipe shows how to create a Unix pipeline that generates PDF output, under the control of a Python program. It is tested on Linux. It uses nl, a standard Linux command that adds line numbers to its input, and selpg, a custom Linux command-line utility, that selects only specified pages from its input, together in a pipeline (nl | selpg). The Python program sets up and starts that pipeline running, and then reads input from it and generates PDF output.</p> How to use Python to convert a web page to PDF with a POST request to SelectPdf Online API and save it on the disk (Python) 2015-11-16T14:52:17-08:00SelectPdfhttp://code.activestate.com/recipes/users/4193129/http://code.activestate.com/recipes/579126-how-to-use-python-to-convert-a-web-page-to-pdf-wit/ <p style="color: grey"> Python recipe 579126 by <a href="/recipes/users/4193129/">SelectPdf</a> (<a href="/recipes/tags/api/">api</a>, <a href="/recipes/tags/converter/">converter</a>, <a href="/recipes/tags/htmltopdf/">htmltopdf</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/selectpdf/">selectpdf</a>). </p> <p>This code converts an url to pdf in Python using SelectPdf HTML To PDF REST API through a POST request. The parameters are JSON encoded. The content is saved into a file on the disk.</p> Generate a PDF invoice with xtopdf and Python (Python) 2015-10-07T18:02:46-07:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/579108-generate-a-pdf-invoice-with-xtopdf-and-python/ <p style="color: grey"> Python recipe 579108 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/pdfwriter/">pdfwriter</a>, <a href="/recipes/tags/pdf_generation/">pdf_generation</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/python2/">python2</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>). </p> <p>This recipe shows the basics of how to generate invoices as PDF documents, using xtopdf, a Python toolkit for PDF creation. An example of creating a simple invoice through Python and xtopdf code is shown. </p> <p>xtopdf is available on Bitbucket at:</p> <p><a href="https://bitbucket.org/vasudevram/xtopdf" rel="nofollow">https://bitbucket.org/vasudevram/xtopdf</a></p> <p>and you can find many links with examples of using xtopdf, how to install it, etc., from this Google search:</p> <p><a href="https://google.com/search?q=xtopdf" rel="nofollow">https://google.com/search?q=xtopdf</a></p> <p>This sub-feed of my blog:</p> <p><a href="http://jugad2.blogspot.com/search/label/xtopdf" rel="nofollow">http://jugad2.blogspot.com/search/label/xtopdf</a></p> <p>gives access to all my blog posts labelled xtopdf.</p> Roll your own Postscript code from scratch (Python) 2015-12-09T23:30:13-08:00Jack Trainorhttp://code.activestate.com/recipes/users/4076953/http://code.activestate.com/recipes/579136-roll-your-own-postscript-code-from-scratch/ <p style="color: grey"> Python recipe 579136 by <a href="/recipes/users/4076953/">Jack Trainor</a> (<a href="/recipes/tags/ghostscript/">ghostscript</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/postscript/">postscript</a>, <a href="/recipes/tags/ps/">ps</a>). </p> <p>This recipe provides a mini-framework for creating custom Postscript PS and PDF files from scratch. It includes sample code for a personalized business index card.</p> <p>Recipe does not use any Python PDF libraries. However, Ghostscript and a PDF viewer are useful for displaying/debugging output.</p> <p>It's easier than you might think to roll your own Postscript code!</p> Printing an ASCII table to PDF (Python) 2015-04-02T18:38:04-07:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/579043-printing-an-ascii-table-to-pdf/ <p style="color: grey"> Python recipe 579043 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/ascii/">ascii</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/pdf_generation/">pdf_generation</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>). </p> <p>This recipe shows how to print part of an ASCII table to PDF. It shows it for the first 32 ASCII characters, the control characters, i.e. the characters with ASCII codes 0 to 31. The same logic can be extended to print the remaining ASCII characters, either upto code 127 or 255, depending on your definition of ASCII, and also on whether your PDF font supports printing all those characters.</p> Convert HTML text to PDF with Beautiful Soup and xtopdf (Python) 2015-01-28T22:20:53-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/579014-convert-html-text-to-pdf-with-beautiful-soup-and-x/ <p style="color: grey"> Python recipe 579014 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/file/">file</a>, <a href="/recipes/tags/format/">format</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/pdfwriter/">pdfwriter</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/reportgeneration/">reportgeneration</a>, <a href="/recipes/tags/reporting/">reporting</a>, <a href="/recipes/tags/reportlab/">reportlab</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>). </p> <p>This recipe shows how to convert the text in an HTML document to PDF. It uses the Beautiful Soup and xtopdf Python libraries. Beautiful Soup is a library for HTML parsing and content extraction. xtopdf is a library for PDF creation from other formats, including text and many others.</p> Publish SQLite data to PDF using named tuples (Python) 2015-02-24T22:08:11-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/579027-publish-sqlite-data-to-pdf-using-named-tuples/ <p style="color: grey"> Python recipe 579027 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/conversion/">conversion</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/pdfwriter/">pdfwriter</a>, <a href="/recipes/tags/sql/">sql</a>, <a href="/recipes/tags/sqlite/">sqlite</a>, <a href="/recipes/tags/sqlite3/">sqlite3</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>). </p> <p>This recipe shows how to publish SQLite data to PDF, using named tuples from the collections module of Python, the sqlite3 library, and the xtopdf library for PDF generation.</p> Publish databases to PDF with PyDAL (a Python DB library) and xtopdf (Python) 2015-01-15T16:09:27-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/579004-publish-databases-to-pdf-with-pydal-a-python-db-li/ <p style="color: grey"> Python recipe 579004 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/database/">database</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/pydal/">pydal</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/python_developer_tools/">python_developer_tools</a>, <a href="/recipes/tags/sql/">sql</a>, <a href="/recipes/tags/web2py/">web2py</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>). </p> <p>This recipe shows how to use the PyDAL database library for Python, together with xtopdf, a PDF creation library for Python, to publish database data to PDF. PyDAL was earlier a part of the web2py Python web framework, and then was split out into a separate library that does not need to be used with web2py. It supports access to many popular relational databases, both open source and proprietary.</p> Convert Excel to PDF with xlwings and xtopdf (Python) 2015-02-22T10:42:18-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/579026-convert-excel-to-pdf-with-xlwings-and-xtopdf/ <p style="color: grey"> Python recipe 579026 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/excel/">excel</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/pdfwriter/">pdfwriter</a>, <a href="/recipes/tags/reportlab/">reportlab</a>, <a href="/recipes/tags/xlwings/">xlwings</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>). </p> <p>This recipe shows how to get the text content from an Excel file and convert it to PDF, using the xlwings and xtopdf Python libraries. It also shows how to create an Excel file programmatically using xlwings.</p> Use PrettyTable and xtopdf to create PDF tables with borders, alignment and padding (Python) 2015-01-24T21:21:27-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/579012-use-prettytable-and-xtopdf-to-create-pdf-tables-wi/ <p style="color: grey"> Python recipe 579012 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/data/">data</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/prettytable/">prettytable</a>, <a href="/recipes/tags/string/">string</a>, <a href="/recipes/tags/tabular/">tabular</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>). </p> <p>This recipe shows how to create tabular data in PDF format, supporting neat borders, and alignment and padding of columns, using the Python libraries called PrettyTable and xtopdf.</p>