Last active
August 10, 2020 07:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose.PDF-Cloud-SDK-Ruby |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Bookmark | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read document bookmarks. | |
def read_document_bookmarks | |
file_name = "Sample-Bookmark.pdf" | |
upload_file(file_name) | |
response = @pdf_api.get_document_bookmarks(file_name) | |
end | |
end | |
bookmark = Bookmark.new() | |
puts bookmark.read_document_bookmarks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Annotation | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read document page annotation by its number. | |
def read_page_annotation_by_number | |
file_name = "Sample-Annotation.pdf" | |
upload_file(file_name) | |
page_number = 1 | |
annotation_number = 1 | |
response = @pdf_api.get_page_annotation(file_name, page_number, annotation_number) | |
end | |
end | |
annotation = Annotation.new() | |
puts annotation.read_page_annotation_by_number |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Annotation | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read documant page annotations. | |
def read_page_annotations | |
file_name = "Sample-Annotation.pdf" | |
upload_file(file_name) | |
page_number = 1 | |
response = @pdf_api.get_page_annotations(file_name, page_number) | |
end | |
end | |
annotation = Annotation.new() | |
puts annotation.read_page_annotations |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Attachment | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Download document attachment content by its index. | |
def download_document_attachment_by_index | |
file_name = "SampleAttachment.pdf" | |
upload_file(file_name) | |
attachment_index = 1 | |
response = @pdf_api.get_download_document_attachment_by_index(file_name, attachment_index) | |
end | |
end | |
attachment = Attachment.new() | |
puts attachment.download_document_attachment_by_index |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Attachment | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read document attachment info by its index. | |
def read_document_attachment_by_index | |
file_name = "SampleAttachment.pdf" | |
upload_file(file_name) | |
attachment_index = 1 | |
response = @pdf_api.get_document_attachment_by_index(file_name, attachment_index) | |
end | |
end | |
attachment = Attachment.new() | |
puts attachment.read_document_attachment_by_index |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Attachment | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read document attachments info. | |
def read_document_attachments_info | |
file_name = "SampleAttachment.pdf" | |
upload_file(file_name) | |
response = @pdf_api.get_document_attachments(file_name) | |
end | |
end | |
attachment = Attachment.new() | |
puts attachment.read_document_attachments_info |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Bookmark | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read document bookmarks. | |
def read_document_bookmarks | |
file_name = "Sample-Bookmark.pdf" | |
upload_file(file_name) | |
response = @pdf_api.get_document_bookmarks(file_name) | |
end | |
end | |
bookmark = Bookmark.new() | |
puts bookmark.read_document_bookmarks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Bookmark | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read document bookmark/bookmarks (including children). | |
def read_document_bookmarks_including_children | |
file_name = "Sample-Bookmark.pdf" | |
upload_file(file_name) | |
bookmark_path = "1" | |
response = @pdf_api.get_document_bookmarks_children(file_name, bookmark_path) | |
end | |
end | |
bookmark = Bookmark.new() | |
puts bookmark.read_document_bookmarks_including_children |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Document | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Append document to existing one. | |
def append_document | |
file_name = "Sample.pdf" | |
upload_file(file_name) | |
append_file_name = "sample-input.pdf" | |
upload_file(append_file_name) | |
append_document = AppendDocument.new | |
append_document.document = append_file_name; | |
append_document.start_page = 2 | |
append_document.end_page = 3 | |
response = @pdf_api.post_append_document(file_name, append_document) | |
end | |
end | |
document = Document.new() | |
puts document.append_document |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Document | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Convert document from request content to format specified. | |
def convert_document_from_request_content_to_specified_format | |
file_name = "Sample.pdf" | |
response = @pdf_api.put_convert_document(File.open("../../../data/" << file_name,"r") { |io| io.read }, {format: "tiff"}) | |
end | |
end | |
document = Document.new() | |
puts document.convert_document_from_request_content_to_specified_format |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Document | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Convert document to specified format | |
def convert_document_to_specified_format | |
file_name = "Sample.pdf" | |
upload_file(file_name) | |
format = "doc" | |
response = @pdf_api.get_document_with_format(file_name, format) | |
end | |
end | |
document = Document.new() | |
puts document.convert_document_to_specified_format |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Document | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Create new document. | |
def create_new_document | |
file_name = "newPDFFile.pdf" | |
response = @pdf_api.put_create_document(file_name) | |
end | |
end | |
document = Document.new() | |
puts document.create_new_document |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Document | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def create_pdf_from_html | |
file_name = "newPDFFromHTML.pdf" | |
template_file = "sample.html" | |
upload_file(template_file) | |
response = @pdf_api.put_create_document(file_name, {template_file: template_file, template_type: "html"}) | |
end | |
end | |
document = Document.new() | |
puts document.create_pdf_from_html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Document | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def create_pdf_from_jpeg | |
file_name = "sample-jpeg.pdf" | |
template_file = "Einstein_JPEG.jpg" | |
upload_file(template_file) | |
template_type = "jpeg" | |
response = @pdf_api.put_create_document(file_name, {template_file: template_file, template_type: template_type}) | |
end | |
end | |
document = Document.new() | |
puts document.create_pdf_from_jpeg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Document | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def create_pdf_from_svg | |
file_name = "sample-svg.pdf" | |
template_file = "Example.svg" | |
upload_file(template_file) | |
template_type = "svg" | |
response = @pdf_api.put_create_document(file_name, {template_file: template_file, template_type: template_type}) | |
end | |
end | |
document = Document.new() | |
puts document.create_pdf_from_svg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Document | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def create_pdf_from_tiff | |
file_name = "sample-tiff.pdf" | |
template_file = "Sample.tiff" | |
upload_file(template_file) | |
template_type = "tiff" | |
response = @pdf_api.put_create_document(file_name, {template_file: template_file, template_type: template_type}) | |
end | |
end | |
document = Document.new() | |
puts document.create_pdf_from_tiff |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Document | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def create_pdf_from_xml | |
file_name = "newPDFFromXML.pdf" | |
template_file = "sample.xsl" | |
data_file = "sample.xml" | |
upload_file(template_file) | |
upload_file(data_file) | |
response = @pdf_api.put_create_document(file_name, {template_file: template_file, data_file: data_file, template_type: "xml"}) | |
end | |
end | |
document = Document.new() | |
puts document.create_pdf_from_xml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Document | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Merge a list of documents. | |
def merge_documents | |
upload_file("Sample.pdf") | |
upload_file("sample-input.pdf") | |
merge_documents = MergeDocuments.new | |
merge_documents.list = ["Sample.pdf", "sample-input.pdf"] | |
response = @pdf_api.put_merge_documents("sample-merged.pdf", merge_documents) | |
end | |
end | |
document = Document.new() | |
puts document.merge_documents |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Document | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Sign page. | |
def sign_page | |
file_name = "sample-input.pdf" | |
upload_file(file_name) | |
signature_file_name = "pkc7-sample.pfx" | |
upload_file(signature_file_name) | |
page_number = 1 | |
signature = Signature.new | |
signature.authority = "Alexey" | |
signature.location = "London" | |
signature.contact = "alexey@aspose.com" | |
signature.date = "10/25/2015 2:46:00.000 PM" | |
signature.form_field_name = "Signature1" | |
signature.password = "aspose" | |
rectangle = Rectangle.new | |
rectangle.x = 100 | |
rectangle.y = 100 | |
rectangle.height = 100 | |
rectangle.width = 200 | |
signature.rectangle = rectangle | |
signature.signature_path = signature_file_name | |
signature.signature_type = "PKCS7" | |
signature.visible = true | |
response = @pdf_api.post_sign_page(file_name, page_number, signature) | |
end | |
end | |
document = Document.new() | |
puts document.sign_page |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Document | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Split document to parts. | |
def split_document | |
file_name = "sample-input.pdf" | |
upload_file(file_name) | |
response = @pdf_api.post_split_document(file_name, {format: "pdf", from: 1, to: 2}) | |
end | |
end | |
document = Document.new() | |
puts document.split_document |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class DocumentProperty | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Delete document properties. | |
def delete_properties | |
file_name = "Sample-Annotation.pdf" | |
upload_file(file_name) | |
response = @pdf_api.delete_properties(file_name) | |
end | |
end | |
documentProperty = DocumentProperty.new() | |
puts documentProperty.delete_properties |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class DocumentProperty | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read document properties. | |
def read_document_properties | |
file_name = "Sample-Annotation.pdf" | |
upload_file(file_name) | |
response = @pdf_api.get_document_properties(file_name) | |
end | |
end | |
documentProperty = DocumentProperty.new() | |
puts documentProperty.read_document_properties |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class DocumentProperty | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read document property by name. | |
def read_document_property_by_name | |
file_name = "sample-input.pdf" | |
upload_file(file_name) | |
property_name = "Author" | |
response = @pdf_api.get_document_property(file_name, property_name) | |
end | |
end | |
documentProperty = DocumentProperty.new() | |
puts documentProperty.read_document_property_by_name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class DocumentProperty | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Add/update document property. | |
def update_document_property | |
file_name = "Sample-Annotation.pdf" | |
upload_file(file_name) | |
property_name = "author" | |
document_property = DocumentProperty.new | |
document_property.name = property_name | |
document_property.value = "Elon" | |
document_property.built_in = true | |
response = @pdf_api.put_set_property(file_name, property_name, document_property) | |
end | |
end | |
documentProperty = DocumentProperty.new() | |
puts documentProperty.update_document_property |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class FormField | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Get document field by name. | |
def get_document_field_by_name | |
file_name = "sample-field.pdf" | |
upload_file(file_name) | |
field_name = "textbox1" | |
response = @pdf_api.get_field(file_name, field_name) | |
end | |
end | |
formField = FormField.new() | |
puts formField.get_document_field_by_name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class FormField | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Get document fields. | |
def get_document_fields | |
file_name = "sample-field.pdf" | |
upload_file(file_name) | |
response = @pdf_api.get_fields(file_name) | |
end | |
end | |
formField = FormField.new() | |
puts formField.get_document_fields |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class FormField | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Update field. | |
def update_field | |
file_name = "sample-field.pdf" | |
upload_file(file_name) | |
field_name = "textbox1" | |
field = Field.new | |
field.name = field_name | |
field.values = ["Aspose"] | |
response = @pdf_api.put_update_field(file_name, field, field_name) | |
end | |
end | |
formField = FormField.new() | |
puts formField.update_field |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Image | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Get image in specified format. | |
def get_image_in_specified_format | |
file_name = "SampleImage.pdf" | |
upload_file(file_name) | |
page_number = 1 | |
image_number = 1 | |
format = "jpeg" | |
response = @pdf_api.get_image_with_format(file_name, page_number, image_number, format) | |
end | |
end | |
image_obj = Image.new() | |
puts image_obj.get_image_in_specified_format |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Image | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read document images. | |
def get_images | |
file_name = "SampleImage.pdf" | |
upload_file(file_name) | |
page_number = 1 | |
response = @pdf_api.get_images(file_name, page_number) | |
end | |
end | |
image_obj = Image.new() | |
puts image_obj.get_images |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Image | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Replace document image. | |
def replace_image | |
file_name = "SampleImage.pdf" | |
upload_file(file_name) | |
image_file_name = "aspose-cloud.png" | |
upload_file(image_file_name) | |
page_number = 1 | |
image_number = 1 | |
response = @pdf_api.post_replace_image(file_name, page_number, image_number, {image_file: image_file_name}) | |
end | |
end | |
image_obj = Image.new() | |
puts image_obj.replace_image |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Links | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read document page link annotation by its index. | |
def read_page_link_annotation_by_index | |
file_name = "Sample-Bookmark.pdf" | |
upload_file(file_name) | |
page_number = 1 | |
link_index = 1 | |
response = @pdf_api.get_page_link_annotation_by_index(file_name, page_number, link_index) | |
end | |
end | |
links = Links.new() | |
puts links.read_page_link_annotation_by_index |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Links | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read document page link annotations. | |
def read_page_link_annotations | |
file_name = "Sample-Bookmark.pdf" | |
upload_file(file_name) | |
page_number = 1 | |
response = @pdf_api.get_page_link_annotations(file_name, page_number) | |
end | |
end | |
links = Links.new() | |
puts links.read_page_link_annotations |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Page | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Add new page to end of the document. | |
def add_new_page_to_end_of_document | |
file_name = "sample-input.pdf" | |
upload_file(file_name) | |
response = @pdf_api.put_add_new_page(file_name) | |
end | |
end | |
page = Page.new() | |
puts page.add_new_page_to_end_of_document |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Page | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Get page in specified format. | |
def convert_pdf_page_to_image_with_specified_size | |
file_name = "Sample-Annotation.pdf" | |
upload_file(file_name) | |
page_number = 1 | |
format = "png" | |
width = 300 | |
height = 300 | |
response = @pdf_api.get_page_with_format(file_name, page_number, format, {width: width, height: height}) | |
end | |
end | |
page = Page.new() | |
puts page.convert_pdf_page_to_image_with_specified_size |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Page | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Delete document page by its number. | |
def delete_page | |
file_name = "sample-input.pdf" | |
upload_file(file_name) | |
page_number = 1 | |
response = @pdf_api.delete_page(file_name, page_number) | |
end | |
end | |
page = Page.new() | |
puts page.delete_page |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Page | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Get page in specified format. | |
def get_page_in_specified_format | |
file_name = "Sample-Annotation.pdf" | |
upload_file(file_name) | |
page_number = 1 | |
format = "png" | |
response = @pdf_api.get_page_with_format(file_name, page_number, format) | |
end | |
end | |
page = Page.new() | |
puts page.get_page_in_specified_format |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Page | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Move page to new position. | |
def move_page_to_new_position | |
file_name = "sample-merged.pdf" | |
upload_file(file_name) | |
page_number = 1 | |
new_index = 1 | |
response = @pdf_api.post_move_page(file_name, page_number, new_index) | |
end | |
end | |
page = Page.new() | |
puts page.move_page_to_new_position |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Page | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read document pages info. | |
def read_pages_info | |
file_name = "Sample-Annotation.pdf" | |
upload_file(file_name) | |
response = @pdf_api.get_pages(file_name) | |
end | |
end | |
page = Page.new() | |
puts page.read_pages_info |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Text | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Document's replace text method. | |
def document_replace_text | |
file_name = "sample-input.pdf" | |
upload_file(file_name) | |
text_replace = TextReplace.new | |
text_replace.old_value = "Sample PDF" | |
text_replace.new_value = "Sample Aspose PDF" | |
response = @pdf_api.post_document_replace_text(file_name, text_replace) | |
end | |
end | |
text_obj = Text.new() | |
puts text_obj.document_replace_text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Text | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Document's replace text method. | |
def document_replace_text_list | |
file_name = "Sample-Annotation.pdf" | |
upload_file(file_name) | |
text_replace_list_request = TextReplaceListRequest.new | |
text_replace_1 = TextReplace.new | |
text_replace_1.old_value = "Sample" | |
text_replace_1.new_value = "Sample Aspose" | |
text_replace_1.regex = false | |
text_replace_2 = TextReplace.new | |
text_replace_2.old_value = "PDF" | |
text_replace_2.new_value = "PDF Document" | |
text_replace_2.regex = false | |
text_replace_list_request.text_replaces = [text_replace_1, text_replace_2] | |
response = @pdf_api.post_document_replace_text_list(file_name, text_replace_list_request) | |
end | |
end | |
text_obj = Text.new() | |
puts text_obj.document_replace_text_list |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Text | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Page's replace text method. | |
def page_replace_text | |
file_name = "sample-input.pdf" | |
upload_file(file_name) | |
page_number = 1 | |
text_replace = TextReplace.new | |
text_replace.old_value = "Sample PDF" | |
text_replace.new_value = "Sample Aspose PDF" | |
response = @pdf_api.post_page_replace_text(file_name, page_number, text_replace) | |
end | |
end | |
text_obj = Text.new() | |
puts text_obj.page_replace_text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Text | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Page's replace text method. | |
def page_replace_text_list | |
file_name = "sample-input.pdf" | |
upload_file(file_name) | |
page_number = 1 | |
text_replace_list_request = TextReplaceListRequest.new | |
text_request_1 = TextReplace.new | |
text_request_1.old_value = "Sample" | |
text_request_1.new_value = "Sample Aspose" | |
text_request_2 = TextReplace.new | |
text_request_2.old_value = "PDF" | |
text_request_2.new_value = "PDF Document" | |
text_replace_list_request.text_replaces = [text_request_1, text_request_2] | |
response = @pdf_api.post_page_replace_text_list(file_name, page_number, text_replace_list_request) | |
end | |
end | |
text_obj = Text.new() | |
puts text_obj.page_replace_text_list |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Text | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read document text items. | |
def read_document_text_items | |
file_name = "Sample-Annotation.pdf" | |
upload_file(file_name) | |
response = @pdf_api.get_text_items(file_name) | |
end | |
end | |
text_obj = Text.new() | |
puts text_obj.read_document_text_items |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Text | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read fragment segments. | |
def read_fragment_segments | |
file_name = "sample-input.pdf" | |
upload_file(file_name) | |
page_number = 1 | |
fragment_number = 1 | |
response = @pdf_api.get_segments(file_name, page_number, fragment_number) | |
end | |
end | |
text_obj = Text.new() | |
puts text_obj.read_fragment_segments |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Text | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read page fragment. | |
def read_page_fragment | |
file_name = "sample-input.pdf" | |
upload_file(file_name) | |
page_number = 1 | |
fragment_number = 1 | |
response = @pdf_api.get_fragment(file_name, page_number, fragment_number) | |
end | |
end | |
text_obj = Text.new() | |
puts text_obj.read_page_fragment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Text | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read page fragment text format. | |
def read_page_fragment_text_format | |
file_name = "sample-input.pdf" | |
upload_file(file_name) | |
page_number = 1 | |
fragment_number = 1 | |
response = @pdf_api.get_fragment_text_format(file_name, page_number, fragment_number) | |
end | |
end | |
text_obj = Text.new() | |
puts text_obj.read_page_fragment_text_format |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Text | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read page fragments. | |
def read_page_fragments | |
file_name = "sample-input.pdf" | |
upload_file(file_name) | |
page_number = 1 | |
response = @pdf_api.get_fragments(file_name, page_number) | |
end | |
end | |
text_obj = Text.new() | |
puts text_obj.read_page_fragments |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Text | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read page text items. | |
def read_page_text_items | |
file_name = "Sample-Annotation.pdf" | |
upload_file(file_name) | |
page_number = 1 | |
response = @pdf_api.get_page_text_items(file_name, page_number) | |
end | |
end | |
text_obj = Text.new() | |
puts text_obj.read_page_text_items |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Text | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Read segment text format. | |
def read_segment_text_format | |
file_name = "sample-input.pdf" | |
upload_file(file_name) | |
page_number = 1 | |
fragment_number = 1 | |
segment_number = 1 | |
response = @pdf_api.get_segment_text_format(file_name, page_number, fragment_number, segment_number) | |
end | |
end | |
text_obj = Text.new() | |
puts text_obj.read_segment_text_format |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Attachment | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def add_image_stamp_to_a_pdf_page | |
file_name = "sample-input.pdf" | |
image_file = "aspose-cloud.png" | |
upload_file(file_name) | |
upload_file(image_file) | |
page_number = 1 | |
stamp = Stamp.new | |
stamp.file_name = image_file | |
stamp.value = "Aspose" | |
stamp.background = true | |
stamp.type = "Image" | |
stamp.page_index = 0 | |
stamp.left_margin = 0.0 | |
stamp.opacity = 0.5 | |
stamp.right_margin = 0.0 | |
stamp.top_margin = 0.0 | |
stamp.y_indent = 100.0 | |
stamp.x_indent = 100.0 | |
stamp.zoom = 1.0 | |
stamp.text_state = null | |
stamp.width = 300.0 | |
stamp.height = 300.0 | |
response = @pdf_api.put_page_add_stamp(file_name, page_number, stamp) | |
end | |
end | |
attachment = Attachment.new() | |
puts attachment.add_image_stamp_to_a_pdf_page |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Attachment | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def add_page_number_stamp_to_pdf_page | |
file_name = "sample-input.pdf" | |
upload_file(file_name) | |
page_number = 1 | |
stamp = Stamp.new | |
stamp.background = true | |
stamp.value = "Page # of 2" | |
stamp.type = "PageNumber" | |
stamp.page_index = 0 | |
stamp.left_margin = 0.0 | |
stamp.opacity = 0.5 | |
stamp.right_margin = 0.0 | |
stamp.top_margin = 0.0 | |
stamp.y_indent = 100.0 | |
stamp.x_indent = 100.0 | |
stamp.zoom = 1.0 | |
stamp.text_state = null | |
stamp.width = 300.0 | |
stamp.height = 300.0 | |
stamp.starting_number = 1 | |
response = @pdf_api.put_page_add_stamp(file_name, page_number, stamp) | |
end | |
end | |
attachment = Attachment.new() | |
puts attachment.add_page_number_stamp_to_pdf_page |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Attachment | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
# Add page stamp. | |
def add_page_stamp | |
file_name = "sample-input.pdf" | |
upload_file(file_name) | |
page_number = 1 | |
stamp = Stamp.new | |
stamp.value = "Aspose" | |
stamp.background = true | |
stamp.type = "Text" | |
response = @pdf_api.put_page_add_stamp(file_name, page_number, stamp) | |
end | |
end | |
attachment = Attachment.new() | |
puts attachment.add_page_stamp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Cloud | |
require 'aspose_pdf_cloud' | |
class Attachment | |
include AsposePDFCloud | |
include AsposeStorageCloud | |
def initialize | |
#Get App key and App SID from https://cloud.aspose.com | |
AsposeApp.app_key_and_sid("APP_KEY", "APP_SID") | |
@pdf_api = PdfApi.new | |
end | |
def upload_file(file_name) | |
@storage_api = StorageApi.new | |
response = @storage_api.put_create(file_name, File.open("../../../data/" << file_name,"r") { |io| io.read } ) | |
end | |
def add_pdf_page_as_stamp_to_pdf_page | |
file_name = "sample-input.pdf" | |
pdf_name = "Sample.pdf" | |
upload_file(file_name) | |
upload_file(pdf_name) | |
page_number = 1 | |
stamp = Stamp.new | |
stamp.file_name = pdf_name | |
stamp.background = true | |
stamp.type = "Image" | |
stamp.page_index = 0 | |
stamp.left_margin = 0.0 | |
stamp.opacity = 0.5 | |
stamp.right_margin = 0.0 | |
stamp.top_margin = 0.0 | |
stamp.y_indent = 100.0 | |
stamp.x_indent = 100.0 | |
stamp.zoom = 1.0 | |
stamp.text_state = null | |
stamp.width = 300.0 | |
stamp.height = 300.0 | |
response = @pdf_api.put_page_add_stamp(file_name, page_number, stamp) | |
end | |
end | |
attachment = Attachment.new() | |
puts attachment.add_pdf_page_as_stamp_to_pdf_page |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment