Nggunakake Ruby API sing kuat, pangembang bisa ngompres PDF dokumen kanggo ngoptimalake konten lan ukuran file output. Ngurangi ukuran PDF dumadi kanthi ngresiki data lan sumber daya sing ora digunakake. Sampeyan uga bisa ngompres gambar ing PDF supaya ukuran file output luwih cilik.
Asil optimasi lan kompresi isi bisa disimpen ing PDF asli utawa format nyimpen sing kasedhiya - DOCX, DOC, RTF, HTML lan liya-liyane. Contone, kompres PDF lan simpen output minangka Word.
Kaya sing wis kasebut, SDK Ruby kita ngidini sampeyan nyuda ukuran PDF kanthi program. Lan saiki sampeyan bisa nyoba fungsi sing kuat lan ngevaluasi cara ngompres PDF 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.pdf')
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: 'pdf')
@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: