Sunting PDF ing Ruby SDK

Gunakake REST API kanggo nyunting PDF ing Ruby kanthi terprogram

Nalika pangembang ngowahi PDF dokumen nganggo perpustakaan Ruby iki, sing lagi diowahi yaiku Model Obyek Dokumen (DOM). Dadi, meh kabeh owah-owahan bisa ditindakake kanggo PDF dokumen sing diwakili minangka DOM. Kanthi Ruby SDK sing disedhiyakake, pangembang bisa kanthi gampang nyunting dokumen: ngowahi teks, nganyari tabel, nambah gambar lan liya-liyane. Cukup mbukak PDF, gawe owah-owahan sing dibutuhake kanthi program lan ekspor asil menyang format nyimpen sing padha utawa sing didhukung.

Ndeleng potongan kode

Sunting PDF ing Ruby nggunakake REST API

Pustaka Ruby kita menehi pangembang kemampuan kanggo ngowahi PDF dokumen kanthi langsung kanthi nyunting Document Object Model (DOM), tegese ora ana piranti lunak tambahan sing kudu diinstal.

Sunting teks ing PDF file nggunakake Ruby

Kasus sing paling populer kanggo nyunting PDF file yaiku nyunting teks. Kanthi solusi piranti lunak sing diwenehake, sampeyan bisa nambah, ngowahi utawa mbusak teks nggunakake Ruby ing dokumen kasebut.

Sunting tabel ing PDF file nggunakake Ruby

Pilihan editing PDF liyane sing populer yaiku nyunting tabel. Ruby SDK kita ngidini sampeyan nggarap tabel lan teks ing sel tabel.

Pangembang Ruby bisa nambah utawa mbusak sel tabel lan tabel, uga nambah, ngowahi lan mbusak teks ing njero.

Tambah gambar menyang PDF file nggunakake Ruby

Saliyane nyunting teks lan tabel ing PDF, ana pilihan umum liyane: nambahake gambar menyang dokumen ing Ruby. Pangembang Ruby uga bisa nambah gambar menyang PDF file nggunakake DOM.

Sunting PDF kanthi terprogram

Coba Ruby SDK sing kuat iki lan evaluasi sawetara opsi ing panyuntingan PDF dokumen. Nggunakake conto ing ngisor iki, muat PDF dokumen lan gawe sawetara owah-owahan: nambah teks, nambah tabel lan sel tabel kanthi teks utawa lebokake gambar menyang PDF dokumen:

Unggah dokumen sing pengin diowahi
Kode roto
Unggah gambar sing pengin dilebokake
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.pdf')
request_paragraph = ParagraphInsert.new({:Text => 'Morbi enim nunc faucibus a.'})
insert_paragraph_request = InsertParagraphOnlineRequest.new(document: request_document, 
   paragraph: request_paragraph)
insert_paragraph = @words_api.insert_paragraph_online(insert_paragraph_request)

convert_request = ConvertDocumentRequest.new(
   document: insert_paragraph.document.values[0], format: 'pdf')
convert = @words_api.convert_document(convert_request)
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_table = TableInsert.new({:ColumnsCount => 1, :RowsCount => 2})
insert_table_request = InsertTableOnlineRequest.new(document: request_document, 
   table: request_table, node_path: '')
insert_table = @words_api.insert_table_online(insert_table_request)

convert_request = ConvertDocumentRequest.new(
   document: insert_table.document.values[0], format: 'pdf')
convert = @words_api.convert_document(convert_request)
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('Input1.pdf')
request_drawing_object = DrawingObjectInsert.new({:Height => 0, :Left => 0, :Top => 0, 
   :Width => 0, :RelativeHorizontalPosition => 'Margin', 
      :RelativeVerticalPosition => 'Margin', :WrapType => 'Inline'})
request_image_file = File.open('Input2.pdf')
insert_drawing_object_request = InsertDrawingObjectOnlineRequest.new(
   document: request_document, drawing_object: request_drawing_object, 
      image_file: request_image_file, node_path: 'sections/0')
insert_drawing_object = @words_api.insert_drawing_object_online(insert_drawing_object_request)

convert_request = ConvertDocumentRequest.new(
   document: insert_drawing_object.document.values[0], format: 'pdf')
convert = @words_api.convert_document(convert_request)
Kode roto
  
Nyalin kode Ruby menyang clipboard

Cara Ngowahi PDF ing Ruby

  1. Pasang 'Aspose.Words Cloud kanggo Ruby'
  2. Tambah referensi perpustakaan (ngimpor perpustakaan) menyang proyek Ruby sampeyan
  3. Muat PDF kanggo nyunting ing Ruby
  4. Lebokake isi ing wiwitan PDF
  5. Download dokumen asil saka panyimpenan maya

Pustaka Ruby kanggo nggunakake panyuntingan PDF.

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 operasi suntingan 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.