Nggunakake REST API ing Ruby, pangembang bisa ngompres Word kanthi program. Kanthi solusi sing diwenehake, output bakal dadi file berkualitas tinggi sawise kompresi.
Nggunakake Ruby API sing kuat, pangembang bisa ngompres Word 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 Word asli utawa format nyimpen sing kasedhiya - DOCX, DOC, RTF, PDF, HTML lan liya-liyane.
Kaya sing wis kasebut, SDK Ruby kita ngidini sampeyan nyuda ukuran Word kanthi program. Lan saiki sampeyan bisa nyoba fungsi sing kuat lan ngevaluasi cara ngompres Word ing Ruby kanthi conto ing ngisor iki:
require 'aspose_words_cloud'
AsposeWordsCloud.configure do |config|
config.client_data['ClientId'] = '####-####-####-####-####'
config.client_data['ClientSecret'] = '##################'
end
@words_api = WordsAPI.new
request_document = File.open('Input.docx')
request_compress_options = CompressOptions.new(
{:ImagesQuality => 75, :ImagesReduceSizeFactor => 1})
compress_document_request = CompressDocumentOnlineRequest.new(
document: request_document, compress_options: request_compress_options)
compress_document = @words_api.compress_document_online(compress_document_request)
convert_document = ConvertDocumentRequest.new(
document: compress_document.document.values[0], format: 'docx')
@words_api.convert_document(convert_document)
Instal Aspose.Words Cloud SDK for Ruby nggunakake layanan hosting RubyGems. gem install aspose_words_cloud kanggo nginstal paket kasebut. Minangka alternatif, sampeyan bisa kanthi manual kloning Aspose.Words Cloud SDK for Ruby saka GitHub lan nggunakake ing project. Tututi Instructions iki supaya cepet entuk kredensial keamanan sing dibutuhake lan ngakses REST API kita.
Ruby 2.6 utawa luwih anyar
Deleng Repository Documentation kanggo ndeleng rincian.
Sampeyan bisa nindakake kompresi dokumen kanggo format file liyane: