Nambahake tandha banyu menyang DOC utawa mbusak tandha banyu sing sadurunge ditambahake nggunakake Java

Nganggo perpustakaan Java iki, cap DOC dokumen nganggo gambar utawa teks banyu utawa mbusak tandha banyu sing wis ditambahake ing sawetara langkah.

Tambah teks utawa gambar watermark menyang DOC dokumen nggunakake Java. Muat DOC dokumen lan lebokake tandha banyu sing dibutuhake. Banjur simpen asil ing format sing trep kayata DOCX, PDF, MD, HTML, TXT, DOC, RTF, EPUB, XPS lan liya-liyane, lan nuduhake dokumen sing diwenehi tandha banyu karo wong liya. Uga mbusak tandha banyu saka DOC dokumen yen tandha banyu sadurunge ditambahake menyang dokumen, lan alasan kanggo nambah ora relevan maneh.

Ndeleng potongan kode

DOC - nambah watermark ing Java

Kanthi API Java iki, pangembang bisa nambah tandha banyu menyang DOC online. Mung nggawe watermark nggunakake teks utawa gambar banjur lebokake watermark menyang DOC dokumen ing Java.

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

Mbusak tandha banyu saka DOC - Java

SDK Java sing diwenehake uga mbiyantu mbusak tandha banyu saka DOC. Mbusak tandha banyu ing DOC tegese sampeyan bisa mbukak DOC dokumen sing dipengini kanthi prangko teks utawa gambar, mbusak tandha banyu iki saka DOC nggunakake Java, banjur simpen file output ing format sing trep - DOC, DOCX, PDF, JPEG, PNG, TIFF lan liya-liyane.

Nggarap watermark ing DOC

Kanggo ngevaluasi carane nambah utawa mbusak tandha banyu ing DOC nganggo API Java, muat DOC lan tandha banyu minangka gambar utawa teks. Banjur pilih format file ekspor sing trep - DOC, DOCX, PDF, HTML, RTF, 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 com.aspose.words.cloud.*;

ApiClient apiClient = new ApiClient("####-####-####-####-####", "##################", null);
WordsApi wordsApi = new WordsApi(apiClient);

byte[] requestDocument = Files.readAllBytes(Paths.get("Input1.doc").toAbsolutePath());
byte[] requestImageStream = Files.readAllBytes(Paths.get("Input2.jpg").toAbsolutePath());
WatermarkDataImage requestWatermarkData = new WatermarkDataImage();
requestWatermarkData.setImage(new FileReference(requestImageStream));
InsertWatermarkOnlineRequest insertWatermarkRequest =
    new InsertWatermarkOnlineRequest(requestDocument, requestWatermarkData,
        null, null, null, null, null, null, null, null);
InsertWatermarkOnlineResponse insertWatermarkResult =
    wordsApi.InsertWatermarkOnline(insertWatermarkRequest);

ConvertDocumentRequest convertRequest = new ConvertDocumentRequest(
    insertWatermarkResult.getDocument().iterator().next(), "doc",
        null, null, null, null, null, null, null);
wordsApi.convertDocument(convertRequest);
import com.aspose.words.cloud.*;

ApiClient apiClient = new ApiClient("####-####-####-####-####", "##################", null);
WordsApi wordsApi = new WordsApi(apiClient);

byte[] requestDocument = Files.readAllBytes(Paths.get("Input.doc").toAbsolutePath());
WatermarkDataText requestWatermarkData = new WatermarkDataText();
requestWatermarkData.setText("This is the watermark text");
requestWatermarkData.setLayout(WatermarkDataText.LayoutEnum.DIAGONAL);
InsertWatermarkOnlineRequest insertWatermarkRequest =
    new InsertWatermarkOnlineRequest(requestDocument, requestWatermarkData,
        null, null, null, null, null, null);
InsertWatermarkOnlineResponse insertWatermarkResult =
    wordsApi.InsertWatermarkOnline(insertWatermarkRequest);

ConvertDocumentRequest convertRequest = new ConvertDocumentRequest(
    insertWatermarkResult.getDocument().iterator().next(), "doc",
        null, null, null, null, null, null, null);
wordsApi.convertDocument(convertRequest);
import com.aspose.words.cloud.*;

ApiClient apiClient = new ApiClient("####-####-####-####-####", "##################", null);
WordsApi wordsApi = new WordsApi(apiClient);

byte[] requestDocument = Files.readAllBytes(Paths.get("Input.doc").toAbsolutePath());
DeleteWatermarkOnlineRequest deleteWatermarkOnline = 
   new DeleteWatermarkOnlineRequest(requestDocument, null, null, null, null, null, null);
DeleteWatermarkOnline deletedWatermark = wordsApi.deleteWatermarkOnline(deleteWatermarkOnline);

ConvertDocumentRequest convertDocument = new ConvertDocumentRequest(
   deletedWatermark.getDocument().iterator().next(), "doc", 
      null, null, null, null, null, null, null);
wordsApi.convertDocument(convertDocument);
Kode roto
  
Nyalin kode Java menyang clipboard

Carane mbusak watermark ing DOC nggunakake Java

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

Pustaka Java kanggo nggunakake tandha banyu ing DOC

Instal 'Aspose.Words Cloud SDK for Java' nggunakake alat otomatisasi mbangun Maven.

Tambah ketergantungan iki menyang POM proyek sampeyan: aspose-cloud artifact.aspose-cloud-releases http://artifact.aspose.cloud/repo com.aspose aspose-words-cloud 22.4.0

Minangka alternatif, sampeyan bisa clone Aspose.Words Cloud SDK for Java 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 file liyane sing didhukung

Sampeyan bisa nambah watermark menyang dokumen ing format liyane:

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.