{ "info": { "author": "Cyril Nicodeme", "author_email": "contact@pdfshift.io", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Pre-processors", "Topic :: Text Editors :: Text Processing", "Topic :: Text Editors :: Word Processors", "Topic :: Text Processing :: Markup", "Topic :: Text Processing :: Markup :: HTML", "Topic :: Utilities" ], "description": "PDFShift Python Package\n=======================\n\nThis Python package provides a simplified way to interact with the [PDFShift](https://pdfshift.io) API.\n\n## Documentation\n\nSee the full documentation on [PDFShift's documentation](https://pdfshift.io/documentation).\n\n## Installation\n\nYou should not require this code directly. Instead, just run:\n\n pip install --upgrade pdfshift\n\nor\n\n easy_install --upgrade pdfshift\n\n\n### Requirements\n\n* Python 2.6+\n* [Requests](http://docs.python-requests.org/en/master/)\n\n## Usage\n\nThis library needs to be configured with your `api_key` received when creating an account.\nSetting it is easy as:\n\n```python\nimport pdfshift\npdfshift.api_key = '120d8e8a86d2....................'\n```\n\n### Basic example\n\n#### With an URL\n\n```python\nimport pdfshift\npdfshift.api_key = '120d8e8a86d2....................'\n\nbinary_file = pdfshift.convert('https://www.example.com')\n\nwith open('result.pdf', 'wb') as output:\n output.write(binary_file)\n```\n\n#### With inline HTML data:\n\n```python\nimport pdfshift\npdfshift.api_key = '120d8e8a86d2....................'\n\ndocument = open('invoice.html', 'r')\ndocument_content = document.read()\ndocument.close()\n\nbinary_file = pdfshift.convert(document_content)\nwith open('result.pdf', 'wb') as output:\n output.write(binary_file)\n```\n\n### Custom CSS\n\n#### Loading CSS from an URL:\n\n```python\nimport pdfshift\npdfshift.api_key = '120d8e8a86d2....................'\n\nbinary_file = pdfshift.convert(\n 'https://www.example.com',\n css=\"https://www.example.com/public/css/print.css\"\n)\n\nwith open('result.pdf', 'wb') as output:\n output.write(binary_file)\n```\n\n#### Loading CSS from a string:\n\n```python\nimport pdfshift\npdfshift.api_key = '120d8e8a86d2....................'\n\nbinary_file = pdfshift.convert(\n 'https://www.example.com',\n css=\"a {text-decoration: underline; color: blue}\"\n)\n\nwith open('result.pdf', 'wb') as output:\n output.write(binary_file)\n```\n\n### Custom HTTP Headers\n\n```python\nimport pdfshift\npdfshift.api_key = '120d8e8a86d2....................'\n\nbinary_file = pdfshift.convert(\n 'https://httpbin.org/headers',\n headers={\n 'X-Original-Header': 'Awesome value',\n 'user-agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0'\n }\n)\n\nwith open('result.pdf', 'wb') as output:\n output.write(binary_file)\n```\n\n### Accessing secured pages\n\n```python\nimport pdfshift\npdfshift.api_key = '120d8e8a86d2....................'\n\nbinary_file = pdfshift.convert('https://httpbin.org/basic-auth/user/passwd', auth=('user', 'passwd'))\n\nwith open('result.pdf', 'wb') as output:\n output.write(binary_file)\n```\n\n### Using cookies\n\n```python\nimport pdfshift\npdfshift.api_key = '120d8e8a86d2....................'\n\nbinary_file = pdfshift.convert(\n 'https://httpbin.org/cookies',\n cookies=[\n {'name': 'session', 'value': '4cb496a8-a3eb-4a7e-a704-f993cb6a4dac'}\n ]\n)\n\nwith open('result.pdf', 'wb') as output:\n output.write(binary_file)\n```\n\n### Adding Watermark (Oh hi Mark!)\n\n```python\nimport pdfshift\npdfshift.api_key = '120d8e8a86d2....................'\n\nbinary_file = pdfshift.convert(\n 'https://www.example.com',\n watermark={\n 'image': 'https://pdfshift.io/static/img/logo.png',\n 'offset_x': 50,\n 'offset_y': '100px',\n 'rotate': 45\n }\n)\n\nwith open('result.pdf', 'wb') as output:\n output.write(binary_file)\n```\n\n### Custom Header (or Footer)\n\n```python\nimport pdfshift\npdfshift.api_key = '120d8e8a86d2....................'\n\nbinary_file = pdfshift.convert(\n 'https://www.example.com',\n footer={\n 'source': '