Tambah teks utawa gambar watermark menyang DOC dokumen nggunakake JavaScript. 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.
Kanthi API Node iki, pangembang bisa nambah tandha banyu menyang DOC online. Mung nggawe watermark nggunakake teks utawa gambar banjur lebokake watermark menyang DOC dokumen ing JavaScript.
Cathetan: ora perlu nginstal aplikasi utawa perpustakaan pihak katelu. Mulane, solusi piranti lunak Node kita gampang banget digunakake.
SDK Node 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 JavaScript, banjur simpen file output ing format sing trep - DOC, DOCX, PDF, JPEG, PNG, TIFF lan liya-liyane.
Kanggo ngevaluasi carane nambah utawa mbusak tandha banyu ing DOC nganggo API Node, 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:
import * as fs from "fs";
const wordsApi = new WordsApi("####-####-####-####-####", "##################");
const requestDocument = fs.createReadStream("Input1.doc");
const requestImageStream = fs.createReadStream("Input2.jpg");
const requestWatermarkData = new model.WatermarkDataImage({
image: model.FileReference.fromLocalFileContent(requestImageStream)
});
const insertWatermarkRequest = new model.InsertWatermarkOnlineRequest({
document: requestDocument,
watermarkData: requestWatermarkData
});
wordsApi.InsertWatermarkOnline(insertWatermarkRequest)
.then((insertWatermarkResult) => {
console.log("Result of InsertWatermarkImageOnline: ", insertWatermarkResult);
const convertRequest = new model.ConvertDocumentRequest({
document: insertWatermarkResult.Document.Values(),
format: "doc"
});
wordsApi.convertDocument(convertRequest)
.then((convertResult) => {
console.log("Result of ConvertDocument: ", convertResult);
});
});
import * as fs from "fs";
const wordsApi = new WordsApi("####-####-####-####-####", "##################");
const requestDocument = fs.createReadStream("Input.doc");
const requestWatermarkData = new model.WatermarkDataText({
text: "This is the watermark text",
layout: model.WatermarkDataText.LayoutEnum.Diagonal
})
const insertWatermarkRequest = new model.InsertWatermarkOnlineRequest({
document: requestDocument,
watermarkData: requestWatermarkData
});
wordsApi.insertWatermarkOnline(insertWatermarkRequest)
.then((insertWatermarkResult) => {
console.log("Result of InsertWatermarkTextOnline: ", insertWatermarkResult);
const convertRequest = new model.ConvertDocumentRequest({
document: insertWatermarkResult.Document.Values(),
format: "doc"
});
wordsApi.convertDocument(convertRequest)
.then((convertResult) => {
console.log("Result of ConvertDocument: ", convertResult);
});
});
import * as fs from "fs";
const wordsApi = new WordsApi("####-####-####-####-####", "##################");
const requestDocument = fs.createReadStream("Input.doc");
const deleteWatermarkOnline = new model.DeleteWatermarkOnlineRequest({
document: requestDocument
});
wordsApi.deleteWatermarkOnline(deleteWatermarkOnline)
.then((deleteWatermarkOnlineResult) => {
console.log("Result of DeleteWatermarkOnline: ", deleteWatermarkOnlineResult);
const requestDocument = deleteWatermarkOnlineResult.Document.Values();
const convertDocument = new model.ConvertDocumentRequest({
document: requestDocument,
format: "doc"
});
wordsApi.convertDocument(convertDocument)
.then((convertDocumentResult) => {
console.log("Result of ConvertDocument: ", convertDocumentResult);
});
});
Instal 'Aspose.Words Cloud SDK for Node.js' nggunakake manajer paket NPM. npm install asposewordscloud --save saka baris perintah kanggo nginstal SDK liwat manajer paket NPM. Minangka alternatif, sampeyan bisa kanthi manual kloning Aspose.Words Cloud SDK for Node.js 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 liyane.
Sampeyan bisa nambah watermark menyang dokumen ing format liyane: