Nggunakake C++ API sing kuat, pangembang bisa ngompres HTML kanggo ngoptimalake isi lan ukuran file output. Ngurangi ukuran file dumadi kanthi ngresiki data lan sumber daya sing ora digunakake. Sampeyan uga bisa compress gambar kanggo nggawe ukuran file output malah luwih cilik.
Asil optimasi lan kompresi isi bisa disimpen ing HTML asli utawa format nyimpen sing kasedhiya - DOCX, DOC, RTF, PDF, HTML lan liya-liyane.
Kaya sing wis kasebut, SDK C++ kita ngidini sampeyan nyuda ukuran HTML kanthi program. Lan saiki sampeyan bisa nyoba fungsi sing kuat lan ngevaluasi cara ngompres HTML ing C++ kanthi conto ing ngisor iki:
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.html"), std::istream::binary));
auto requestCompressOptions = std::make_shared<aspose::words::cloud::models::CompressOptions>();
requestCompressOptions->setImagesQuality(std::make_shared<int32_t>(75));
requestCompressOptions->setImagesReduceSizeFactor(std::make_shared<int32_t>(1));
std::shared_ptr<requests::CompressDocumentOnlineRequest> compressDocumentRequest(
new requests::CompressDocumentOnlineRequest(
requestDocument, requestCompressOptions
)
);
auto compressDocument = wordsApi->compressDocumentOnline(compressDocumentRequest);
auto requestDocument = std::shared_ptr<std::istream>(
compressDocument->document->values.begin, std::istream::binary));
std::shared_ptr<requests::ConvertDocumentRequest> convertDocument(
new requests::ConvertDocumentRequest(
requestDocument, std::make_shared<std::wstring>(L"html")
)
);
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.
Sampeyan bisa nindakake kompresi dokumen kanggo format file liyane: