How to specify which InfoPath view to convert from your code?

Nutrient Document Converter comes with extensive View selection facilities for InfoPath forms. These facilities are relatively easy to use, but when you work directly with our Web Services interface, it may not be immediately clear how to specify the view name.

For more information, see our Developer guide. The guide describes how to create a Web Services example that allows a specific conversion view to be selected. This sample uses C#, but the code is almost identical in other environments such as Java.

Start by creating the example as mentioned in Convert Office files to PDF effortlessly and make sure it works without error when the InfoPath XML file is provided as input.

Add logic to specify which view to convert after the following line:

conversionSettings.Quality = ConversionQuality.OptimizeForPrint;

Add the following code and replace “Your View Name” with the name of the view you want to convert:

ConverterSpecificSettings_InfoPath css = new ConverterSpecificSettings_InfoPath();
css.AutoTrustForms = false;
css.ConvertAttachments = true;
css.ProcessFullTrustForms = true;
css.StripDataObjects = true;
css.StripDotNETCode = true;
css.ConversionViews = new InfoPathView[1];
css.ConversionViews[0] = new InfoPathView();
css.ConversionViews[0].Name = "Your View Name";
conversionSettings.ConverterSpecificSettings = css;
Information

You can add multiple `InfoPathView` objects to convert and merge multiple views in a single operation.