Ruby Code for Merging HTML Files into JPEG: A Complete Guide
# Merge HTML to HTML
request_document = File.open(local_file)
request_document_list_document_entries0_file_referenceStream = File.open(File.join(local_test_folder, local_file))
request_document_list_document_entries0_file_reference = AsposeWordsCloud::FileReference.fromLocalFileContent(request_document_list_document_entries0_file_referenceStream)
request_document_list_document_entries0 = DocumentEntry.new({:FileReference => request_document_list_document_entries0_file_reference, :ImportFormatMode => 'KeepSourceFormatting'})
request_document_list_document_entries = [request_document_list_document_entries0]
request_document_list = DocumentEntryList.new({:DocumentEntries => request_document_list_document_entries})
append_request = AppendDocumentOnlineRequest.new(document: request_document, document_list: request_document_list)
@words_api.append_document_online(append_request)
%!(EXTRA string=HTML, string=HTML)
# Merge HTML to JPEG
request_document = File.open(local_file)
request_document_list_document_entries0_file_referenceStream = File.open(File.join(local_test_folder, local_file))
request_document_list_document_entries0_file_reference = AsposeWordsCloud::FileReference.fromLocalFileContent(request_document_list_document_entries0_file_referenceStream)
request_document_list_document_entries0 = DocumentEntry.new({:FileReference => request_document_list_document_entries0_file_reference, :ImportFormatMode => 'KeepSourceFormatting'})
request_document_list_document_entries = [request_document_list_document_entries0]
request_document_list = DocumentEntryList.new({:DocumentEntries => request_document_list_document_entries})
append_request = AppendDocumentOnlineRequest.new(document: request_document, document_list: request_document_list)
@words_api.append_document_online(append_request)
%!(EXTRA string=HTML, string=JPEG)
How to Merge HTML with JPEG in Cloud Apps
- Initialize WordsApi with Client Id, Client Secret, Base URL & API version
- Set requestDocument assign the local HTML file name
- Set requestDocumentListDocumentEntriesFileReference and assign local JPEG file name
- Set requestDocumentListDocumentEntries and set file_reference, import_format_mode parameters
- Create DocumentEntryList instance and assing requestDocumentListDocumentEntries to document_entries parameter
- Call AppendDocumentOnlineRequest to merge HTML file with JPEG document requestDocument and requestDocumentList
- Call WordsApi appendDocumentOnline with parameters
Get Started with Aspose.Total REST APIs
- Create an account at Dashboard to get free API quota & authorization details
- Get Aspose.Words and Aspose.Cells Cloud SDKs for Ruby source code from Aspose.Words GitHub and Aspose.Cells GitHub repos to compile/use the SDK yourself or head to the Releases for alternative download options.
- Also have a look at Swagger-based API Reference for Aspose.Words and Aspose.Cells to know more about the REST API.
How to Merge MS Word Document(HTML) and JPEG Files
Aspose.Words Cloud provides efficient methods to merge multiple documents into a single file while preserving formatting.
Steps for Merging Documents:
- Create a MergeDocumentRequest Object to specify the source documents to be merged.
- Call the AppendDocument Method of the Aspose.Words API class instance to merge one document into another.
- Use SaveOptions to define the output format (DOCX, PDF, etc.).
- Send API Request to combine documents into a single merged output.
How to Combine MS Word and HTML with Other Formats Online
Boost your document management efficiency by merging HTML files with other formats using the robust Aspose.Words API. Seamlessly integrate your merged documents with other Aspose.Total APIs such as Aspose.Cells, Aspose.PDF, Aspose.Email, Aspose.Slides, Aspose.Diagram, Aspose.Tasks, Aspose.3D, Aspose.HTML. This all-in-one solution allows you to combine files into a single document across various formats.
For a full list of supported formats and merging features, visit the Aspose.Total Cloud page.
FAQ
- Is it safe to merge HTML with JPEG in the Cloud?Of course! Aspose Cloud uses Amazon EC2 cloud servers that guarantee the security and resilience of the service. Please read more about Aspose's Security Practices.
- Where can I see the release notes for Aspose.Total Cloud API?Complete release notes can be reviewed at Aspose.Total Cloud Documentation.
- How can I get started with Aspose.Total REST APIs?Quickstart not only guides through the initialization of Aspose.Total Cloud API, it also helps in installing the required libraries.
- What is JPEG Format?A JPEG is a type of image format that is saved using the method of lossy compression. The output image, as result of compression, is a trade-off between storage size and image quality. Users can adjust the compression level to achieve the desired quality level while at the same time reduce the storage size. Image quality is negligibly affected if 10:1 compression is applied to the image. The higher the compression value, the higher the degradation in image quality.
- What file formats are supported by Aspose.Total Cloud API?Aspose.Total Cloud can merge file formats from any product family to any other product family to PDF, DOCX, XPS, image(TIFF, JPEG, PNG BMP), MD and more. Checkout the complete list of supported file formats.
- What is HTML Format?Known as language of the web, HTML has evolved with requirements of new information requirements to be displayed as part of web pages. The latest variant is known as HTML 5 that gives a lot of flexibility for working with the language. HTML pages are either received from server, where these are hosted, or can be loaded from local system as well. Each HTML page is made up of HTML elements such as forms, text, images, animations, links, etc. These elements are represented by tags and several others where each tag has start and end. It can also embed applications written in scripting languages such as JavaScript and Style Sheets (CSS) for overall layout representation.
- I can not find the SDK for my favorite language. What should I do?Aspose.Total Cloud is also available as a Docker Container. Try using it with cURL in case your required SDK is not available yet.