Converting PDF document to PDF/A1b using the Muhimbi PDF Converter Web Service

As Muhimbi’s range of PDF Conversion products, including the PDF Converter for SharePoint and the PDF Converter Services, now provide the ability to post process any converted document for output in PDF/A format, one obvious use for this brilliant new functionality is to convert regular PDF files to PDF/A format.

In this post we’ll provide a simple .NET sample that invokes our Web Services interface to carry out the conversion from PDF to PDF/A1b. The code is nearly identical to the code to convert and watermark a simple MS-Word file with the following exceptions. You can apply the same changes to the Java sample to make it do the same using that language.

  1. openOptions.FileExtension is set to pdf.
  2. conversionSettings.PDFProfile is set to PDFProfile.PDF_A1B.
  3. converstionSettings.OutputFormatSpecificSettings is set to an instance of OutputFormatSpecificSettings_PDF with the PostProcessFile property set to True.
  4. The client.ProcessChanges() method is invoked rather than client.Convert().
  5. All references to watermarks have been removed as they are not part of this sample.

Some minor clean-up has been carried out as well to make the code even shorter. After running the example the resulting file validates perfectly according to Acrobat X Pro.

PDFA Check

Sample Code

Listed below is sample code to convert PDF to PDF/A. You can either copy the code from this blog post, download the Visual Studio Project or open the project from the Sample Code folder in the Windows Start Menu.

The sample code expects the path of the PDF file on the command line. If the path is omitted then the first PDF file found in the current directory will be used.

  1. Download and install the Muhimbi PDF Converter Services or PDF Converter for SharePoint.

  2. If you need help with installation, check out the Administration guide for PDF Converter Services or the Administration guide for PDF Converter for SharePoint On-Premises.

  3. Create a new Visual Studio C# Console application named PDFA_Conversion.

  4. Add a Service Reference to the following URL and specify ConversionService as the namespace

    http://localhost:41734/Muhimbi.DocumentConverter.WebService/?wsdl

  5. Paste the following code into Program.cs.

  6. Make sure the output folder contains a PDF file.

  7. Compile and execute the application. The converted PDF/A file will automatically be opened in your system’s PDF reader.

As all this functionality is exposed via a Web Services interface, it works equally well from Java and other web services enabled environments. Please note that you need the OCR and PDF/A Archiving for SharePoint add-on license in addition to a valid PDF Converter for SharePoint or PDF Converter Services License in order to use this functionality.

This code is merely an example of what is possible, feel free to adapt it to you own needs. The possibilities are endless.

Labels: Articles, pdf, PDF Converter, PDF Converter Professional, PDF Converter Services, PDF/A

Have a Question?
We’re Always Happy to Help.

© Muhimbi Ltd. 2008 - 2024
This website uses cookies to ensure you get the best experience. Learn more