Nggunakake REST API ing Python, pangembang bisa ngompres Word kanthi program. Kanthi solusi sing diwenehake, output bakal dadi file berkualitas tinggi sawise kompresi.
Nggunakake Python API sing kuat, pangembang bisa ngompres Word kanggo ngoptimalake isi lan ukuran file output. Ngurangi ukuran file dumadi kanthi ngresiki data lan sumber daya sing ora digunakake. Sampeyan uga bisa compress gambar kanggo nggawe ukuran file output malah luwih cilik.
Asil optimasi lan kompresi isi bisa disimpen ing Word asli utawa format nyimpen sing kasedhiya - DOCX, DOC, RTF, PDF, HTML lan liya-liyane.
Kaya sing wis kasebut, SDK Python kita ngidini sampeyan nyuda ukuran Word kanthi program. Lan saiki sampeyan bisa nyoba fungsi sing kuat lan ngevaluasi cara ngompres Word ing Python kanthi conto ing ngisor iki:
import asposewordscloud
words_api = WordsApi(client_id = '####-####-####-####-####', client_secret = '##################')
request_document = open('Input.docx', 'rb')
request_compress_options = asposewordscloud.CompressOptions(
images_quality=75, images_reduce_size_factor=1)
compress_document_request = asposewordscloud.models.requests.CompressDocumentOnlineRequest(
document=request_document, compress_options=request_compress_options)
compress_document = words_api.compress_document_online(compress_document_request)
convert_document = asposewordscloud.models.requests.ConvertDocumentRequest(
document=list(insert_paragraph.document.values())[0], format='docx')
words_api.convert_document(convert_document)
Instal Aspose.Words Cloud SDK for Python nggunakake repositori PyPi. pip install aspose-words-cloud kanggo nginstal SDK, banjur impor paket kasebut liwat import asposewordscloud. Minangka alternatif, sampeyan bisa kanthi manual clone Aspose.Words Cloud SDK for Python saka GitHub lan nggunakake ing project. Tututi Instructions iki supaya cepet entuk kredensial keamanan sing dibutuhake lan ngakses REST API kita.
Deleng Repository Documentation kanggo ndeleng rincian.
Sampeyan bisa nindakake kompresi dokumen kanggo format file liyane: