Tambah teks utawa gambar watermark menyang DOC dokumen nggunakake PHP. 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 PHP iki, pangembang bisa nambah tandha banyu menyang DOC online. Mung nggawe watermark nggunakake teks utawa gambar banjur lebokake watermark menyang DOC dokumen ing PHP.
Cathetan: ora perlu nginstal aplikasi utawa perpustakaan pihak katelu. Mulane, solusi piranti lunak PHP kita gampang banget digunakake.
SDK PHP 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 PHP, 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 PHP, 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:
use Aspose\Words\WordsApi;
$wordsApi = new WordsApi('####-####-####-####-####', '##################');
$requestDocument = "Input1.doc";
$requestImageFile = "Input2.jpg";
$requestWatermarkData = new WatermarkDataImage(array(
"image" => FileReference::fromLocalFileContent($requestImageFile)
));
$insertWatermarkRequest = new InsertWatermarkOnlineRequest(
$requestDocument, $requestWatermarkData, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
);
$insertWatermarkResult = $wordsApi->insertWatermarkOnline($insertWatermarkRequest);
$convertRequest = new ConvertDocumentRequest(
$insertWatermarkResult->document()->values(), "doc",
NULL, NULL, NULL, NULL, NULL, NULL, NULL
);
$wordsApi->convertDocument($convertRequest);
use Aspose\Words\WordsApi;
$wordsApi = new WordsApi('####-####-####-####-####', '##################');
$requestDocument = "Input.doc";
$requestWatermarkData = new WatermarkDataText(array(
"text" => "This is the watermark text",
"layout" => "Diagonal"
));
$insertWatermarkRequest = new InsertWatermarkOnlineRequest(
$requestDocument, $requestWatermarkData, NULL, NULL, NULL, NULL, NULL, NULL
);
$insertWatermarkResult = $wordsApi->insertWatermarkOnline($insertWatermarkRequest);
$convertRequest = new ConvertDocumentRequest(
$insertWatermarkResult->document()->values(), "doc",
NULL, NULL, NULL, NULL, NULL, NULL, NULL
);
$wordsApi->convertDocument($convertRequest);
use Aspose\Words\WordsApi;
$wordsApi = new WordsApi('####-####-####-####-####', '##################');
$requestDocument = "Input.doc";
$deleteWatermarkOnline = new DeleteWatermarkOnlineRequest(
$requestDocument, NULL, NULL, NULL, NULL, NULL, NULL
);
$deletedWatermark = $wordsApi->deleteWatermarkOnline($deleteWatermarkOnline);
$convertDocument = new ConvertDocumentRequest(
$deletedWatermark->document()->values(), "doc", NULL, NULL, NULL, NULL, NULL, NULL, NULL
);
$wordsApi->convertDocument($convertDocument);
Instal 'Aspose.Words Cloud SDK for PHP' saka gudang Packagist. Mung mbukak composer require aspose-cloud/aspose-words-cloud kanggo nginstal SDK, banjur gunakake require_once('vendor/autoload.php'); kanggo ngimpor menyang proyek sampeyan.
Minangka alternatif, sampeyan bisa kanthi manual kloning Aspose.Words Cloud SDK for PHP saka GitHub. Tututi Instructions iki supaya cepet entuk kredensial keamanan sing dibutuhake lan ngakses REST API kita.
PHP 7.1 utawa luwih anyar
Deleng Repository Documentation kanggo ndeleng rincian liyane.
Sampeyan bisa nambah watermark menyang dokumen ing format liyane: