Home  PDF-To-Image  PDFExtractTIFF  PDF2Image  ScreenShots  Articles  Products  Downloads

VC++ Example for PDF to Image Converter SDK

void ConvertPDFToImageFile()
{
    char *szPDFFileName = "C:\\in.pdf"
    char *szOutputName = "C:\\out.tif"
    int pagecount = PDFToImageGetPageCount(szPDFFileName);
    printf("Filename is: %s\n",szPDFFileName);
    printf("Page count is: %d\n",pagecount);
    for(int page = 1; page <= pagecount; page++)
    {
        double fPageBox[4];
        int result = PDFToImageGetPageBox(szPDFFileName,page,fPageBox);
        printf("Page %3d box is: [%f,%f,%f,%f]\n",page,fPageBox[0],fPageBox[1],fPageBox[2],fPageBox[3]);
        int iPageWidth = PDFToImageGetPageWidth(szPDFFileName,page);
        int iPageHeight = PDFToImageGetPageHeight(szPDFFileName,page);
    }
    //PDFToImageSetProgressCBFunc(PageProgressCBFunc);
    PDFToImageSetFileNameSuffix(".%d");

    int iBeginTick = GetTickCount();
    int result = PDFToImageConverter(szPDFFileName,szOutputName,NULL,NULL,150,150,24, COMPRESSION_PACKBITS,70,FALSE,TRUE,-1,-1);

    //Convert PDF file to 204x98DPI TIFF-F File,
    //int result = PDFToImageConverter(szPDFFileName,szOutputName,NULL,NULL,200,200,24, COMPRESSION_CLASSF,100,FALSE,FALSE,-1,-1);

    //Convert PDF file to 204x196DPI TIFF-F File,
    //int result = PDFToImageConverter(szPDFFileName,szOutputName,NULL,NULL,300,300,24, COMPRESSION_CLASSF196,100,FALSE,FALSE,-1,-1);

    int iEndTick = GetTickCount();

    //Draw a PDF file to HDC directly
    //HBITMAP hBitmap = PDFToImageDrawToHDC(szPDFFileName,GetDC(NULL),NULL,NULL,100,100,24,FALSE,1);
    //if(hBitmap)
    //       DeleteObject(hBitmap);
    //result = TIFFImageSetOptions(szOutputName,-1,1,COMPRESSION_NONE);
    printf("PageCount = %d, Return value is %d, time = %d ms\n",pagecount,result,iEndTick-iBeginTick);
}

PDF To Image Converter COM component user manual
Click here to download evaluation version of PDF to Image Converter SDK
Click here to purchase PDF to Image Converter SDK
ASP Example for PDF to Image Converter SDK
VC++ Example for PDF to Image Converter SDK
VB.NET Example for PDF to Image Converter SDK


Home | Products | Downloads | Support | Links | Contact

Copyright © 2000- VeryPDF.com, Inc. All rights reserved.
Send comments about this site to the webmaster.