PNG JPG BMP TIFF PDF
Aspose.PDF  for Python

Split PDF Documents using Cloud API

Split PDF files in Python Cloud API without the use of any software like Adobe PDF.

Get Started

How to Split PDF files Using Python Cloud API

Why do I need to split PDF documents? Splitting PDFs with Python can be necessary when managing and organizing large documents or working in a data processing environment. Sometimes a larger document requires only a separate section or set of pages. The PDF split allows you to highlight and extract the corresponding pages without the rest of the document.

Also, sending or sharing all of the PDFs may be inefficient, especially if the document is large and contains more information than necessary. When splitting PDFs, you only need to separate the corresponding pages, which makes the process faster and saves bandwidth.

Splitting PDF into smaller sections can reduce the file size, which is useful when you are having storage problems or loading documents onto systems with size restrictions.

To start, you should have Python and the PDF Cloud Python SDK installed on your system.

Installation from Github


     
    pip install git+https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-python.git

Package Manager Console Command

     
    pip install asposepdfcloud

Steps for Splitting PDF via Cloud Python SDK

A basic splitting pdfs programmatically with Aspose.PDF Cloud Python SDK APIs can be done with just few lines of code.

  1. Install Python SDK.
  2. Go to the Aspose Cloud Dashboard.
  3. Create a new Account to access all applications and services or Sign In to your account.
  4. Click on Applications in the left menu to get Client Id and Client Secret.
  5. Check out the Developer Guide to split a PDF in Python.
  6. Check out our GitHub repository for a complete API list along with working examples.
  7. Check out the API Reference page for the description of APIs parameters.
 

Split single PDF Files using Python


    def split_single_pages():
        local_file_path = "C:/Samples/Sample-Document-01.pdf"
        storage_file_name = "Sample-Document-01.pdf"

        pdf_api_client = asposepdfcloud.ApiClient(app_secret, app_sid)
        pdf_api = asposepdfcloud.PdfApi(pdf_api_client)

        # Check if the file exists in cloud storage
        files = pdf_api.get_files_list("/")
        if not any(f.name == storage_file_name for f in files.value):
            upload_result = pdf_api.upload_file(storage_file_name, local_file_path )
            print(upload_result.status)
            print(upload_result.uploaded[0])

        # Split the document into single pages
        count = 1
        response = pdf_api.post_split_document(storage_file_name)
        for page in response.result.documents:
            res = pdf_api.download_file(page.href)
            shutil.move(res, "page" + str(count)+".pdf")
            count = count + 1
 

With our Python library you can:

  • Combine PDF documents.
  • Split PDF Files.
  • Convert PDF to other formats, and vice versa.
  • Manipulate Annotations.
  • Work with Images in PDF, etc.
  • You can try out our free App to split PDF files online and test the functionality.