Posted at: 2:24 PM on 31 March 2013 by Muhimbi
We are happy to announce a major new release of the popular Muhimbi PDF Converter Services, version 7.0. The main new features are support for Font Embedding, Changing PDF Versions, Support for PDF/A2b and Specifying PDF Viewer Preferences, but we have also added a lot of fixes, improvements, documentation and examples for Java, PHP and Ruby.
The list of new features and improvements is considerable but the main ones are as follows:
A quick introduction for those not familiar with the product: The Muhimbi PDF Converter Services is an ‘on premises’ server based SDK that allows software developers to convert typical Office files to PDF format using a robust, scalable but friendly Web Services interface from Java, .NET, Ruby & PHP based solutions. It supports a large number of file types including MS-Office and ODF file formats as well as HTML, MSG (email) AutoCAD and Image based files and is used by some of the largest organisations in the world for mission critical document conversions. In addition to converting documents the product ships with a sophisticated watermarking engine, PDF Splitting and Merging facilities and the ability to secure PDF files. A separate SharePoint specific version is available as well.
In addition to the changes listed above, some of the main changes and additions in the new version are as follows:
|1778 ||CAD ||Improvement ||AutoCAD Conversion - Empty layout not properly detected |
|1774 ||Conversion ||New ||Validate converter with Office 2013 / 15 |
|1758 ||Documentation ||New ||Document how to invoke the Web Service from PHP |
|1846 ||Documentation ||New ||Document ConverterSpecificSettings in Java using Axis2 |
|1864 ||Documentation ||New ||Add Ruby sample code |
|1839 ||HTML ||Fix ||HTML to PDF Conversion fails on certain pages using 0.5inch page margins |
|1842 ||HTML ||Fix ||Bitmapped output in IE8 |
|1833 ||HTML ||Fix ||Pixelated HTML to PDF conversion on Win2K3 |
|1739 ||HTML ||New ||Add credential override for HTML Conversion in config file |
|1818 ||InfoPath ||Fix ||'ClearFormCache' expects English OS |
|1802 ||Merging ||Fix ||PDF Bookmark targets bottom of page under certain circumstances |
|1825 ||Merging ||Fix ||Unexpected token Number before 42079 when merging |
|1848 ||Merging ||Fix ||Unexpected token DictionaryStart when merging file |
|1851 ||Merging ||Fix ||Fatal Error at 109 when merging files |
|1755 ||Merging ||Improvement ||Completely suppress errors when merging |
|1808 ||MSG ||Fix ||MSG to PDF - Regression bug, email renders as plain text |
|1809 ||MSG ||Fix ||MSG to PDF - Incorrect identification of email type (RTF / HTML) |
|1817 ||MSG ||Fix ||MSG to PDF - Extra ltrch RTF keywords remain in converted PDF |
|1601 ||MSG ||Improvement ||MSG to PDF - Improve line spacing in HTML to PDF Conversion |
|1592 ||MSG ||Improvement ||MSG to PDF - Font sizes sometimes becomes very small |
|1658 ||MSG ||Improvement ||MSG to PDF - Conversion - Indentation missing |
|1858 ||MSG ||New ||Add support for SMIME and Clear Text signed MSG files |
|1867 ||Other ||Fix ||Converting MS-Word to non-PDF files using the web services interface requires empty strings for open and owner password |
|1731 ||Other ||Improvement ||Verify InfoPath & HTML Conversion in Kerberos environments. |
|1828 ||Other ||Improvement ||Improve Diagnostics tool for Performance tests |
|1852 ||Other ||Improvement ||Clean up Diagnostics tool and add new post processing facilities |
|1724 ||Post Processing ||New ||Allow PDF Post processing for 'Fast Views' / Linearization |
|1793 ||Post Processing ||New ||Add support for PDF/A-2B |
|1835 ||Post Processing ||New ||Add support for specific PDF Versions |
|1836 ||Post Processing ||New ||Add support for Font Embedding |
|1837 ||Post Processing ||New ||Add support for PDF Viewer Preferences |
|1791 ||Setup ||Fix ||During install loopback check window is displayed in the background |
For more information check out the following resources:
As always, feel free to contact us using Twitter, our Blog, regular email or subscribe to our newsletter.
Download your free trial here (14MB). .
Labels: Java, MSG, News, pdf, PDF Converter Services, PDF/A, php, Products, Ruby
Posted at: 5:54 PM on 04 March 2013 by Muhimbi
In this article we explain how to use Ruby to convert MS-Word, Excel, PowerPoint, HTML and other common file formats to PDF as well as to other formats. Read on to learn more about the Muhimbi PDF Converter and how it can assist with the Conversion, Merging, Watermarking, Splitting and Securing of documents.
We previously discussed how to use the popular Muhimbi PDF Converter Services in combination with PHP, Java (Axis2 and wsimport) as well as Microsoft .NET based environments. Today we will discuss a similar example using the increasingly popular Ruby on Rails (ROR) platform.
For those not familiar with the product, the Muhimbi PDF Converter Services is a server based SDK that allows software developers to convert and manipulate typical Office files, including MS-Word, Excel, PowerPoint, Visio, Publisher, AutoCAD, HTML, emails and InfoPath, to PDF and other formats using a robust, scalable but friendly Web Services interface from Java, PHP, Ruby and .NET based solutions. If you have any questions or need more information then please let us know.
Installing the base ROR environment
If you are reading this then you probably already have a full ROR environment set up. If that is the case then please take into account that this example has been tested with Ruby 1.8.7-p370 and Rails 3.2.12. You may want to use RVM to select the exact same Ruby version as the soap4r gem used in this example may not be compatible with all ruby versions.
If you don’t have a full Rails environment installed then you may want to follow the instructions below to install it. For the sake of this example we used Ubuntu 12.10.
- Download and Install Ubuntu 12.10. We set it up to run inside Hyper-V, but that is naturally not a requirement.
- Install Ruby and Rails as described here. However, rather than using the ‘rvm install 1.9.3’ command use ‘rvm install ruby-1.8.7-p370’ and set that to the default using ‘rvm use ruby-1.8.7-p370 –default’.
- When deploying to a clean Ubuntu 12.10 system the ExecJS dependency is missing. The easiest way to install this is to issue the following command:
sudo apt-get install nodejs
That is it as far as the base ROR environment is concerned. You may want to consider installing a decent text editor. For testing purposes we use Sublime-Text.
Creating the Rails application
The Muhimbi PDF Converter exposes a comprehensive API via a standards based Web Services interface (Full Documentation). A number of Web Service frameworks are available for Ruby (Savon, Handsoap), but in this example we use Soap4R to pre-generate Ruby proxies as it is simple, and it works.
In the example below we will create a basic PDF Conversion Rails application. If you are looking to add PDF Conversion to an existing Rails application then I am sure you’ll know how to modify the various steps.
- Use a terminal application of your choice to navigate to the location where you wish to create the Rails application. We use ~Sites.
- Execute the following command to create the skeleton for the application:
rails new MuhimbiPDFConverter –O
- Navigate to MuhimbiPDFConverter, edit Gemfile using a text editor of your choice and add the following line:
- Install bundler as follows:
gem install bundler
- Execute the following command to pull in the applicable gems (Make sure you are still in the MuhimbiPDFConverter directory)
The quickest way (also from a performance perspective) to interact with a Web Service is to generate proxy classes. This can be achieved easily using soap4r, which has already been added to the application as described above.
Before we can generate the proxies we need to make sure that the Muhimbi Conversion Service has been installed and is running (Yes, this requires one or more Windows Based Servers. Sorry Linux/Apple experts, there is just no way to achieve a decent conversion fidelity on other platforms. Rest assured that your Ruby application can continue to run on non-Windows systems).
- Download and Install the Muhimbi PDF Converter Services as described in Chapter 2 of the Administration guide.
- Open Muhimbi.DocumentConverter.Service.exe.config in your favourite text editor (notepad works as well). A handy shortcut to the configuration / installation folder can be found in the Windows Start Menu Group.
- Search for baseAddress and change localhost to the DNS name or IP address of the server running the Conversion Service.
- Restart the Conversion Service as follows:
Net stop "Muhimbi Document Converter Service"
Net start "Muhimbi Document Converter Service"
Back on your Ruby system carry out the following steps to generate the proxies:
- Navigate to MuhimbiPDFConverter/lib
- Execute the following command. Please replace localhost with the name or ip address of the server that runs the Muhimbi PDF Converter Service.
bundle exec wsdl2ruby.rb --wsdl http://localhost:41734/Muhimbi.DocumentConverter.WebService/?wsdl --type client
This generates four new files and places them in the lib folder. Note that the generated property and method names follow Ruby’s naming convention and not the convention used in the Muhimbi Developer guide. This mainly impacts the capitalisation of the first letters.
Update: A third party is maintaining a Ruby Gem for our PDF Converter. Although unsupported and untested by our engineers, it may be worth checking out.
Implementing the sample
All prerequisites are in place. Let’s add some code to tie it all together. If you prefer you can download the full example, including generated proxies from our website.
- Start by generating a controller where the form will be posted to:
rails generate controller home upload_file
- Delete the home page that comes with every new Rails application (Execute in the MuhimbiPDFConverter folder)
- If you are using Sublime-Text then this is the moment to execute ‘subl .’ to open the text editor and display the entire folder structure.
- Edit config/routes.rb and after the following line
root :to => 'home#upload_file'
- Edit app/views/home/upload_file.html.erb and add the following HTML
<form method="post" enctype="multipart/form-data">
<input type="file" name="file" id="file" />
<label for="outputFormat">Output format:</label>
<select name="outputFormat" id="outputFormat">
<input type="submit" name="submit" value="Convert" />
6. Edit app/controllers/home_controller.rb and replace it with the following:
require Rails.root.to_s + '/lib/DocumentConverterServiceDriver'
class HomeController < ApplicationController
#** Get a reference to the uploaded file and check it was specified
file = params['file']
#** Specify the URL of the server that holds the Conversion Service
url = "http://localhost:41734/Muhimbi.DocumentConverter.Webservice/?wsdl"
conversionClient = DocumentConverterService.new(url)
#** Create OpenOptions and specify the absolute minimum information
openOptions = OpenOptions.new()
openOptions.fileExtension = file.original_filename.split(".").last
openOptions.originalFileName = file.original_filename
#** Create ConversionSettings and set the minimum fields. See Developer guide for details
conversionSettings = ConversionSettings.new()
conversionSettings.format = params['outputFormat']
conversionSettings.fidelity = "Full"
conversionSettings.openPassword = ""
conversionSettings.ownerPassword = ""
#** Encode the source file into a Base64 encoded byte array
sourceFile = Base64.encode64(file.read)
#** Carry out the conversion
convert = Convert.new(sourceFile, openOptions, conversionSettings)
result = conversionClient.convert(convert)
#** Send the converted file back to the browser. ‘wsdl2ruby’ needs double Base64 decoding for some reason.
:filename => "convert." + conversionSettings.format,
:content_type => 'application/octet-stream',
:disposition => 'attachment')
Please update the url variable with the IP address or DNS name of the server that runs the Muhimbi Conversion Service.
This is a minimum code sample to illustrate how simple it is to convert a file. Our full Developer Guide contains the entire object model, including details about how to Convert, Watermark, Split, Merge and Secure files.
That is it. Start the Rails server as follows:
Open a web browser and point it to http://localhost:3000. If the browser is opened on a system other than the one that runs the Rails application then replace localhost with the DNS name or IP number of that server.
The sample application is very simple. Select a file to convert (See this list of supported file types, please make sure that the file extension matches its format). Then select the Output format, e.g. PDF, and click the Convert button.
SOAP / Web Service Debugging
The Muhimbi Conversion Service is a Windows Service based on the Microsoft Windows Communication Foundation (WCF) framework. This comprehensive framework is used to expose a standards based Web Services interface that can be consumed by many different platforms including .NET, Java, PHP, SAP, Ruby, Documentum and many others.
Even though WCF Web Services are standards based, standards are not interpreted the same by everyone so from time to time you may need to do some troubleshooting when programming against the PDF Converter Web Service, especially from non-Microsoft platforms.
For details about how to debug Web Service / SOAP messages, see this Knowledge Base Article.
If you have any questions then leave a comment below or contact us.
Labels: Articles, News, PDF Converter Services, Ruby