Support for DICOM Images

Contents
[ ]

The DICOM standard was developed by the National Electrical Manufacturers Association. This format covers the functions of creating, storing, transferring, and printing individual image frames, series of frames, patient information, research, equipment, institutions, medical personnel performing the examination, and the like.

The following code snippet also work with Aspose.PDF.Drawing library.

Aspose.PDF for .NET supports functionality to add DICOM images to PDF documents. The following code snippet shows how to use this functionality.

// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void AddDicomImageToPDF()
{
    // The path to the documents directory
    var dataDir = RunExamples.GetDataDir_AsposePdf_Images();

    // Open document using 'using' block to ensure proper disposal
    using (var document = new Aspose.Pdf.Document())
    {
        // Add a page to the document
        document.Pages.Add();

        // Create an image instance and set its properties
        var image = new Aspose.Pdf.Image
        {
            FileType = Aspose.Pdf.ImageFileType.Dicom,
            ImageStream = new FileStream(dataDir + "DicomImage.dcm", FileMode.Open, FileAccess.Read)
        };

        // Add image to the first page
        document.Pages[1].Paragraphs.Add(image);

        // Save output as PDF format
        document.Save(dataDir + "PdfWithDicomImage_out.pdf");
    }
}