[Product Page](https://products.aspose.com/pdf/python-cpp/) | [Docs](https://docs.aspose.com/pdf/python-cpp/) | [Demos](https://products.aspose.app/pdf/family/) | [API Reference](https://reference.aspose.com/pdf/python-cpp/) | [Examples](https://github.com/aspose-pdf/) | [Blog](https://blog.aspose.com/categories/aspose.pdf-product-family/) | [Search](https://search.aspose.com/) | [Free Support](https://forum.aspose.com/c/pdf/10) | [Temporary License](https://purchase.aspose.com/temporary-license)
[Aspose.PDF for Python](https://products.aspose.com/) is a robust on-premise library designed to handle a wide range of document processing tasks. This powerful tool empowers developers to enrich their applications by incorporating functionalities like document generation, modification, conversion, rendering, and printing, all without depending on external software.
## PDF API Features
Aspose.PDF for Python offers a comprehensive set of features for working with PDF documents. Here are some popular features provided by the library:
1. PDF Document Handling: Aspose.PDF for Python enables developers to create, open, modify, and save PDF documents using the associated PDF document handle. This includes tasks such as creating new PDF files, opening existing ones, and performing various operations on them.
2. Document Page Manipulation: The library allows basic manipulation of document pages, such as adding or removing pages from the PDF document. This functionality provides flexibility in managing the structure and content of the PDF document.
3. Advanced Page Manipulation: With Aspose.PDF for Python, developers can perform advanced manipulations on individual pages. This includes operations like rotating pages to different orientations, changing the content of pages, and adding elements like stamps or images to enhance the visual representation of the document.
4. Export to Graphics Formats: The library provides the capability to export PDF document pages to various graphics formats. This allows developers to extract pages from PDF documents and save them as separate image files in formats like JPEG, PNG, or TIFF. This feature is particularly useful when integrating PDF content into other applications or systems that require graphics-based representations.
These features collectively empower developers to efficiently work with PDF documents in Python, offering extensive control over document creation, manipulation, and conversion to meet diverse application requirements.
## Platform Independence
Aspose.PDF for Python is a versatile library that supports the development of applications across various operating systems, including Windows and Linux, as long as Python 3.5 or a later version is installed.
## Get Started
Are you interested in trying out Aspose.PDF for Python?
To get started, simply run the following command in your console: `pip install <insert alias here>`. This will fetch the package for you. If you already have Aspose.PDF for Python and would like to upgrade to the latest version, you can use the command `pip install --upgrade <insert alias here>`.
To see Aspose.PDF in action, you can run the code snippets provided below in your own environment. Alternatively, you can explore the [GitHub Repository](https://github.com/aspose-pdf/) or refer to the [Aspose.PDF for Python Documentation](https://docs.aspose.com/pdf/python-cpp/) for more information on common use cases.
## Using Python to create blank PDF document
Aspose.PDF for Python allows you to create a new blank document:
```python
from AsposePDFPythonWrappers import *
doc = Document()
doc.save("blank_pdf_document.pdf")
```
or direct with a module API:
```python
from AsposePdfPython import *
doc = document_create()
document_save(doc, "blank_pdf_document.pdf")
close_handle(doc)
```
## Using Python to Extract text from PDF file
Aspose.PDF for Python allows you to extract text from PDF files:
```python
from AsposePDFPythonWrappers import *
def install_license(license_file):
lic = License()
lic.set_license(license_file)
def extract_text(pdf_file_name, save_file_name):
ext = PdfExtractor()
ext.bind_pdf(pdf_file_name)
ext.extract_text()
ext.get_text(save_file_name)
install_license("Aspose.PDF.PythonviaCPP.lic")
extract_text("pdf_file_name.pdf", "text_file_name.txt")
```
or direct with a module API:
```python
from AsposePdfPython import *
def install_license(license_file):
lic = license_create()
license_set(lic, "Aspose.PDF.C++.lic")
def extract_text(pdf_file_name, save_file_name):
ext = extractor_create()
extractor_bind_pdf(ext, pdf_file_name)
text = extractor_extract_text(ext)
with open(save_file_name, 'w') as f:
f.write(text)
close_handle(ext)
install_license("Aspose.PDF.PythonviaCPP.lic")
extract_text("pdf_file_name.pdf", "text_file_name.txt")
```
## Encrypt and Decrypt PDF document
Aspose.PDF for Python allows you to encrypt and decrypt PDF documents:
```python
from AsposePDFPythonWrappers import *
def pdf_encrypt(pdf_file_source, user_password, owner_password, permissions:AsposePDFPython.Permissions, crypto_algorithm:AsposePDFPython.CryptoAlgorithm, pdf_file_result):
try:
doc = Document(pdf_file_source)
doc.encrypt(user_password, owner_password, permissions, crypto_algorithm)
doc.save(pdf_file_result)
except Exception as e:
print(e)
def pdf_decrypt(pdf_file_source, password, pdf_file_result):
try:
doc = Document(pdf_file_source, password)
doc.decrypt()
doc.save(pdf_file_result)
except Exception as e:
print(e)
pdf_encrypt("pdf_file_name.pdf", "user_password", "owner_password", Permissions(Permissions.ExtractContent|ModifyContent), CryptoAlgorithm.AESx256, "pdf_file_result.pdf")
pdf_decrypt("pdf_file_source.pdf", "password", "pdf_file_result.pdf")
```
or direct with a module API:
```python
from AsposePdfPython import *
def pdf_encrypt(pdf_file_source, user_password, owner_password, permissions:AsposePDFPython.Permissions, crypto_algorithm:AsposePDFPython.CryptoAlgorithm, pdf_file_result):
try:
doc = document_open(pdf_file_source)
document_encrypt_1(doc, user_password, owner_password
, Permissions(Permissions.ExtractContent|ModifyContent), CryptoAlgorithm.AESx256)
document_save(doc, pdf_file_result)
except Exception as e:
print(e)
def pdf_decrypt(pdf_file_source, password, pdf_file_result):
try:
doc = document_open_encrypted(pdf_file_source, password)
document_decrypt(doc)
document_save(doc, pdf_file_result)
except Exception as e:
print(e)
pdf_encrypt("pdf_file_name.pdf", "user_password", "owner_password", Permissions(Permissions.ExtractContent|ModifyContent), CryptoAlgorithm.AESx256, "pdf_file_result.pdf")
pdf_decrypt("pdf_file_source.pdf", "password", "pdf_file_result.pdf")
```
## Merge two PDF files
Aspose.PDF for Python allows you to merge or split PDF files:
```python
from AsposePDFPythonWrappers import *
def merge_files(pdf_file_1, pdf_file_2, result_pdf_file):
doc1 = Document(pdf_file_1)
doc2 = Document(pdf_file_2)
pages1 = doc1.pages
pages2 = doc2.pages
pages1.add(pages2)
doc1.save(result_pdf_file)
merge_files("pdf_file_1.pdf", "pdf_file_2.pdf", "result_pdf_file.pdf")
```
or direct with a module API:
```python
from AsposePdfPython import *
def merge_files(pdf_file_1, pdf_file_2, result_pdf_file):
doc1 = document_open(pdf_file_1)
doc2 = document_open(pdf_file_2)
pages1 = document_get_pages(doc1)
pages2 = document_get_pages(doc2)
page_collection_add_pages(pages1, pages2)
document_save(doc1, result_pdf_file)
close_handle(doc1)
close_handle(doc2)
merge_files("pdf_file_1.pdf", "pdf_file_2.pdf", "result_pdf_file.pdf")
```
[Product Page](https://products.aspose.com/pdf/python-cpp/) | [Docs](https://docs.aspose.com/pdf/python-cpp/) | [Demos](https://products.aspose.app/pdf/family/) | [API Reference](https://reference.aspose.com/pdf/python-cpp/) | [Examples](https://github.com/aspose-pdf/) | [Blog](https://blog.aspose.com/categories/aspose.pdf-product-family/) | [Search](https://search.aspose.com/) | [Free Support](https://forum.aspose.com/c/pdf/10) | [Temporary License](https://purchase.aspose.com/temporary-license)
Raw data
{
"_id": null,
"home_page": "https://products.aspose.com/pdf/python-cpp/",
"name": "Aspose-PDF-Python-Via-Cpp-darwin-arm64",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<3.12",
"maintainer_email": "",
"keywords": "Aspose.PDF,PDF",
"author": "Aspose",
"author_email": "",
"download_url": "",
"platform": "darwin",
"description": "[Product Page](https://products.aspose.com/pdf/python-cpp/) | [Docs](https://docs.aspose.com/pdf/python-cpp/) | [Demos](https://products.aspose.app/pdf/family/) | [API Reference](https://reference.aspose.com/pdf/python-cpp/) | [Examples](https://github.com/aspose-pdf/) | [Blog](https://blog.aspose.com/categories/aspose.pdf-product-family/) | [Search](https://search.aspose.com/) | [Free Support](https://forum.aspose.com/c/pdf/10) | [Temporary License](https://purchase.aspose.com/temporary-license)\n\n[Aspose.PDF for Python](https://products.aspose.com/) is a robust on-premise library designed to handle a wide range of document processing tasks. This powerful tool empowers developers to enrich their applications by incorporating functionalities like document generation, modification, conversion, rendering, and printing, all without depending on external software.\n\n\n## PDF API Features\n\nAspose.PDF for Python offers a comprehensive set of features for working with PDF documents. Here are some popular features provided by the library:\n\n1. PDF Document Handling: Aspose.PDF for Python enables developers to create, open, modify, and save PDF documents using the associated PDF document handle. This includes tasks such as creating new PDF files, opening existing ones, and performing various operations on them.\n \n2. Document Page Manipulation: The library allows basic manipulation of document pages, such as adding or removing pages from the PDF document. This functionality provides flexibility in managing the structure and content of the PDF document.\n \n3. Advanced Page Manipulation: With Aspose.PDF for Python, developers can perform advanced manipulations on individual pages. This includes operations like rotating pages to different orientations, changing the content of pages, and adding elements like stamps or images to enhance the visual representation of the document.\n \n4. Export to Graphics Formats: The library provides the capability to export PDF document pages to various graphics formats. This allows developers to extract pages from PDF documents and save them as separate image files in formats like JPEG, PNG, or TIFF. This feature is particularly useful when integrating PDF content into other applications or systems that require graphics-based representations.\n \nThese features collectively empower developers to efficiently work with PDF documents in Python, offering extensive control over document creation, manipulation, and conversion to meet diverse application requirements.\n\n## Platform Independence\n\nAspose.PDF for Python is a versatile library that supports the development of applications across various operating systems, including Windows and Linux, as long as Python 3.5 or a later version is installed. \n\n## Get Started\n\nAre you interested in trying out Aspose.PDF for Python?\n\nTo get started, simply run the following command in your console: `pip install <insert alias here>`. This will fetch the package for you. If you already have Aspose.PDF for Python and would like to upgrade to the latest version, you can use the command `pip install --upgrade <insert alias here>`.\n\nTo see Aspose.PDF in action, you can run the code snippets provided below in your own environment. Alternatively, you can explore the [GitHub Repository](https://github.com/aspose-pdf/) or refer to the [Aspose.PDF for Python Documentation](https://docs.aspose.com/pdf/python-cpp/) for more information on common use cases.\n\n## Using Python to create blank PDF document\n\nAspose.PDF for Python allows you to create a new blank document:\n```python\nfrom AsposePDFPythonWrappers import *\n\ndoc = Document()\ndoc.save(\"blank_pdf_document.pdf\")\n```\nor direct with a module API:\n```python\nfrom AsposePdfPython import *\n\ndoc = document_create()\ndocument_save(doc, \"blank_pdf_document.pdf\")\nclose_handle(doc)\n```\n## Using Python to Extract text from PDF file\n\nAspose.PDF for Python allows you to extract text from PDF files:\n```python\nfrom AsposePDFPythonWrappers import *\n\ndef install_license(license_file): \n lic = License() \n lic.set_license(license_file)\n\ndef extract_text(pdf_file_name, save_file_name): \n ext = PdfExtractor() \n ext.bind_pdf(pdf_file_name) \n ext.extract_text() \n ext.get_text(save_file_name)\n\ninstall_license(\"Aspose.PDF.PythonviaCPP.lic\")\nextract_text(\"pdf_file_name.pdf\", \"text_file_name.txt\")\n```\nor direct with a module API:\n```python\nfrom AsposePdfPython import *\n\ndef install_license(license_file):\n lic = license_create()\n license_set(lic, \"Aspose.PDF.C++.lic\")\n\ndef extract_text(pdf_file_name, save_file_name):\n ext = extractor_create()\n extractor_bind_pdf(ext, pdf_file_name)\n text = extractor_extract_text(ext)\n with open(save_file_name, 'w') as f:\n f.write(text)\n close_handle(ext)\n\ninstall_license(\"Aspose.PDF.PythonviaCPP.lic\")\nextract_text(\"pdf_file_name.pdf\", \"text_file_name.txt\")\n```\n## Encrypt and Decrypt PDF document\n\nAspose.PDF for Python allows you to encrypt and decrypt PDF documents:\n```python\nfrom AsposePDFPythonWrappers import *\n\ndef pdf_encrypt(pdf_file_source, user_password, owner_password, permissions:AsposePDFPython.Permissions, crypto_algorithm:AsposePDFPython.CryptoAlgorithm, pdf_file_result): \n try: \n doc = Document(pdf_file_source) \n doc.encrypt(user_password, owner_password, permissions, crypto_algorithm) \n doc.save(pdf_file_result) \n except Exception as e: \n print(e) \n \ndef pdf_decrypt(pdf_file_source, password, pdf_file_result): \n try: \n doc = Document(pdf_file_source, password) \n doc.decrypt() \n doc.save(pdf_file_result) \n except Exception as e: \n print(e)\n\npdf_encrypt(\"pdf_file_name.pdf\", \"user_password\", \"owner_password\", Permissions(Permissions.ExtractContent|ModifyContent), CryptoAlgorithm.AESx256, \"pdf_file_result.pdf\")\npdf_decrypt(\"pdf_file_source.pdf\", \"password\", \"pdf_file_result.pdf\")\n```\nor direct with a module API:\n```python\nfrom AsposePdfPython import *\n\ndef pdf_encrypt(pdf_file_source, user_password, owner_password, permissions:AsposePDFPython.Permissions, crypto_algorithm:AsposePDFPython.CryptoAlgorithm, pdf_file_result): \n\ttry:\n\t doc = document_open(pdf_file_source)\n\t document_encrypt_1(doc, user_password, owner_password\n\t , Permissions(Permissions.ExtractContent|ModifyContent), CryptoAlgorithm.AESx256)\n\t document_save(doc, pdf_file_result)\n\texcept Exception as e:\n\t print(e)\n\ndef pdf_decrypt(pdf_file_source, password, pdf_file_result): \n\ttry:\n\t doc = document_open_encrypted(pdf_file_source, password)\n\t document_decrypt(doc)\n\t document_save(doc, pdf_file_result)\n\texcept Exception as e:\n\t print(e)\n\npdf_encrypt(\"pdf_file_name.pdf\", \"user_password\", \"owner_password\", Permissions(Permissions.ExtractContent|ModifyContent), CryptoAlgorithm.AESx256, \"pdf_file_result.pdf\")\npdf_decrypt(\"pdf_file_source.pdf\", \"password\", \"pdf_file_result.pdf\")\n```\n## Merge two PDF files\n\nAspose.PDF for Python allows you to merge or split PDF files:\n\n```python\nfrom AsposePDFPythonWrappers import *\n\ndef merge_files(pdf_file_1, pdf_file_2, result_pdf_file): \n doc1 = Document(pdf_file_1) \n doc2 = Document(pdf_file_2) \n pages1 = doc1.pages \n pages2 = doc2.pages \n pages1.add(pages2) \n doc1.save(result_pdf_file)\n\nmerge_files(\"pdf_file_1.pdf\", \"pdf_file_2.pdf\", \"result_pdf_file.pdf\")\n```\nor direct with a module API:\n```python\nfrom AsposePdfPython import *\n\ndef merge_files(pdf_file_1, pdf_file_2, result_pdf_file): \n\tdoc1 = document_open(pdf_file_1)\n\tdoc2 = document_open(pdf_file_2)\n\tpages1 = document_get_pages(doc1)\n\tpages2 = document_get_pages(doc2)\n\tpage_collection_add_pages(pages1, pages2)\n\tdocument_save(doc1, result_pdf_file)\n\tclose_handle(doc1)\n\tclose_handle(doc2)\n\nmerge_files(\"pdf_file_1.pdf\", \"pdf_file_2.pdf\", \"result_pdf_file.pdf\")\n```\n[Product Page](https://products.aspose.com/pdf/python-cpp/) | [Docs](https://docs.aspose.com/pdf/python-cpp/) | [Demos](https://products.aspose.app/pdf/family/) | [API Reference](https://reference.aspose.com/pdf/python-cpp/) | [Examples](https://github.com/aspose-pdf/) | [Blog](https://blog.aspose.com/categories/aspose.pdf-product-family/) | [Search](https://search.aspose.com/) | [Free Support](https://forum.aspose.com/c/pdf/10) | [Temporary License](https://purchase.aspose.com/temporary-license)\n",
"bugtrack_url": null,
"license": "Other/Proprietary License",
"summary": "Aspose PDF Python via C++",
"version": "1.0",
"project_urls": {
"API Reference": "https://reference.aspose.com/pdf/python-cpp/",
"Blog": "https://blog.aspose.com/categories/aspose.pdf-product-family/",
"Demos": "https://products.aspose.app/pdf/family/",
"Docs": "https://docs.aspose.com/pdf/python-cpp/",
"Free Support": "https://forum.aspose.com/c/pdf/10",
"Homepage": "https://products.aspose.com/pdf/python-cpp/",
"Temporary License": "https://purchase.aspose.com/temporary-license"
},
"split_keywords": [
"aspose.pdf",
"pdf"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e18889e3d0cf32e7b2025959054a782add9bada557a87a29d8e948abac2a22a1",
"md5": "a3d24467e0f30641f1208c91c22f0c0d",
"sha256": "2c475f0283c7c92c105d828ad593a3570dc82a566d8f1a877334afd85443f317"
},
"downloads": -1,
"filename": "Aspose_PDF_Python_Via_Cpp_darwin_arm64-1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a3d24467e0f30641f1208c91c22f0c0d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<3.12",
"size": 1708771,
"upload_time": "2023-12-26T12:33:52",
"upload_time_iso_8601": "2023-12-26T12:33:52.514099Z",
"url": "https://files.pythonhosted.org/packages/e1/88/89e3d0cf32e7b2025959054a782add9bada557a87a29d8e948abac2a22a1/Aspose_PDF_Python_Via_Cpp_darwin_arm64-1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-26 12:33:52",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "aspose-pdf-python-via-cpp-darwin-arm64"
}