جعل الملفات الكبيرة أصغر دون فقدان الجودة. احذف البيانات غير الضرورية وغير المستخدمة. تقليص حجم ملفات Word و HTML في C++. توفر مكتبة C++ للمطورين واجهة برمجة تطبيقات متكاملة لتحسين المستندات بتنسيقات مختلفة.
تعد مكتبة C++ حلاً مستقلاً ولا تتطلب تثبيت أي برنامج تابع لجهة خارجية.
يمكن الحصول على أقصى تأثير من خلال تحسين الصور عالية الدقة، وكذلك المستندات التي تحتوي على مثل هذه الصور. ستساعدك مكتبة C++ على ضغط ملفات HTML و DOCX و DOC و RTF و ODT و EPUB و HTML و JPG و PNG.
أصبح تحسين المستندات دون فقدان الجودة أمرًا سهلاً باستخدام 'Aspose.Words for C++'. يوضح المثال التالي كيفية تقليص حجم Word في C++:
dotnet add package Aspose.Words.Cpp
ينسخ
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())
{
// الأمر متروك للمطور لاختيار المكتبة لضغط الصور.
auto image =
System::Drawing::Image::FromStream(shape->get_ImageData()->ToStream());
// ...
// ضغط الصورة وإعادتها إلى الشكل.
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())
{
// الأمر متروك للمطور لاختيار المكتبة لضغط الصور.
auto image =
System::Drawing::Image::FromStream(shape->get_ImageData()->ToStream());
// ...
// ضغط الصورة وإعادتها إلى الشكل.
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())
{
// الأمر متروك للمطور لاختيار المكتبة لضغط الصور.
auto image = System::Drawing::Image::Fromstream(shape->get_ImageData()->ToStream());
// ...
// ضغط الصورة وإعادة وضعها على الشكل.
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())
{
// الأمر متروك للمطور لاختيار المكتبة لضغط الصور.
auto image =
System::Drawing::Image::FromStream(shape->get_ImageData()->ToStream());
// ...
// ضغط الصورة وإعادتها إلى الشكل.
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);
هناك ثلاثة خيارات لتثبيت Aspose.Words for C++ في بيئة المطور لديك. يرجى اختيار واحد يناسب احتياجاتك واتبع التعليمات خطوة بخطوة:
يمكنك استخدام مكتبة C++ هذه لتطوير البرامج على Microsoft Windows و Linux و macOS:
إذا قمت بتطوير برنامج لنظام التشغيل Linux أو macOS، فالرجاء التحقق من المعلومات حول التبعيات الإضافية للمكتبة (fontconfig mesa-glu مفتوحة المصدر) في وثائق المنتج.