Nalika pangembang ngowahi PDF dokumen nganggo perpustakaan C++ iki, sing lagi diowahi yaiku Model Obyek Dokumen (DOM). Dadi, meh kabeh owah-owahan bisa ditindakake kanggo PDF dokumen sing diwakili minangka DOM. Kanthi C++ SDK sing disedhiyakake, pangembang bisa kanthi gampang nyunting dokumen: ngowahi teks, nganyari tabel, nambah gambar lan liya-liyane. Cukup mbukak PDF, gawe owah-owahan sing dibutuhake kanthi program lan ekspor asil menyang format nyimpen sing padha utawa sing didhukung.
Pustaka C++ kita menehi pangembang kemampuan kanggo ngowahi PDF dokumen kanthi langsung kanthi nyunting Document Object Model (DOM), tegese ora ana piranti lunak tambahan sing kudu diinstal.
Kasus sing paling populer kanggo nyunting PDF file yaiku nyunting teks. Kanthi solusi piranti lunak sing diwenehake, sampeyan bisa nambah, ngowahi utawa mbusak teks nggunakake C++ ing dokumen kasebut.
Pilihan editing PDF liyane sing populer yaiku nyunting tabel. C++ SDK kita ngidini sampeyan nggarap tabel lan teks ing sel tabel.
Pangembang C++ bisa nambah utawa mbusak sel tabel lan tabel, uga nambah, ngowahi lan mbusak teks ing njero.
Saliyane nyunting teks lan tabel ing PDF, ana pilihan umum liyane: nambahake gambar menyang dokumen ing C++. Pangembang C++ uga bisa nambah gambar menyang PDF file nggunakake DOM.
Coba C++ SDK sing kuat iki lan evaluasi sawetara opsi ing panyuntingan PDF dokumen. Nggunakake conto ing ngisor iki, muat PDF dokumen lan gawe sawetara owah-owahan: nambah teks, nambah tabel lan sel tabel kanthi teks utawa lebokake gambar menyang PDF dokumen:
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.pdf"), std::istream::binary));
auto requestParagraph = std::make_shared<aspose::words::cloud::models::ParagraphInsert>();
requestParagraph->setText(std::make_shared<std::wstring>(L"Morbi enim nunc faucibus a."));
std::shared_ptr<requests::InsertParagraphOnlineRequest> insertParagraphRequest(
new requests::InsertParagraphOnlineRequest(
requestDocument, requestParagraph
)
);
auto insertParagraph = wordsApi->insertParagraphOnline(insertParagraphRequest);
std::shared_ptr<requests::ConvertDocumentRequest> convertRequest(
new requests::ConvertDocumentRequest(
insertParagraph->document->values.begin,
std::make_shared<std::wstring>(L"pdf")
)
);
auto convert = 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.pdf"), std::istream::binary));
auto requestTable = std::make_shared<aspose::words::cloud::models::TableInsert>();
requestTable->setColumnsCount(std::make_shared<int32_t>(1));
requestTable->setRowsCount(std::make_shared<int32_t>(2));
std::shared_ptr<requests::InsertTableOnlineRequest> insertTableRequest(
new requests::InsertTableOnlineRequest(
requestDocument, requestTable, std::make_shared<std::wstring>(L"")
)
);
auto insertTable = wordsApi->insertTableOnline(insertTableRequest);
std::shared_ptr<requests::ConvertDocumentRequest> convertRequest(
new requests::ConvertDocumentRequest(
insertTable->document->values.begin,
std::make_shared<std::wstring>(L"pdf")
)
);
auto convert = 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"Input1.pdf"), std::istream::binary));
auto requestDrawingObject =
std::make_shared<aspose::words::cloud::models::DrawingObjectInsert>();
requestDrawingObject->setHeight(std::make_shared<double>(0));
requestDrawingObject->setLeft(std::make_shared<double>(0));
requestDrawingObject->setTop(std::make_shared<double>(0));
requestDrawingObject->setWidth(std::make_shared<double>(0));
requestDrawingObject->setRelativeHorizontalPosition(
std::make_shared<aspose::words::cloud::models::DrawingObjectInsert::RelativeHorizontalPosition>(
aspose::words::cloud::models::DrawingObjectInsert::RelativeHorizontalPosition::MARGIN));
requestDrawingObject->setRelativeVerticalPosition(
std::make_shared<aspose::words::cloud::models::DrawingObjectInsert::RelativeVerticalPosition>(
aspose::words::cloud::models::DrawingObjectInsert::RelativeVerticalPosition::MARGIN));
requestDrawingObject->setWrapType(
std::make_shared<aspose::words::cloud::models::DrawingObjectInsert::WrapType>(
aspose::words::cloud::models::DrawingObjectInsert::WrapType::INLINE));
auto requestImageFile = std::shared_ptr<std::istream>(new std::ifstream(
std::filesystem::path(L"Input2.pdf"), std::istream::binary));
std::shared_ptr<requests::InsertDrawingObjectOnlineRequest> insertDrawingObjectRequest(
new requests::InsertDrawingObjectOnlineRequest(
requestDocument, requestDrawingObject, requestImageFile,
std::make_shared<std::wstring>(L"sections/0")
)
);
auto insertDrawingObject = wordsApi->insertDrawingObjectOnline(insertDrawingObjectRequest);
std::shared_ptr<requests::ConvertDocumentRequest> convertRequest(
new requests::ConvertDocumentRequest(
insertDrawingObject->document->values.begin,
std::make_shared<std::wstring>(L"pdf")
)
);
auto convert = wordsApi->convertDocument(convertRequest);
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.
Sampeyan bisa nindakake operasi suntingan kanggo format file liyane: