> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/core/conversion/convert-dicom-to-pdf.md).

# Convert DICOM to PDF on Server/Desktop

Convert DICOM and other image formats to PDF seamlessly with the Advanced Imaging Module for Apryse SDK 9.0. Learn how to install, supported formats, usage, and conversion options here. The Apryse Ser

The Advanced Imaging Module is an optional add-on which can be used with Apryse SDK 9.0 or later to convert DICOM and other image formats (such as AAI, ARW, DCR and RAF) to PDF without any external dependencies. It works by enhancing the already existing [`PDF.Convert.ToPDF`](https://sdk.apryse.com/api/PDFTronSDK/cpp/classpdftron_1_1_p_d_f_1_1_convert.html#a44fadf1d0956e49c588bf66a37e1f518) method, adding support for all the new formats. Additionally, you can use the [`PDF.Convert.FromDICOM`](https://sdk.apryse.com/api/PDFTronSDK/cpp/classpdftron_1_1_p_d_f_1_1_convert.html#a6cda7f3a3bdde027d9d10d9a1f0a5896) method to supply DICOM-specific options to the conversion module.

You can find more details about how to [install advanced imaging module](/core/learn-more/modules.md#advanced-imaging-module).

## Supported formats

The module is primarily designed to convert DICOM images to PDF documents. However, conversion of many other advanced imaging formats such as HEIC, ARW, DCR and RAF are also supported; see [advanced imaging module guide](/core/learn-more/modules.md#advanced-imaging-module) for a full list.

## Usage

To use the advanced imaging module, you must use the `PDFNet.AddResourceSearchPath` method with the path to the module's `Lib/` folder to include the module files.

{% hint style="warning" %}
**Warning**

Requires the advanced imaging module add-on. All files in the `Lib` folder of the archive must be present for the module to work as expected.
{% endhint %}

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
PDFNet.Initialize();
PDFNet.AddResourceSearchPath("relative/path/to/Lib/");
```

{% endcode %}
{% endtab %}

{% tab title="C++" %}
{% code lineNumbers="true" %}

```cpp
PDFNet::Initialize();
PDFNet::AddResourceSearchPath("relative/path/to/Lib/");
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
PDFNet.initialize();
PDFNet.addResourceSearchPath("relative/path/to/Lib/");
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
PDFNet.addResourceSearchPath("relative/path/to/Lib/");
```

{% endcode %}
{% endtab %}

{% tab title="VB" %}
{% code lineNumbers="true" %}

```vb
PDFNet.Initialize()
PDFNet.AddResourceSearchPath("relative/path/to/Lib/")
```

{% endcode %}
{% endtab %}
{% endtabs %}

If the module has been successfully added, you can use the [`Convert.FromDICOM`](https://sdk.apryse.com/api/PDFTronSDK/cpp/classpdftron_1_1_p_d_f_1_1_convert.html#a6cda7f3a3bdde027d9d10d9a1f0a5896) method. This method requires that you pass in a [`PDFDoc`](https://sdk.apryse.com/api/PDFTronSDK/cpp/classpdftron_1_1_p_d_f_1_1_p_d_f_doc.html) object that will **append** converted pages to the specified PDF document.

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
using (PDFDoc doc = new PDFDoc()){
    pdftron.PDF.Convert.FromDICOM(doc, input_file_path + intput_file_name, null);
    doc.Save(output_file_path + output_file_name, SDFDoc.SaveOptions.e_remove_unused);
}
```

{% endcode %}
{% endtab %}

{% tab title="C++" %}
{% code lineNumbers="true" %}

```cpp
PDFDoc doc;
Convert::FromDICOM(doc, input_file_path + input_file_name, null);
doc.Save(output_file_path + output_file_name, SDF::SDFDoc::e_linearized, NULL);
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
PDFDoc doc = new PDFDoc();
Convert.fromDICOM(doc, input_file_path + input_file_name, null);
doc.save(output_file_path + output_file_name, SDFDoc.SaveMode.LINEARIZED, null);
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
async function main() {
	const doc = await PDFNet.PDFDoc.create();
	await PDFNet.Convert.fromDICOM(doc, input_file_path + input_file_name, null);
	await doc.save(output_file_path + output_file_name, PDFNet.SDFDoc.SaveOptions.e_linearized);
}
PDFNet.runWithCleanup(main);
```

{% endcode %}
{% endtab %}

{% tab title="VB" %}
{% code lineNumbers="true" %}

```vb
Dim doc As PDFDoc = New PDFDoc()
pdftron.PDF.Convert.FromDICOM(doc, input_path & input_file_name, Nothing)
doc.Save(output_path & output_file_name, SDFDoc.SaveOptions.e_remove_unused)
```

{% endcode %}
{% endtab %}
{% endtabs %}

### Conversion options

You can also optionally provide a `AdvancedImagingConvertOptions` as an argument to set a DefaultDPI for the image. If no DPI can be deduced from the existing image, then the default DPI provided will be used as the DPI for the final converted document. If this option is not used, a DPI value of 72.0 will be used to create the output. For DICOM images, Pixel Spacing attribute is used to determine the DPI of the image.

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
AdvancedImagingConvertOptions opts = new AdvancedImagingConvertOptions();
opts.SetDefaultDPI(72.0);

pdftron.PDF.Convert.FromDICOM(doc, input_file_path + input_file_name, opts);
```

{% endcode %}
{% endtab %}

{% tab title="C++" %}
{% code lineNumbers="true" %}

```cpp
AdvancedImagingConvertOptions opts;
opts.SetDefaultDPI(72.0);

Convert::FromDICOM(doc, input_file_path + input_file_name, &opts);
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
AdvancedImagingConvertOptions opts = new AdvancedImagingConvertOptions();
opts.setDefaultDPI(72.0);

Convert.fromDICOM(doc, input_file_path + input_file_name, opts);
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
async function main() {
	const opts = new PDFNet.Convert.AdvancedImagingConvertOptions();
	opts.setDefaultDPI(72.0);

	await PDFNet.Convert.fromDICOM(doc, inputPath + input_file_name, opts);
}
PDFNet.runWithCleanup(main);
```

{% endcode %}
{% endtab %}

{% tab title="VB" %}
{% code lineNumbers="true" %}

```vb
Dim opts As AdvancedImagingConvertOptions = New AdvancedImagingConvertOptions()
opts.SetDefaultDPI(72.0)

pdftron.PDF.Convert.FromDICOM(doc, input_path & input_file_name, opts)
```

{% endcode %}
{% endtab %}
{% endtabs %}

Combinining the above, the module can likely be used in the following way(s).

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
// Use a try-catch block here to catch PDFNetException
PDFNet.AddResourceSearchPath('relative/path/to/Lib/');
using (PDFDoc pdfdoc = new PDFDoc())
{
	AdvancedImagingConvertOptions opts = new AdvancedImagingConvertOptions();
	opts.SetDefaultDPI(72.0);
	pdftron.PDF.Convert.FromDICOM(pdfdoc, input_path + input_file_name, opts);
	pdfdoc.Save(output_path + output_file_name, SDFDoc.SaveOptions.e_remove_unused);
}
```

{% endcode %}
{% endtab %}

{% tab title="C++" %}
{% code lineNumbers="true" %}

```cpp
// Use a try-catch block here to catch PDFNetException
PDFNet::AddResourceSearchPath('relative/path/to/Lib/');
PDFDoc pdfdoc;
AdvancedImagingConvertOptions opts;
opts.SetDefaultDPI(72.0);
Convert::FromDICOM(pdfdoc, inputPath + inputFile, &opts);
pdfdoc.Save(outputPath + outputFile, SDF::SDFDoc::e_linearized, NULL);
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
// Use a try-catch block here to catch PDFNetException
PDFNet.addResourceSearchPath('relative/path/to/Lib/');
PDFDoc doc = new PDFDoc();
AdvancedImagingConvertOptions opts = new AdvancedImagingConvertOptions();
opts.setDefaultDPI(72.0);
Convert.fromDICOM(doc, input_path + input_file_name, opts);
doc.save(outputFile, SDFDoc.SaveMode.LINEARIZED, null);
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
const main = async () => {
	// Use a try-catch block here to catch PDFNetException
	await PDFNet.addResourceSearchPath('relative/path/to/Lib/');
	const doc = await PDFNet.PDFDoc.create();
	const opts = new PDFNet.Convert.AdvancedImagingConvertOptions();
	opts.setDefaultDPI(72.0);
	await PDFNet.Convert.fromDICOM(doc, inputPath + input_file_name, opts);
	await doc.save(outputPath + output_file_name, PDFNet.SDFDoc.SaveOptions.e_linearized);
};
PDFNet.runWithCleanup(main).then(function(){ PDFNet.shutdown(); });
```

{% endcode %}
{% endtab %}

{% tab title="VB" %}
{% code lineNumbers="true" %}

```vb
// Use a try-catch block here to catch PDFNetException
PDFNet.AddResourceSearchPath('relative/path/to/Lib/')
Using pdfdoc As PDFDoc = New PDFDoc()
	Dim opts As AdvancedImagingConvertOptions = New AdvancedImagingConvertOptions()
	opts.SetDefaultDPI(72.0)
	pdftron.PDF.Convert.FromDICOM(pdfdoc, input_path & input_file_name, opts)
	pdfdoc.Save(output_path & output_file_name, SDFDoc.SaveOptions.e_remove_unused)
End Using
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Sample

The module ships with the fully working [AdvancedImagingTest sample code](https://sdk.apryse.com/api/PDFTronSDK/cpp/classpdftron_1_1_p_d_f_1_1_convert.html#a6cda7f3a3bdde027d9d10d9a1f0a5896) which can be used to test the conversion functionality using provided test files or your own documents. The sample first initializes PDFNet, which is required for all Apryse SDK functionality, then uses `PDFNet.AddResourceSearchPath` to include the advanced imaging Module. The same lines of code can be used to integrate the module in your application or project.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/core/conversion/convert-dicom-to-pdf.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
