Iki minangka solusi profesional kanggo ngoptimalake lan ngompres HTML ing C++. Gunakake C++ kanggo maksimalake kacepetan optimasi/komprèsi HTML. Coba online gratis!
Nggawe HTML file gedhe luwih cilik tanpa mundhut kualitas. Mbusak data sing ora perlu lan ora digunakake. Nyilikake ukuran HTML file ing kode. Pustaka C++ nyedhiyakake pangembang API terpadu kanggo ngoptimalake isi HTML.
Perpustakaan C++ minangka solusi mandiri lan ora mbutuhake piranti lunak pihak katelu sing diinstal.
Kompresi lossless lan optimasi isi jero digawe gampang karo 'Aspose.Words for C++'. Conto ing ngisor iki nuduhake carane ngoptimalake isi HTML file ing C++:
dotnet add package Aspose.Words.Cpp
Nyalin
using namespace Aspose::Words;
auto doc = MakeObject<Document>(u"Input.html");
doc->Cleanup();
auto nodes = doc->GetChildNodes(NodeType::Shape, true);
for (const auto& shape : System::IterateOver<Shape>(nodes))
{
if (shape->get_HasImage())
{
// Terserah pangembang kanggo milih perpustakaan kanggo kompresi gambar.
auto image = System::Drawing::Image::Fromstream(shape->get_ImageData()->ToStream());
// ...
// Kompres gambar lan setel maneh menyang wangun.
shape->get_ImageData()->SetImage("yourCompressedImage");
}
}
doc->Save(u"Output.html");
using namespace Aspose::Words;
auto doc = MakeObject<Document>(u"Input.html");
doc->Cleanup();
auto nodes = doc->GetChildNodes(NodeType::Shape, true);
for (const auto& shape : System::IterateOver<Shape>(nodes))
{
if (shape->get_HasImage())
{
// Iku nganti pangembang kanggo milih perpustakaan kanggo komprèsi gambar.
auto image =
System::Drawing::Image::FromStream(shape->get_ImageData()->ToStream());
// ...
// Compress gambar lan nyetel maneh menyang wangun.
shape->get_ImageData()->SetImage("yourCompressedImage");
}
}
auto saveOptions = MakeObject<PdfSaveOptions>();
saveOptions->set_CacheBackgroundGraphics(true);
doc->Save(u"Output.html", saveOptions);
using namespace Aspose::Words;
auto doc = MakeObject<Document>(u"Input.html");
doc->Cleanup();
auto nodes = doc->GetChildNodes(NodeType::Shape, true);
for (const auto& shape : System::IterateOver<Shape>(nodes))
{
if (shape->get_HasImage())
{
// Terserah pangembang kanggo milih perpustakaan kanggo kompresi gambar.
auto image = System::Drawing::Image::Fromstream(shape->get_ImageData()->ToStream());
// ...
// Kompres gambar lan setel maneh menyang wangun.
shape->get_ImageData()->SetImage("yourCompressedImage");
}
}
doc->Save(u"Output.html");
using namespace Aspose::Words;
auto doc = MakeObject<Document>(u"Input.html");
doc->Cleanup();
auto nodes = doc->GetChildNodes(NodeType::Shape, true);
for (const auto& shape : System::IterateOver<Shape>(nodes))
{
if (shape->get_HasImage())
{
// Iku nganti pangembang kanggo milih perpustakaan kanggo komprèsi gambar.
auto image =
System::Drawing::Image::FromStream(shape->get_ImageData()->ToStream());
// ...
// Compress gambar lan nyetel maneh menyang wangun.
shape->get_ImageData()->SetImage("yourCompressedImage");
}
}
auto saveOptions = MakeObject<OoxmlSaveOptions>();
saveOptions->set_CompressionLevel(CompressionLevel::Maximum);
doc->Save(u"Output.html", saveOptions);
using namespace Aspose::Words;
auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
auto shape = builder->InsertImage(u"Input.html");
auto saveOptions = MakeObject<ImageSaveOptions>(SaveFormat::Html);
shape->GetShapeRenderer()->Save(u"Output.html", saveOptions);
Ana telung opsi kanggo nginstal Aspose.Words for C++ kanggo lingkungan pangembang. Pilih salah siji sing cocog karo kabutuhan sampeyan lan tindakake pandhuan langkah demi langkah:
Sampeyan bisa nggunakake perpustakaan C++ iki kanggo nggawe piranti lunak ing Microsoft Windows, Linux lan macOS:
Yen sampeyan nggawe piranti lunak kanggo Linux utawa macOS, priksa informasi babagan katergantungan perpustakaan tambahan (fontconfig lan paket sumber terbuka mesa-glu) ing Dokumentasi Produk.
Sampeyan bisa ngoptimalake file ing akeh format file liyane: