Convert PDF Files to Images

The code below shows you how to convert a PDF file to images.

This sample requires a Tools license.

C#
using System;
using SolidFramework.Converters.Plumbing;
using SolidFramework;
using SolidFramework.Converters;

namespace PDFPagestoImages
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            // Call your Solid Documents License
            SolidFramework.License.Import(@"C:\MyFolder\license.xml");

            // Set the location of your the file you want to convert
            String pdfPath = @"C:\YourFolder\yourpdf.pdf";

            //*PDF to PDF Page Images*//
            using (PdfToImageConverter pageImage = new PdfToImageConverter())
            {
                // Add the selected file 
                pageImage.AddSourceFile(pdfPath);

                // Set the ImageConvertionType to extact pages 
                pageImage.ConversionType = ImageConversionType.ExtractPages;

                // Set the DPI to determine the dimensions of the images 
                pageImage.PageDPI = 300;

                // Choose from the supported image file types 
                pageImage.OutputType = ImageDocumentType.Tiff;

                // Set this if you only want to extract certain pages 
                pageImage.PageRange = PageRange.Parse("1-5");

                // Choose the directory the images will be saved to 
                pageImage.OutputDirectory = @"C:\MyPDFPageImages";

                // Convert the pages to images 
                pageImage.Convert();
            }
        }
    }
}
C++
#include "stdafx.h"
#include "SolidFramework.h"

using namespace std;

int main()
{
    // Call your Solid Documents License
    SolidFramework::License::Import(L"c:\\YourFolder\\license.xml");

    // Add the PDF file to convert
    wstring pdfPath(L"c:\\MyFolder\\yourpdf.pdf");

    //*PDF to PDF Page Images*//
    SolidFramework::Converters::PdfToImageConverterBasePtr pageImage(new SolidFramework::Converters::PdfToImageConverterBase());
    // Add the selected file 
    pageImage->AddSourceFile(pdfPath);

    // Set the ImageConvertionType to extact pages 
    pageImage->setConversionType(SolidFramework::Converters::Plumbing::ImageConversionType::ExtractPages);

    // Set the DPI to determine the dimensions of the images 
    pageImage->setPageDPI(300);

    // Choose from the supported image file types 
    pageImage->setOutputType(SolidFramework::Converters::Plumbing::ImageDocumentType::Tiff);

    // Set this if you only want to extract certain pages 
    pageImage->setPageRange(SolidFramework::PageRange::Parse(L"1-5"));

    // Choose the directory the images will be saved to 
    pageImage->setOutputDirectory(L"C:\\MyPDFPageImages");

    // Convert the pages to images 
    pageImage->Convert();

    pageImage->Dispose();

    return 0;
}
VB.Net
Imports SolidFramework.Converters.Plumbing
Imports SolidFramework

Module PDFPagestoImages

    Sub Main()

        ' Call your Solid Documents License
        SolidFramework.License.Import("C:\MyFolder\license.xml")

        'Define a variable for your source file
        Dim sPdfPath As String

        ' Define your Solid Framework Converter
        Dim myConverter As SolidFramework.Converters.PdfToImageConverter

        ' Set your file path 
        sPdfPath = "C:\YourFolder\filepdf.pdf"

        ' Set the converter
        myConverter = New SolidFramework.Converters.PdfToImageConverter

        'Set the preferred conversion properties 

        ' Add files to convert. 
        myConverter.AddSourceFile(sPdfPath)

        ' Set the ImageConvertionType to extact pages 
        myConverter.ConversionType = ImageConversionType.ExtractPages

        ' Set the DPI to determine the dimensions of the images 
        myConverter.PageDPI = 300

        ' Set this if you only want to extract certain pages 
        myConverter.PageRange = PageRange.Parse("1-5")

        ' Choose the directory the images will be saved to 
        myConverter.OutputDirectory = "C:\MyPDFPageImages"

        ' Convert the File.
        myConverter.Convert()

        ' Clean up
        myConverter.Dispose()

    End Sub

End Module