Tambah teks utawa gambar watermark menyang DOC dokumen nggunakake Ruby. Muat DOC dokumen lan lebokake tandha banyu sing dibutuhake. Banjur simpen asil ing format sing trep kayata DOCX, PDF, MD, HTML, TXT, DOC, RTF, EPUB, XPS lan liya-liyane, lan nuduhake dokumen sing diwenehi tandha banyu karo wong liya. Uga mbusak tandha banyu saka DOC dokumen yen tandha banyu sadurunge ditambahake menyang dokumen, lan alasan kanggo nambah ora relevan maneh.
Kanthi API Ruby iki, pangembang bisa nambah tandha banyu menyang DOC online. Mung nggawe watermark nggunakake teks utawa gambar banjur lebokake watermark menyang DOC dokumen ing Ruby.
Cathetan: ora perlu nginstal aplikasi utawa perpustakaan pihak katelu. Mulane, solusi piranti lunak Ruby kita gampang banget digunakake.
SDK Ruby sing diwenehake uga mbiyantu mbusak tandha banyu saka DOC. Mbusak tandha banyu ing DOC tegese sampeyan bisa mbukak DOC dokumen sing dipengini kanthi prangko teks utawa gambar, mbusak tandha banyu iki saka DOC nggunakake Ruby, banjur simpen file output ing format sing trep - DOC, DOCX, PDF, JPEG, PNG, TIFF lan liya-liyane.
Kanggo ngevaluasi carane nambah utawa mbusak tandha banyu ing DOC nganggo API Ruby, muat DOC lan tandha banyu minangka gambar utawa teks. Banjur pilih format file ekspor sing trep - DOC, DOCX, PDF, HTML, RTF, XPS lan liya-liyane.
Gunakake conto ing ngisor iki kanggo ndeleng cara kerjane:
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.doc')
request_image_stream = File.open('Input2.jpg')
request_watermark_data = WatermarkDataImage.new(
{:Image => AsposeWordsCloud::FileReference.fromLocalFileContent(request_image_stream)})
insert_watermark_request = InsertWatermarkOnlineRequest.new(
document: request_document, watermark_data: request_watermark_data)
insert_watermark_result =
@words_api.insert_watermark_online(insert_watermark_request)
convert_document_request = ConvertDocumentRequest.new(
document: insert_watermark_result.document.values[0], format: 'doc')
@words_api.convert_document(convert_document_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.doc')
request_watermark_data = WatermarkDataText.new(
{:Text => 'This is the watermark text', :Layout => 'Diagonal'})
insert_watermark_request = InsertWatermarkOnlineRequest.new(
document: request_document, watermark_data: request_watermark_data)
insert_watermark_result = @words_api.insert_watermark_text_online(insert_watermark_request)
convert_document_request = ConvertDocumentRequest.new(
document: insert_watermark_result.document.values[0], format: 'doc')
@words_api.convert_document(convert_document_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.doc')
delete_watermark_online = DeleteWatermarkOnlineRequest.new(document: request_document)
deleted_watermark = @words_api.delete_watermark_online(delete_watermark_online)
convert_document = ConvertDocumentRequest.new(
document: deleted_watermark.document.values[0], format: 'doc')
@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 nambah watermark menyang dokumen ing format liyane: