{ "info": { "author": "Zack Schwartz", "author_email": "support@api2pdf.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# api2pdf.python\nPython bindings for [Api2Pdf REST API](https://www.api2pdf.com/documentation) \n\nApi2Pdf.com is a REST API for instantly generating PDF documents from HTML, URLs, Microsoft Office Documents (Word, Excel, PPT), and images. The API also supports merge / concatenation of two or more PDFs. Api2Pdf is a wrapper for popular libraries such as **wkhtmltopdf**, **Headless Chrome**, and **LibreOffice**.\n\n- [Installation](#installation)\n- [Resources](#resources)\n- [Authorization](#authorization)\n- [Usage](#usage)\n- [FAQ](https://www.api2pdf.com/faq)\n\n\n## Add a dependency\n\n### PyPI\n\nRun the pip command for installing the client `pip install api2pdf`\n\n## Resources\n\nResources this API supports:\n\n- [wkhtmltopdf](#wkhtmltopdf)\n- [Headless Chrome](#chrome)\n- [LibreOffice](#libreoffice)\n- [Merge / Concatenate PDFs](#merge)\n- [Helper Methods](#helpers)\n\n## Authorization\n\n### Acquire API Key\n\nCreate an account at [portal.api2pdf.com](https://portal.api2pdf.com/register) to get your API key.\n\n## Usage\n\n### Initialize the Client\n\nAll usage starts by calling the import command and initializing the client by passing your API key as a parameter to the constructor.\n\n from api2pdf import Api2Pdf\n\n a2p_client = Api2Pdf('YOUR-API-KEY')\n\nOnce you initialize the client, you can make calls like so:\n\n api_response = a2p_client.HeadlessChrome.convert_from_html('
Hello, World
')\n print(api_response.result)\n\n### Result Object\n\nAn `Api2PdfResponse` object is returned from every API call. Call the `result` attribute to retrieve the data. If a call is unsuccessful then `success` will show False and the `error` will provide the reason for failure. Additional attributes include the total data usage in, out, and the cost for the API call, typically very small fractions of a penny.\n\n {\n\t 'pdf': 'https://link-to-pdf-only-available-for-24-hours',\n\t 'mbIn': 0.08421039581298828,\n\t 'mbOut': 0.08830547332763672,\n\t 'cost': 0.00017251586914062501,\n\t 'success': True,\n\t 'error': None,\n\t 'responseId': '6e46637a-650d-46d5-af0b-3d7831baccbb'\n }\n\nFor debugging, you can print the `Api2PdfResponse` object to see the request and response data.\n\n api_response = a2p_client.HeadlessChrome.convert_from_html('Hello, World
')\n print(api_response)\n\nOutput:\n\n ---- API2PDF REQUEST ----\n - Headers: {'Authorization': 'YOUR-API-KEY'}\n - Endpoint: https://v2018.api2pdf.com/chrome/html\n - Payload:\n {'html': 'Hello, World
'}\n ---- API2PDF RESPONSE ----\n {'pdf': 'https://link-to-pdf-only-available-for-24-hours', 'mbIn': 0.08421039581298828, 'mbOut': 0.08830547332763672, 'cost': 0.00017251586914062501, 'success': True, 'error': None, 'responseId': '163c4d25-25d7-4b82-bf50-907597d2ad46'}\n\n\n### wkhtmltopdf\n\n**Convert HTML to PDF**\n\n api_response = a2p_client.WkHtmlToPdf.convert_from_html('Hello, World
')\n\n**Convert HTML to PDF (load PDF in browser window and specify a file name)**\n\n api_response = a2p_client.WkHtmlToPdf.convert_from_html('Hello, World
', inline_pdf=True, file_name='test.pdf')\n\n**Convert HTML to PDF (use keyword arguments for advanced wkhtmltopdf settings)**\n[View full list of wkhtmltopdf options available.](https://www.api2pdf.com/documentation/advanced-options-wkhtmltopdf/)\n\n options = {\n 'orientation': 'landscape',\n 'pageSize': 'A4'\n }\n api_response = a2p_client.WkHtmlToPdf.convert_from_html('Hello, World
', **options)\n\n**Convert URL to PDF**\n\n api_response = a2p_client.WkHtmlToPdf.convert_from_url('http://www.api2pdf.com')\n\n**Convert URL to PDF (load PDF in browser window and specify a file name)**\n\n api_response = a2p_client.WkHtmlToPdf.convert_from_url('http://www.api2pdf.com', inline_pdf=True, file_name='test.pdf')\n\n**Convert URL to PDF (use keyword arguments for advanced wkhtmltopdf settings)**\n[View full list of wkhtmltopdf options available.](https://www.api2pdf.com/documentation/advanced-options-wkhtmltopdf/)\n\n options = {\n 'orientation': 'landscape',\n 'pageSize': 'A4'\n }\n api_response = a2p_client.WkHtmlToPdf.convert_from_url('http://www.api2pdf.com', **options)\n\n\n---\n\n## Headless Chrome\n\n**Convert HTML to PDF**\n\n api_response = a2p_client.HeadlessChrome.convert_from_html('Hello, World
')\n\n**Convert HTML to PDF (load PDF in browser window and specify a file name)**\n\n api_response = a2p_client.HeadlessChrome.convert_from_html('Hello, World
', inline_pdf=True, file_name='test.pdf')\n\n**Convert HTML to PDF (use keyword arguments for advanced Headless Chrome settings)**\n[View full list of Headless Chrome options available.](https://www.api2pdf.com/documentation/advanced-options-headless-chrome/)\n\n options = {\n 'landscape': True\n }\n api_response = a2p_client.HeadlessChrome.convert_from_html('Hello, World
', **options)\n\n**Convert URL to PDF**\n\n api_response = a2p_client.HeadlessChrome.convert_from_url('http://www.api2pdf.com')\n\n**Convert URL to PDF (load PDF in browser window and specify a file name)**\n\n api_response = a2p_client.HeadlessChrome.convert_from_url('http://www.api2pdf.com', inline_pdf=True, file_name='test.pdf')\n\n**Convert URL to PDF (use keyword arguments for advanced Headless Chrome settings)**\n[View full list of Headless Chrome options available.](https://www.api2pdf.com/documentation/advanced-options-headless-chrome/)\n\n options = {\n 'landscape': True\n }\n api_response = a2p_client.HeadlessChrome.convert_from_url('http://www.api2pdf.com', **options)\n\n---\n\n## LibreOffice\n\nLibreOffice supports the conversion to PDF from the following file formats:\n\n- doc, docx, xls, xlsx, ppt, pptx, gif, jpg, png, bmp, rtf, txt, html\n\nYou must provide a url to the file. Our engine will consume the file at that URL and convert it to the PDF.\n\n**Convert Microsoft Office Document or Image to PDF**\n\n api_response = a2p_client.LibreOffice.convert_from_url('https://www.api2pdf.com/wp-content/themes/api2pdf/assets/samples/sample-word-doc.docx')\n\n**Convert Microsoft Office Document or Image to PDF (load PDF in browser window and specify a file name)**\n\n api_response = a2p_client.LibreOffice.convert_from_url('https://www.api2pdf.com/wp-content/themes/api2pdf/assets/samples/sample-word-doc.docx', inline_pdf=True, file_name='test.pdf')\n\n---\n\n## Merge / Concatenate Two or More PDFs\n\nTo use the merge endpoint, supply a list of urls to existing PDFs. The engine will consume all of the PDFs and merge them into a single PDF, in the order in which they were provided in the list.\n\n**Merge PDFs from list of URLs to existing PDFs**\n\n links_to_pdfs = ['https://LINK-TO-PDF', 'https://LINK-TO-PDF']\n merge_result = a2p_client.merge(links_to_pdfs)\n\n**Merge PDFs from list of URLs to existing PDFs (load PDF in browser window and specify a file name)**\n\n links_to_pdfs = ['https://LINK-TO-PDF', 'https://LINK-TO-PDF']\n merge_result = a2p_client.merge(links_to_pdfs, inline_pdf=True, file_name='test.pdf')\n\n---\n\n## Helper Methods\n\n**Api2PdfResponse: download_pdf()**\n\nOn any `Api2PdfResponse` that succesfully generated a pdf, you can use the handy `download_pdf()` method to download the pdf to a file-like object which you can then save to your local cache. If the pdf generation was unsuccessful, it will throw a FileNotFoundException.\n\n```\nfrom api2pdf import Api2Pdf\na2p_client = Api2Pdf('YOUR-API-KEY')\n\n# merge pdfs\nlinks_to_pdfs = ['https://LINK-TO-PDF', 'https://LINK-TO-PDF']\nmerge_result = a2p_client.merge(links_to_pdfs)\n\npdf_as_file_object = merge_result.download_pdf()\n```\n\n**Delete a PDF on Command with delete(response_id)**\n\nBy default, Api2Pdf will automatically delete your PDFs after 24 hours. If you have higher security requirements and need to delete the PDFs at-will, you can do so by calling the `delete(response_id)` method on the Api2Pdf object where `response_id` parameter comes from the responseId attribute in the Api2PdfResponse result.\n\n```\nfrom api2pdf import Api2Pdf\na2p_client = Api2Pdf('YOUR-API-KEY')\n\n# generate a pdf\napi_response = a2p_client.HeadlessChrome.convert_from_html('Hello World
')\nresponse_id = api_response.result['responseId']\n\n# delete the pdf\na2p_client.delete(response_id)\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/api2pdf/api2pdf.python", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "api2pdf", "package_url": "https://pypi.org/project/api2pdf/", "platform": "", "project_url": "https://pypi.org/project/api2pdf/", "project_urls": { "Homepage": "https://github.com/api2pdf/api2pdf.python" }, "release_url": "https://pypi.org/project/api2pdf/0.0.11/", "requires_dist": [ "requests" ], "requires_python": "", "summary": "Wrapper for api2pdf.com library for converting html, urls, and word documents to pdf", "version": "0.0.11" }, "last_serial": 4744784, "releases": { "0.0.10": [ { "comment_text": "", "digests": { "md5": "7da33ef6ef722c9874580a30e69edb7d", "sha256": "1c58fad74d16824d1aed38da34ad51defb0bf1aeafdea24412acac6dff3d9001" }, "downloads": -1, "filename": "api2pdf-0.0.10-py3-none-any.whl", "has_sig": false, "md5_digest": "7da33ef6ef722c9874580a30e69edb7d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5723, "upload_time": "2018-06-23T18:02:48", "url": "https://files.pythonhosted.org/packages/22/c9/2b244fa05b63784a572b1604bbc87621a4757b8e819d377c9d1c4a3a11d5/api2pdf-0.0.10-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7c1127c61bb07a7ab12c8cdff76e47fb", "sha256": "b09a3ce2ce14d11b8ce70fd9cb3a58f66dee33538aa1336bc6d729c62d4dd5cc" }, "downloads": -1, "filename": "api2pdf-0.0.10.tar.gz", "has_sig": false, "md5_digest": "7c1127c61bb07a7ab12c8cdff76e47fb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5922, "upload_time": "2018-06-23T18:02:49", "url": "https://files.pythonhosted.org/packages/ba/a7/be789d63033f1d5c4a47b3bc57debffb513825219921b270b89680ee697d/api2pdf-0.0.10.tar.gz" } ], "0.0.11": [ { "comment_text": "", "digests": { "md5": "08ead16422389a66cecf1f120d7b0d97", "sha256": "c38b385a9422ccaded2469a01fd5d3119505cf792eb43c00c0f64c2fe7786d4d" }, "downloads": -1, "filename": "api2pdf-0.0.11-py3-none-any.whl", "has_sig": false, "md5_digest": "08ead16422389a66cecf1f120d7b0d97", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6027, "upload_time": "2019-01-26T23:22:41", "url": "https://files.pythonhosted.org/packages/1a/97/c9c48ab7bc56232cf562c32a42a0c894215c789ba485318894ccdd977d7f/api2pdf-0.0.11-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4a517fc60d49c9d3a8347914adcec7fe", "sha256": "a732e0d964660c05388209317b1447e7926f0eb1d2fb18bfaf0317107526c40d" }, "downloads": -1, "filename": "api2pdf-0.0.11.tar.gz", "has_sig": false, "md5_digest": "4a517fc60d49c9d3a8347914adcec7fe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5298, "upload_time": "2019-01-26T23:22:42", "url": "https://files.pythonhosted.org/packages/5f/4f/79d05a00e94fe6b57d742c35794ffeed78c00f23f7de11e558fc5f304dcd/api2pdf-0.0.11.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "eb3804759aa8e412456840e54b9b8540", "sha256": "989d28ec2a0522a7c5a7d7eec71eabe6aa725e49e0101bf9af604e1fa00692f6" }, "downloads": -1, "filename": "api2pdf-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "eb3804759aa8e412456840e54b9b8540", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5219, "upload_time": "2018-06-18T21:00:38", "url": "https://files.pythonhosted.org/packages/83/57/2eadf1e35ddcfd458f1638bca5ff29cdfa5ba263b0bea086e3079fb398c5/api2pdf-0.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b77932d66a5cb4c779385dbd3f69431b", "sha256": "770e384c175175437bb15e762a040d610ccafa8dc3f851fc7d86174af9e6797b" }, "downloads": -1, "filename": "api2pdf-0.0.4.tar.gz", "has_sig": false, "md5_digest": "b77932d66a5cb4c779385dbd3f69431b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4815, "upload_time": "2018-06-18T21:00:39", "url": "https://files.pythonhosted.org/packages/02/33/b6f395f07899a0b96c898a9430d97f6afb005d4589365ab624012f874867/api2pdf-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "bbd86bc9cfd0c79d3358560d9d28b526", "sha256": "cc05b27363dd5cd1dabd12a20a92680ec225f031b4b20343ed7566a9889b972d" }, "downloads": -1, "filename": "api2pdf-0.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "bbd86bc9cfd0c79d3358560d9d28b526", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5398, "upload_time": "2018-06-18T22:55:14", "url": "https://files.pythonhosted.org/packages/d1/6f/e5665dc64b1b9549adf4bd917adeff3fd53d78f4d0211df3978d0f9747cb/api2pdf-0.0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fdfd36fd269d3be52bba26f5bd5a3bdd", "sha256": "7127cff6ae267f3f4d83af8b2849e79ea37e5c1fe184ffe5ef0efdafec9c2e06" }, "downloads": -1, "filename": "api2pdf-0.0.5.tar.gz", "has_sig": false, "md5_digest": "fdfd36fd269d3be52bba26f5bd5a3bdd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5470, "upload_time": "2018-06-18T22:55:15", "url": "https://files.pythonhosted.org/packages/38/0d/8021e3a129caa0cbdbca5e5369c43f98eb3a2970e865716b96bac93c18ba/api2pdf-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "e2e819fbe4a2963536080b2158f8c66f", "sha256": "5db0026412277429c8d80591eb8581d0fa71e63e57e4ce7754d753053a430e2a" }, "downloads": -1, "filename": "api2pdf-0.0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "e2e819fbe4a2963536080b2158f8c66f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5483, "upload_time": "2018-06-19T18:52:57", "url": "https://files.pythonhosted.org/packages/f1/d6/7c128e1911b55a91279125303b568414b7de087188ee69eaf342cffeaf03/api2pdf-0.0.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ea4a04f5e3adb95703280ab06d7c96c1", "sha256": "15a61cf58ea496b48372ba73c171a64c7667741cb22a72954e6374d3bed931a0" }, "downloads": -1, "filename": "api2pdf-0.0.6.tar.gz", "has_sig": false, "md5_digest": "ea4a04f5e3adb95703280ab06d7c96c1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5534, "upload_time": "2018-06-19T18:52:58", "url": "https://files.pythonhosted.org/packages/ab/79/faf3e3b2da77c028b4c6451881b02c26606e2eca5c80fc5da8503dff0814/api2pdf-0.0.6.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "0b127045e1e465019792bfb9c8db5327", "sha256": "05d61e7148bfa33518e7e78d09d9e3c5a95a41bc139ccf01db668a6fc9aad5e7" }, "downloads": -1, "filename": "api2pdf-0.0.7-py3-none-any.whl", "has_sig": false, "md5_digest": "0b127045e1e465019792bfb9c8db5327", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5768, "upload_time": "2018-06-19T19:30:01", "url": "https://files.pythonhosted.org/packages/25/17/6481a63da69b5860f97ca1ab72244cd1190d3525936e8eb2cbdcc10a60f6/api2pdf-0.0.7-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cf1e7ad97651833c11f626dfe97fe01d", "sha256": "196a9e2658137ac16441a8519e8063e2e37e6b7e910ad80005ba4683bced636e" }, "downloads": -1, "filename": "api2pdf-0.0.7.tar.gz", "has_sig": false, "md5_digest": "cf1e7ad97651833c11f626dfe97fe01d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5919, "upload_time": "2018-06-19T19:30:02", "url": "https://files.pythonhosted.org/packages/eb/14/b3696313aade751be442dbebb62d44da959062ff686602716ed848aa0865/api2pdf-0.0.7.tar.gz" } ], "0.0.8": [ { "comment_text": "", "digests": { "md5": "0501a63aa5ebf851128bca27adff2fe9", "sha256": "6c1335211983eb0c0b20f1241bc72677126525c4ed067861989f45bae5f5da86" }, "downloads": -1, "filename": "api2pdf-0.0.8-py3-none-any.whl", "has_sig": false, "md5_digest": "0501a63aa5ebf851128bca27adff2fe9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5760, "upload_time": "2018-06-19T20:33:50", "url": "https://files.pythonhosted.org/packages/07/78/e51e48555b861b26165ae1a68412759be376a9c79388c2ab0ee99ac2169d/api2pdf-0.0.8-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bb0e13a69a65f53bf0f8ce27d3828134", "sha256": "cc13b253cee1e394c7dc6ec1c05c40e2173c9231cfcbe57df5bf03a163be44d3" }, "downloads": -1, "filename": "api2pdf-0.0.8.tar.gz", "has_sig": false, "md5_digest": "bb0e13a69a65f53bf0f8ce27d3828134", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5916, "upload_time": "2018-06-19T20:33:51", "url": "https://files.pythonhosted.org/packages/16/e3/1083c0fe753b2c502e7d641810ba7e738b3b69074f48f0ba77b6ce60cbb1/api2pdf-0.0.8.tar.gz" } ], "0.0.9": [ { "comment_text": "", "digests": { "md5": "9ca9f6e4e45844db81ce6b72c567cab6", "sha256": "c82d87802017f22ee3d7284e5def48a34b0dbc9f7e70d3f6b110999f708ec75b" }, "downloads": -1, "filename": "api2pdf-0.0.9-py3-none-any.whl", "has_sig": false, "md5_digest": "9ca9f6e4e45844db81ce6b72c567cab6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5710, "upload_time": "2018-06-21T21:08:43", "url": "https://files.pythonhosted.org/packages/b7/bc/0bb8478eabf884d5f686d7054adcf1f65646a8be2b383763c89594eb7dae/api2pdf-0.0.9-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "68ffee2b3fe5316fc1a3267042b6c3e3", "sha256": "e7309742058be8c5a4e3d6f6186376f806bfeb3cdda3339a90e744bb5aafa0ea" }, "downloads": -1, "filename": "api2pdf-0.0.9.tar.gz", "has_sig": false, "md5_digest": "68ffee2b3fe5316fc1a3267042b6c3e3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5921, "upload_time": "2018-06-21T21:08:44", "url": "https://files.pythonhosted.org/packages/2c/88/77571d54fe286490de41a8930e9c050cb3bf81344ee8f087abba706934e2/api2pdf-0.0.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "08ead16422389a66cecf1f120d7b0d97", "sha256": "c38b385a9422ccaded2469a01fd5d3119505cf792eb43c00c0f64c2fe7786d4d" }, "downloads": -1, "filename": "api2pdf-0.0.11-py3-none-any.whl", "has_sig": false, "md5_digest": "08ead16422389a66cecf1f120d7b0d97", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6027, "upload_time": "2019-01-26T23:22:41", "url": "https://files.pythonhosted.org/packages/1a/97/c9c48ab7bc56232cf562c32a42a0c894215c789ba485318894ccdd977d7f/api2pdf-0.0.11-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4a517fc60d49c9d3a8347914adcec7fe", "sha256": "a732e0d964660c05388209317b1447e7926f0eb1d2fb18bfaf0317107526c40d" }, "downloads": -1, "filename": "api2pdf-0.0.11.tar.gz", "has_sig": false, "md5_digest": "4a517fc60d49c9d3a8347914adcec7fe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5298, "upload_time": "2019-01-26T23:22:42", "url": "https://files.pythonhosted.org/packages/5f/4f/79d05a00e94fe6b57d742c35794ffeed78c00f23f7de11e558fc5f304dcd/api2pdf-0.0.11.tar.gz" } ] }