{ "info": { "author": "Ryan Senkbeil", "author_email": "ryan.senkbeil@gsdesign.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "pywkher\n==========\n\nwkhtmltopdf_ is a command line program that converts HTML to PDF using\nthe WebKit rendering engine, as provided by Qt_. Because it uses WebKit,\nyou can use wkhtmltopdf to generate screenshots, or generate PDFs from\nDjango or Rails or whatever, and the resulting PDFs will look awesome.\n\nThe typical install process includes downloading and compiling Qt,\nfollowed by downloading and installing wkhtmltopdf.\n\nBut you can't really download and compile packages inside a Heroku_\ndyno, so you need to vendor in any external binaries you might want to use\n(that aren't Python packages that compile themselves). This package\nprovides a simple way to include and use a wkhtmltopdf binary that has\nbeen compiled for the Heroku (Cedar stack) dyno environment.\n\n.. _Heroku: http://www.heroku.com/\n.. _wkhtmltopdf: http://code.google.com/p/wkhtmltopdf/\n.. _Qt: http://qt.nokia.com/products/\n\nInstallation\n------------\n\nInstall it in the usual way::\n\n pip install pywkher\n\nUsage\n-----\n\nOne easy way of using wkhtmltopdf in your Python program is to use the\nincluded ``generate_pdf`` command. The ``generate_pdf`` command takes either a\nURL or an HTML document and returns a Python NamedTemporaryFile object\nreferencing the generated PDF (which will be stored in the Heroku instance's\ntemporary directory).\n\nHere's an example of using the ``generate_pdf`` command to render a Django template\nas a PDF and return the resulting PDF as part of the HTTP response::\n\n from os.path import basename\n from wsgiref.util import FileWrapper\n\n from django.http import HttpResponse\n from django.template import RequestContext\n from django.template.loader import get_template\n\n from pywkher import generate_pdf\n\n\n def return_a_pdf(request):\n template = get_template('my_awesome_template.html')\n html = template.render(RequestContext(request))\n pdf_file = generate_pdf(html=html)\n response = HttpResponse(FileWrapper(pdf_file), content_type='application/pdf')\n response['Content-Disposition'] = 'attachment; filename=%s.zip' % basename(pdf_file.name)\n response['Content-Length'] = pdf_file.tell()\n pdf_file.seek(0)\n return response\n\n\nUsage in Development\n--------------------\n\nIf you want to test your app locally, obviously the binary that's compiled\nfor Heroku isn't going to work, unless your development or test environment\nclosely mimics Heroku's. However, the ``generate`` function will look for\nan environment variable named ``WKHTMLTOPDF_CMD`` and will only use the\ninternally-bundled wkhtmltopdf binary if that environment variable is not set.\n\nTherefore, if you're on a Mac, do something like:\n\n- ``brew install wkhtmltopdf`` (Homebrew_ required for this)\n\n- ``export WKHTLMTOPDF_CMD=wkhtmltopdf``\n\n- ``python my_python_program.py`` (just an example)\n\n.. _Homebrew: http://mxcl.github.com/homebrew/\n\nAcknowledgements\n----------------\n\nBrad Phelan generated the binary that's included here as part of his\nwkhtmltopdf-heroku_ gem. It's thanks to his efforts that I didn't have\nto go through the whole Heroku vulcan build process myself.\n\n.. _wkhtmltopdf-heroku: https://github.com/bradphelan/wkhtmltopdf-heroku", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/rsenkbeil/pywkher", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "pywkher-new-params", "package_url": "https://pypi.org/project/pywkher-new-params/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pywkher-new-params/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/rsenkbeil/pywkher" }, "release_url": "https://pypi.org/project/pywkher-new-params/1.0.4/", "requires_dist": null, "requires_python": null, "summary": "wkhtmltopdf for Python on Heroku", "version": "1.0.4" }, "last_serial": 1129326, "releases": { "1.0.4": [ { "comment_text": "", "digests": { "md5": "f7ca29ad3d79191446361a1a40d0bc65", "sha256": "ed4d54da7dcbfced1fc7e4854509dbcd7f29fdff32ff4757dd1837bc0bbcd83e" }, "downloads": -1, "filename": "pywkher-new-params-1.0.4.tar.gz", "has_sig": false, "md5_digest": "f7ca29ad3d79191446361a1a40d0bc65", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10886151, "upload_time": "2014-06-18T16:54:25", "url": "https://files.pythonhosted.org/packages/53/e6/09cc8687ed96729e967c24813acdc85afad12c34b63ea41aacc41581d094/pywkher-new-params-1.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f7ca29ad3d79191446361a1a40d0bc65", "sha256": "ed4d54da7dcbfced1fc7e4854509dbcd7f29fdff32ff4757dd1837bc0bbcd83e" }, "downloads": -1, "filename": "pywkher-new-params-1.0.4.tar.gz", "has_sig": false, "md5_digest": "f7ca29ad3d79191446361a1a40d0bc65", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10886151, "upload_time": "2014-06-18T16:54:25", "url": "https://files.pythonhosted.org/packages/53/e6/09cc8687ed96729e967c24813acdc85afad12c34b63ea41aacc41581d094/pywkher-new-params-1.0.4.tar.gz" } ] }