Some test text!


C# DICOM to PDF converter

More languages

More languages
C# (.NET Core)
JS (Node.js)

Sample C# code demonstrates how to use the PDFTron Advanced Imaging module for direct, high-quality conversion from DICOM to PDF. Learn more about our C# PDF Library and PDF Conversion Library.

Get StartedSamplesDownload

To run this sample, get started with a free trial of PDFTron SDK.

// Generated code. Do not modify!
// Copyright (c) 2001-2021 by PDFTron Systems Inc. All Rights Reserved.
// Consult legal.txt regarding legal and license information.     

using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;

using pdftron;
using pdftron.Common;
using pdftron.PDF;
using pdftron.SDF;

namespace AdvancedImagingTestCS
    /// <summary>
    // The following sample illustrates how to convert Advanced Imaging documents (such as dcm,
    // aai, arw etc.) to pdf 
    /// </summary>
    class Class1
		private static pdftron.PDFNetLoader pdfNetLoader = pdftron.PDFNetLoader.Instance();
		static Class1() {}

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
			// The first step in every application using PDFNet is to initialize the 
			// library and set the path to common PDF resources. The library is usually 
			// initialized only once, but calling Initialize() multiple times is also fine.
            if (!AdvancedImagingModule.IsModuleAvailable())
                Console.WriteLine("Unable to run AdvancedImagingTest: PDFTron SDK Advanced Imaging module not available.");
                Console.WriteLine("The Advanced Imaging module is an optional add-on, available for download");
                Console.WriteLine("at If you have already downloaded this");
                Console.WriteLine("module, ensure that the SDK is able to find the required files");
                Console.WriteLine("using the PDFNet::AddResourceSearchPath() function.");

            // Relative path to the folder containing test files.
            string input_path =  "../../../../TestFiles/AdvancedImaging/";
            string output_path = "../../../../TestFiles/Output/";

            string input_file_name = "xray.dcm";
            string output_file_name = "xray.dcm.pdf";

            if (args.Length != 0)
                input_file_name = args[0];
                output_file_name = input_file_name + ".pdf";

            Console.WriteLine("Example advanced imaging:");
                using (PDFDoc pdfdoc = new PDFDoc())
                    AdvancedImagingConvertOptions opts = new AdvancedImagingConvertOptions();
                    pdftron.PDF.Convert.FromDICOM(pdfdoc, input_path + input_file_name, opts);
                    pdfdoc.Save(output_path + output_file_name, SDFDoc.SaveOptions.e_remove_unused);

            catch (PDFNetException e)

Free Trial

Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.

Select a platform to get started with your free trial.

Unlimited usage. No email address required.