Gunakake API konversi dokumen kanggo ngembangake piranti lunak independen platform tingkat dhuwur ing Python. Iki minangka solusi piranti lunak profesional lengkap kanggo ngimpor lan ngekspor DOCX, gambar, lan akeh format dokumen liyane nggunakake Python.
Apa sampeyan kudu ngowahi DOCX format gambar kanthi program? Kanthi Aspose.Words kanggo Python via .NET sampeyan bisa ngowahi DOCX gambar mung nggunakake sawetara baris Python kode.
Python via .NET kita nggawe gambar saka DOCX kanthi kualitas profesional. DOCX menyang gambar kanthi kualitas paling dhuwur ing browser sampeyan. API konversi Python via .NET kuat DOCX menyang akeh format populer.
Conto ing ngisor iki nuduhake carane ngowahi DOCX dadi sakumpulan gambar ing Python.
Tindakake langkah-langkah gampang kanggo ngowahi DOCX dadi format gambar. Waca DOCX saka drive lokal, banjur simpen ing format gambar, nemtokake format file sing dibutuhake kanthi ekstensi gambar. Kanggo DOCX lan nulis gambar sampeyan bisa nggunakake jeneng file sing mumpuni. Isi lan format gambar output bakal padha karo DOCX dokumen.
pip install aspose-words
Nyalin
import aspose.words as aw
doc = aw.Document("Input.docx")
save_options = aw.saving.ImageSaveOptions(aw.SaveFormat.JPG)
for page in range(doc.page_count):
save_options.page_set = aw.saving.PageSet(page)
doc.save(f"Output_{page + 1}.jpg", save_options)
import aspose.words as aw
doc = aw.Document("Input.docx")
doc.save("Output.jpg")
import aspose.words as aw
doc = aw.Document("Input.docx")
save_options = aw.saving.ImageSaveOptions(aw.SaveFormat.jpg)
for page in range(doc.page_count):
save_options.page_set = aw.saving.PageSet(page)
doc.save(f"Output_{page + 1}.jpg", save_options)
import aspose.words as aw
doc = aw.Document()
builder = aw.DocumentBuilder(doc)
builder.insert_image("Input.docx")
doc.save("Output.jpg")
import aspose.words as aw
doc = aw.Document()
builder = aw.DocumentBuilder(doc)
shape = builder.insert_image("Input.docx")
shape.get_shape_renderer().save("Output.jpg", aw.saving.ImageSaveOptions(aw.SaveFormat.jpg))
Kita dadi tuan rumah paket Python ing repositori PyPi. Mangga tindakake langkah-langkah dening-instruksi carane nginstal "Aspose.Words for Python via .NET" kanggo lingkungan pangembang.
Paket iki kompatibel karo Python ≥3.5 lan <3.12. Yen sampeyan ngembangake piranti lunak kanggo Linux, deleng syarat tambahan kanggo gcc lan libpython ing Dokumentasi Produk.
Sampeyan bisa ngowahi DOCX menyang akeh format file liyane: