How to launch Document. Net in Android / iOs

Android is a mobile operating system based on a modified version of the Linux kernel and other open source software, designed primarily for touchscreen mobile devices such as smartphones and tablets. Android is developed by a consortium of developers known as the Open Handset Alliance and commercially sponsored by Google.

Document .Net by SautinSoft is a standalone .NET component with cross-platform support. You can use it on non-Windows platforms like Xamarin and Mono, enabling you to run it on Android and iOS mobile devices.

With Document .Net you can process your documents (read, write, convert, and edit DOCX, RTF, PDF, HTML files) from the native mobile apps.

The following example shows how you can convert any file: DOCX, RTF, HTML to PDF file in Xamarin.Forms mobile application.

1. Create a new Xamarin App (Xamarin.Forms)

If you want to create a new application for Android or iOs, you need to be sure that you have installed the appropriate packages and plugins in the Visual Studio (Windows or macOS).

In our case, the project is here:

Next, need to configure your new project:

After all steps, you will see the next interface:

You can download a ready-made sample code and study it:

2. XAML and C# files

Xaml file.

C# file.

using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Essentials;

using SautinSoft.Document;

namespace SautinSoft.Document.Xamarin.Example
    public partial class MainPage : ContentPage
        private string PathDocx { get; set; }
        static MainPage()
            /// <summary>
            /// Convert DOCX, RTF, HTML to PDF (file to file) by Android/iOs.
            /// </summary>
            /// <remarks>
            /// Details:
            /// </remarks>

        public MainPage()

        private string ConvertDocument()
            var dc = DocumentCore.Load(PathDocx, LoadOptions.DocxDefault);
            var filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Example.pdf");

            return filePath;

        private async void Button_Choose(object sender, EventArgs e)
            buttonchoose.IsEnabled = false;
            activity.IsRunning = true;

            var customFileType =
       new FilePickerFileType(new Dictionary DevicePlatform, IEnumerable
            { DevicePlatform.iOS, new[] { "" } }, // or general UTType values
            { DevicePlatform.Android, new[] { "*/*" } },
            var options = new PickOptions
                PickerTitle = "Please select any file",
                FileTypes = customFileType,
            var result = await FilePicker.PickAsync(options);
            PathDocx = result.FullPath;
            activity.IsRunning = false;
            buttonchoose.IsEnabled = true;

        private async void Button_Clicked(object sender, EventArgs e)
            buttonconvert.IsEnabled = false;
            activity.IsRunning = true;

                var filePath = await Task.Run(() => ConvertDocument());
                await Launcher.OpenAsync(new OpenFileRequest(Path.GetFileName(filePath), new ReadOnlyFile(filePath)));
            catch (Exception ex)
                await DisplayAlert("Error", ex.Message, "Close");

            activity.IsRunning = false;
            buttonconvert.IsEnabled = true;

3. Limitations on Android or iOS

You can use the full functionality of Document .Net on the Xamarin applications, but with the following exceptions:
Printing files.
Saving files to image formats.
Saving charts and group shapes to PDF and image formats.

These features currently have WPF dependencies which means they require a .NET Windows Desktop Runtime.

However, we do have plans for providing cross-platform support for them in future releases.


Thank you.

If you need a new code example or have a question: email us at or ask at Online Chat (right-bottom corner of this page) or use the Form below:

Questions and suggestions from you are always welcome!

We are developing .Net components since 2002. We know PDF, DOCX, RTF, HTML, XLSX and Images formats. If you need any assistance with creating, modifying or converting documents in various formats, we can help you. We will write any code example for you absolutely free.