Đây là một giải pháp chuyên nghiệp để tối ưu hóa và nén EPUB trong C++. Sử dụng C++ để tối đa hóa EPUB tốc độ tối ưu hóa / nén. Hãy thử nó trực tuyến miễn phí!
Chúng tôi hiện không chấp nhận tệp DOCX làm đầu vào. Nhưng chúng tôi có thể sản xuất các tệp DOCX như một sự bổ sung. Chúng tôi mong muốn được ủng hộ DOCX đầy đủ trong thời gian sắp tới.
Thư viện C++ là một giải pháp độc lập và không yêu cầu cài đặt bất kỳ phần mềm bên thứ ba nào.
Thu nhỏ tệp DOCX mà không làm giảm chất lượng. Thư viện C++ cung cấp cho các nhà phát triển một API tích hợp để tối ưu hóa nội dung DOCX. Tối ưu hóa DOCX xảy ra bằng cách nén hình ảnh bên trong tệp DOCX, cũng như bằng cách xóa dữ liệu không sử dụng.
Việc nén không mất dữ liệu điện tử và tối ưu hóa nội dung trở nên dễ dàng với 'Aspose.Words for C++'. Ví dụ sau minh họa cách tối ưu hóa nội dung của tệp DOCX trong C++:
dotnet add package Aspose.Words.Cpp
Sao chép
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())
{
// Tùy nhà phát triển chọn thư viện để nén ảnh.
auto image = System::Drawing::Image::Fromstream(shape->get_ImageData()->ToStream());
// ...
// Nén hình ảnh và đặt nó trở lại hình dạng.
shape->get_ImageData()->SetImage("yourCompressedImage");
}
}
doc->Save(u"Output.epub");
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())
{
// Tùy nhà phát triển chọn thư viện để nén ảnh.
auto image =
System::Drawing::Image::FromStream(shape->get_ImageData()->ToStream());
// ...
// Nén hình ảnh và đặt nó trở lại hình dạng.
shape->get_ImageData()->SetImage("yourCompressedImage");
}
}
auto saveOptions = MakeObject<PdfSaveOptions>();
saveOptions->set_CacheBackgroundGraphics(true);
doc->Save(u"Output.epub", 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())
{
// Tùy nhà phát triển chọn thư viện để nén ảnh.
auto image = System::Drawing::Image::Fromstream(shape->get_ImageData()->ToStream());
// ...
// Nén hình ảnh và đặt nó trở lại hình dạng.
shape->get_ImageData()->SetImage("yourCompressedImage");
}
}
doc->Save(u"Output.epub");
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())
{
// Tùy nhà phát triển chọn thư viện để nén ảnh.
auto image =
System::Drawing::Image::FromStream(shape->get_ImageData()->ToStream());
// ...
// Nén hình ảnh và đặt nó trở lại hình dạng.
shape->get_ImageData()->SetImage("yourCompressedImage");
}
}
auto saveOptions = MakeObject<OoxmlSaveOptions>();
saveOptions->set_CompressionLevel(CompressionLevel::Maximum);
doc->Save(u"Output.epub", 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.epub", saveOptions);
Có ba tùy chọn để cài đặt Aspose.Words for C++ vào môi trường nhà phát triển của bạn. Vui lòng chọn một cái giống với nhu cầu của bạn và làm theo hướng dẫn từng bước:
Bạn có thể sử dụng thư viện C++ này để phát triển phần mềm trên Microsoft Windows, Linux và macOS:
Nếu bạn phát triển phần mềm cho Linux hoặc macOS, vui lòng kiểm tra thông tin về các phụ thuộc thư viện bổ sung (gói mã nguồn mở fontconfig và mesa-glu) trong Tài liệu Sản phẩm.