Nambahake tandha banyu menyang Word utawa mbusak tandha banyu sing sadurunge ditambahake nggunakake C++

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

Tambah teks utawa gambar watermark menyang Word dokumen nggunakake C++. Muat Word 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 Word dokumen yen tandha banyu sadurunge ditambahake menyang dokumen, lan alasan kanggo nambah ora relevan maneh.

Ndeleng potongan kode

Word - nambah watermark ing C++

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

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

Mbusak tandha banyu saka Word - C++

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

Nggarap watermark ing Word

Kanggo ngevaluasi carane nambah utawa mbusak tandha banyu ing Word nganggo API C++, muat Word 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:

Nambahake tandha banyu teks utawa gambar menyang DOCX utawa mbusak tandha banyu saka DOCX nggunakake C++
File kudu nambah watermarks
Kode roto
Unggah gambar sing pengin dilebokake
Pilih format target saka dhaptar
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);
Kode roto
  
Nyalin kode C++ menyang clipboard

Carane mbusak watermark ing Word nggunakake C++

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

Pustaka C++ kanggo nggunakake tandha banyu ing DOCX

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.

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.