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 C++. 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.
Kanthi API C++ 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 C++.
Cathetan: ora perlu nginstal aplikasi utawa perpustakaan pihak katelu. Mulane, solusi piranti lunak C++ kita gampang banget digunakake.
SDK C++ 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 C++, banjur nyimpen file output ing format sing trep.
Kanggo ngevaluasi API C++ 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:
using namespace aspose::words::cloud;
auto config = std::make_shared<ApiConfiguration>(
L"####-####-####-####-####", L"##################");
auto wordsApi = std::make_shared<WordsApi>(config);
auto requestDocument = std::shared_ptr<std::istream>(
new std::ifstream(std::filesystem::path(L"Input1.docx"), std::istream::binary));
auto requestImageStream = std::shared_ptr<std::istream>(
new std::ifstream(std::filesystem::path(L"Input2.jpg"), std::istream::binary));
auto requestWatermarkData =
std::make_shared<aspose::words::cloud::models::WatermarkDataImage>();
requestWatermarkData->setImage(
std::make_shared<aspose::words::cloud::models::FileReference>(requestImageStream));
std::shared_ptr<requests::InsertWatermarkOnlineRequest> insertWatermarkRequest(
new requests::InsertWatermarkOnlineRequest(
requestDocument, requestWatermarkData
)
);
auto insertWatermarkResult = wordsApi->InsertWatermarkOnline(insertWatermarkRequest);
auto resultDocument = std::shared_ptr<std::istream>(
insertWatermarkResult->document->values.begin, std::istream::binary));
std::shared_ptr<requests::ConvertDocumentRequest> convertRequest(
new requests::ConvertDocumentRequest(
resultDocument, std::make_shared<std::wstring>(L"docx")
)
);
wordsApi->convertDocument(convertRequest);
using namespace aspose::words::cloud;
auto config = std::make_shared<ApiConfiguration>(
L"####-####-####-####-####", L"##################");
auto wordsApi = std::make_shared<WordsApi>(config);
auto requestDocument = std::shared_ptr<std::istream>(
new std::ifstream(std::filesystem::path(L"Input.docx"), std::istream::binary));
auto requestWatermarkData =
std::make_shared<aspose::words::cloud::models::WatermarkDataText>();
requestWatermarkData->setText(std::make_shared<std::wstring>(L"This is the watermark text"));
requestWatermarkData->setLayout(
std::make_shared<aspose::words::cloud::models::WatermarkDataText::Layout>(
aspose::words::cloud::models::WatermarkDataText::Layout::DIAGONAL));
std::shared_ptr<requests::InsertWatermarkOnlineRequest> insertWatermarkRequest(
new requests::InsertWatermarkOnlineRequest(
requestDocument, requestWatermarkData
)
);
auto insertWatermarkResult = wordsApi->InsertWatermarkOnline(insertWatermarkRequest);
auto resultDocument = std::shared_ptr<std::istream>(
insertWatermarkResult->document->values.begin, std::istream::binary));
std::shared_ptr<requests::ConvertDocumentRequest> convertRequest(
new requests::ConvertDocumentRequest(
resultDocument, std::make_shared<std::wstring>(L"docx")
)
);
wordsApi->convertDocument(convertRequest);
using namespace aspose::words::cloud;
auto config = std::make_shared<ApiConfiguration>(
L"####-####-####-####-####", L"##################");
auto wordsApi = std::make_shared<WordsApi>(config);
auto requestDocument = std::shared_ptr<std::istream>(
new std::ifstream(std::filesystem::path(L"Input.docx"), std::istream::binary));
std::shared_ptr<requests::DeleteWatermarkOnlineRequest> deleteWatermarkOnline(
new requests::DeleteWatermarkOnlineRequest(
requestDocument
)
);
auto deletedWatermark = wordsApi->deleteWatermarkOnline(deleteWatermarkOnline);
auto requestDocument = std::shared_ptr<std::istream>(
deletedWatermark->document->values.begin, std::istream::binary));
std::shared_ptr<requests::ConvertDocumentRequest> convertDocument(
new requests::ConvertDocumentRequest(
requestDocument, std::make_shared<std::wstring>(L"docx")
)
);
wordsApi->convertDocument(convertDocument);
Klone Aspose.Words Cloud SDK for C++ kode sumber saka GitHub. Sampeyan bisa nemokake informasi rinci babagan mbangun lan ngonfigurasi SDK ing bagean "How to use the SDK".
Kanggo entuk kredensial keamanan sing dibutuhake lan ngakses REST API kanthi cepet, tindakake Instructions iki ing dokumentasi.
Deleng Repository Documentation kanggo ndeleng rincian.