Nggunakake C# API sing kuat, pangembang bisa ngompres DOCX 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 DOCX asli utawa format nyimpen sing kasedhiya - DOCX, DOC, RTF, PDF, HTML lan liya-liyane.
Kaya sing wis kasebut, SDK .NET kita ngidini sampeyan nyuda ukuran DOCX kanthi program. Lan saiki sampeyan bisa nyoba fungsi sing kuat lan ngevaluasi cara ngompres DOCX ing C# kanthi conto ing ngisor iki:
using Aspose.Words;
var config = new Configuration { ClientId = "####-####-####-####-####",
ClientSecret = "##################" };
var wordsApi = new WordsApi(config);
using var requestDocument = File.OpenRead("Input.docx");
var requestCompressOptions = new CompressOptions()
{
ImagesQuality = 75,
ImagesReduceSizeFactor = 1
};
var compressDocumentRequest = new CompressDocumentOnlineRequest(requestDocument,
requestCompressOptions);
var compressDocument = await wordsApi.CompressDocumentOnline(compressDocumentRequest);
var convertDocument =
new ConvertDocumentRequest(compressDocument.Document.Values.First(), "docx");
await wordsApi.ConvertDocument(convertDocument);
Instal 'Aspose.Words Cloud SDK for .NET' nggunakake manajer paket NuGet. Mung mbukak nuget install Aspose.Words-Cloud otomatis nginstal lan ngrujuk perakitan sing cocog ing proyek sampeyan. Minangka alternatif, sampeyan bisa kanthi manual tiron Aspose.Words Cloud SDK for .NET kode sumber saka GitHub lan nggunakake ing project. Tututi Instructions iki supaya cepet entuk kredensial keamanan sing dibutuhake lan ngakses REST API kita.
Deleng Repository Documentation kanggo ndeleng rincian liyane.
Sampeyan bisa nindakake kompresi dokumen kanggo format file liyane: