Kanthi solusi iki, Ruby pangembang bisa gampang nggawe dokumen ing PDF, DOC, DOCX, HTML, EPUB lan akeh format liyane kanthi mung sawetara baris kode. Solusi kita bakal menehi sampeyan kabeh sing dibutuhake kanggo nggawe file nggunakake Ruby SDK.
Kanthi REST API, pangembang Ruby bisa nggawe dokumen ing meh kabeh format. Kanggo nindakake iki, sampeyan kudu nindakake sawetara langkah nggunakake Ruby SDK kita:
Wiwit dokumen kosong mesthine ngemot siji paragraf, nalika sampeyan nggawe dokumen kanthi program, sampeyan bakal entuk struktur dhasar kasebut.
Elinga yen sampeyan bisa nambah konten menyang dokumen sing mentas digawe kanthi cepet. Mangkono, sampeyan bakal entuk ora mung dokumen kosong, nanging dokumen sing ngemot konten sing dibutuhake. Kanggo informasi luwih lengkap babagan cara ngowahi dokumen, deleng kaca 'Edit a Document'.
Kaya sing wis kasebut, Ruby SDK ngidini sampeyan nggawe dokumen kanthi program ing format apa wae sing didhukung. Contone, sampeyan bisa nggawe PDF, DOCX, DOC, RTF, ODT, EPUB, HTML lan file ing format liyane. Sampeyan bisa nyoba fungsi sing kuat lan ngevaluasi carane nggawe dokumen nggunakake conto Ruby ing ngisor iki:
require 'aspose_words_cloud'
AsposeWordsCloud.configure do |config|
config.client_data['ClientId'] = '####-####-####-####-####'
config.client_data['ClientSecret'] = '##################'
end
@words_api = WordsAPI.new
file_name= 'Output.docx'
create_document_request = CreateDocumentRequest.new(file_name: file_name)
@words_api.create_document(create_document_request)
download_document_request = DownloadFileRequest.new(path: file_name)
@words_api.download_file(download_document_request)
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.