Kompres HTML ing Ruby SDK

Ngurangi ukuran HTML nggunakake Ruby

Nggunakake REST API ing Ruby, pangembang bisa ngompres HTML kanthi program. Kanthi solusi sing diwenehake, output bakal dadi file berkualitas tinggi sawise kompresi.

Ndeleng potongan kode

Compress HTML ing Ruby

Nggunakake Ruby API sing kuat, pangembang bisa ngompres HTML 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 HTML asli utawa format nyimpen sing kasedhiya - DOCX, DOC, RTF, PDF, HTML lan liya-liyane.

Ngurangi ukuran HTML file ing Ruby

Kaya sing wis kasebut, SDK Ruby kita ngidini sampeyan nyuda ukuran HTML kanthi program. Lan saiki sampeyan bisa nyoba fungsi sing kuat lan ngevaluasi cara ngompres HTML ing Ruby kanthi conto ing ngisor iki:

Unggah file sing pengin dioptimalake / kompres
Kode roto
Pilih format target saka dhaptar
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.html')
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: 'html')
@words_api.convert_document(convert_document)
Kode roto
  
Nyalin kode Ruby menyang clipboard

Carane ngompres HTML ing Ruby

  1. Pasang Aspose.Words Cloud for Ruby
  2. Tambah referensi perpustakaan (ngimpor perpustakaan) menyang proyek Ruby sampeyan
  3. Konfigurasi API nggunakake tombol app
  4. Muat sumber HTML kanggo ngompres
  5. Kompres HTML, ngresiki informasi sing ora digunakake
  6. Pilih format file output
  7. Entuk asil kompresi HTML minangka file sing kapisah

Pustaka Ruby kanggo nggunakake kompresi HTML.

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.

Requirements Sistem

Ruby 2.6 utawa luwih anyar

Deleng Repository Documentation kanggo ndeleng rincian.

Format file liyane sing didhukung

Sampeyan bisa nindakake kompresi dokumen kanggo format file liyane:

5%

Langganan kanggo Aspose Update Product

Entuk buletin saben wulan lan tawaran langsung dikirim menyang kothak layang.

© Aspose Pty Ltd 2001-2024. Kabeh hak dilindhungi undhang-undhang.