Gunakake C++ kanggo entuk kacepetan pangolahan dokumen maksimal. Iki minangka solusi sing kuat kanggo ngompres Word, dokumen Web ing C++. Coba online gratis!
Nggawe file gedhe luwih cilik tanpa mundhut kualitas. Mbusak data sing ora perlu lan ora digunakake. Nyilikake ukuran Word file lan HTML ing C++. C++ nyedhiyakake pangembang API terpadu kanggo ngoptimalake dokumen ing macem-macem format.
C++ iki minangka solusi mandiri lan ora mbutuhake piranti lunak pihak katelu sing diinstal.
Efek maksimal bisa dipikolehi kanthi ngoptimalake gambar kanthi resolusi dhuwur, uga dokumen sing ngemot gambar kasebut. C++ bakal mbantu sampeyan ngompres file DOCX, DOC, RTF, ODT, EPUB, HTML, JPG, PNG.
Optimization saka dokumen tanpa mundhut saka kualitas digawe gampang karo 'Aspose.Words for C++'. Conto ing ngisor iki nuduhake carane nyilikake ukuran Word dokumen ing C++:
dotnet add package Aspose.Words.Cpp
Nyalin
using namespace Aspose::Words;
auto doc = MakeObject<Document>(u"Input.docx");
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.docx", saveOptions);
using namespace Aspose::Words;
auto doc = MakeObject<Document>(u"Input.docx");
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.docx", saveOptions);
using namespace Aspose::Words;
auto doc = MakeObject<Document>(u"Input.docx");
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.docx");
using namespace Aspose::Words;
auto doc = MakeObject<Document>(u"Input.docx");
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.docx", saveOptions);
using namespace Aspose::Words;
auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
auto shape = builder->InsertImage(u"Input.docx");
auto saveOptions = MakeObject<ImageSaveOptions>(SaveFormat::Docx);
shape->GetShapeRenderer()->Save(u"Output.docx", 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.