PNG JPG BMP TIFF PDF
Aspose.PDF  for Python

Phân chia PDF trong Python SDK

Phân chia tệp PDF sử dụng Python Cloud SDK

Get Started

Cách phân chia tệp PDF bằng Python Cloud API

Tại sao tôi cần phải phân chia tài liệu PDF? Phân chia PDF bằng Python có thể là bắt buộc khi quản lý và tổ chức tài liệu lớn hoặc làm việc trong môi trường xử lý dữ liệu. ఫে ზ Indic A Selection Containing a Specific Section or Set of Pages. Phân chia PDF cho phép bạn highlight và trích xuất các trang tương ứng mà không cần tài liệu còn lại.

Cũng với việc gửi hoặc chia sẻ tất cả các PDFs có thể không hiệu quả, szczególnie jeśli tài liệu sangat besar dan mengandung lebih banyak informasi daripada yang diperlukan. Khi phân chia PDFs, bạn chỉ cần phân chia các trang tương ứng, điều này làm cho quá trình nhanh hơn và tiết kiệm băng thông.

Phân chia PDF thành những phần nhỏ hơn có thể giảm kích thước tệp, điều này hữu ích khi bạn gặp vấn đề lưu trữ hoặc tải tài liệu lên hệ thống có giới hạn kích thước.

Để bắt đầu, bạn nên cóPython và PDF Cloud Python SDK được cài đặt trên hệ thống của bạn.

Cài đặt từ Github


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

Lệnh Manager Console

     
    pip install asposepdfcloud

Bước để Phân chia PDF qua Cloud Python SDK

Phân chia cơ bản PDFs programmatic với Aspose.PDF Cloud Python SDK APIs có thể được thực hiện chỉ với một số dòng mã.

  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.
 

Phân chia các tệp PDF đơn lẻ bằng 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
 

Với thư viện Python của chúng tôi bạn có thể:

  • 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.