Tambah tandha banyu menyang PDF file utawa Word utawa mbusak tandha banyu sing wis ditambahake sadurunge nggunakake Python

Kanthi perpustakaan Python iki, pangembang bisa nambahake gambar utawa watermark teks ing PDF dokumen utawa Word, uga mbusak tandha banyu sing wis ditambahake sajrone sawetara detik.

Nglindhungi dokumen saka distribusi ora sah lan nambah watermark online. Kanggo nindakake iki, mung mbukak PDF, Word utawa format dokumen liyane lan tambahake teks utawa watermark gambar nggunakake Python. Banjur simpen PDF dokumen utawa Word sing ditandhani banyu ing format sing trep kayata DOC, DOCX, PDF, HTML, RTF, XPS lan liya-liyane. Sampeyan uga bisa mbusak tandha banyu saka dokumen supaya luwih gampang diproses kajaba nglanggar hak sapa wae.

Ndeleng potongan kode

Tambah watermark ing Python

Kanthi API Python iki, pangembang bisa nambah tandha banyu menyang PDF, Word, utawa dokumen liyane kanthi online. Sampeyan bisa nggawe tandha banyu nggunakake teks utawa gambar banjur lebokake tandha banyu kasebut menyang PDF dokumen utawa Word kanthi nyetel sudut overlay ing Python.

Cathetan: ora perlu nginstal aplikasi utawa perpustakaan pihak katelu. Mulane, solusi piranti lunak Python kita gampang banget digunakake.

Mbusak tandha banyu ing Python

SDK Python sing diwenehake uga mbantu mbusak tandha banyu. Contone, mbusak watermark ing Word tegese sampeyan bisa mbukak Word dokumen sing dipengini kanthi prangko teks utawa watermark gambar, mbusak tandha banyu iki saka dokumen nggunakake Python, banjur nyimpen file output ing format sing trep.

Watermark ing Word utawa PDF

Kanggo ngevaluasi API Python kita, muat dokumen sing pengin ditambahake watermark lan watermark minangka gambar utawa teks. Banjur pilih format file ekspor sing trep - DOCX, PDF, MD, HTML, TXT, DOC, RTF, EPUB, XPS lan liya-liyane.

Gunakake conto ing ngisor iki kanggo ndeleng cara kerjane:

File kudu nambah watermarks
Kode roto
Unggah gambar sing pengin dilebokake
Pilih format target saka dhaptar
import asposewordscloud

words_api = WordsApi(
    client_id = '####-####-####-####-####', client_secret = '##################')

request_document = open('Input1.docx', 'rb')
request_image_stream = open('Input2.jpg', 'rb')
request_watermark_data = asposewordscloud.WatermarkDataImage(
    image=asposewordscloud.FileReference.fromLocalFileContent(request_image_stream))
insert_watermark_request = asposewordscloud.models.requests.InsertWatermarkOnlineRequest(
    document=request_document, watermark_data=request_watermark_data)
insert_watermark_result = words_api.insert_watermark_online(insert_watermark_request)

convert_document_request = asposewordscloud.models.requests.ConvertDocumentRequest(
    document=list(insert_watermark_result.document.values())[0], format='docx')
words_api.convert_document(convert_document_request)
import asposewordscloud

words_api = WordsApi(
    client_id = '####-####-####-####-####', client_secret = '##################') 

request_document = open('Input.docx', 'rb')
request_watermark_data = asposewordscloud.WatermarkDataText(
    text='This is the watermark text',
    layout='Diagonal')
insert_watermark_request = asposewordscloud.models.requests.InsertWatermarkOnlineRequest(
    document=request_document, watermark_data=request_watermark_data)
insert_watermark_result = words_api.insert_watermark_online(insert_watermark_request)

convert_document_request = asposewordscloud.models.requests.ConvertDocumentRequest(
    document=list(insert_watermark_result.document.values())[0], format='docx')
words_api.convert_document(convert_document_request)
import asposewordscloud

words_api = WordsApi(
   client_id = '####-####-####-####-####', client_secret = '##################') 

request_document = open('Input.docx', 'rb')
delete_watermark_online = asposewordscloud.models.requests.DeleteWatermarkOnlineRequest(
   document=request_document)
deleted_watermark = words_api.delete_watermark_online(delete_watermark_online)

convert_document = asposewordscloud.models.requests.ConvertDocumentRequest(
   document=list(deleted_watermark.document.values())[0], format='docx')
words_api.convert_document(convert_document)
Kode roto
  
Nyalin kode Python menyang clipboard

Carane mbusak watermark ing Python

  1. Pasang Aspose.Words Cloud for Python
  2. Tambah referensi perpustakaan (ngimpor perpustakaan) menyang proyek Python sampeyan
  3. Konfigurasi API nggunakake tombol app
  4. Muat dokumen sing pengin dibusak saka watermark
  5. Nggawe panjalukan kanggo mbusak watermark
  6. Simpen asil menyang format file sing trep

Python perpustakaan kanggo nggunakake watermarks

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.

Requirements Sistem

Deleng Repository Documentation kanggo ndeleng rincian.

Format dokumen paling populer kanggo nambah watermark

5%

Langganan kanggo Aspose Update Product

Entuk buletin saben wulan lan tawaran langsung dikirim menyang kothak layang.

© Aspose Pty Ltd 2001-2024. Kabeh hak dilindhungi undhang-undhang.