ImageGear for C and C++ on Windows v19.10 - Updated
Image to PDF
User Guide > How to Work with... > Formats with Additional Functionality > PDF > How to... > Convert... > Image to PDF

Before working with a PDF document, make sure to initialize the PDF component (see Getting Started with PDF).

The following example illustrates how to load an image file and save it as a single PDF file:

C and C++
Copy Code
   AT_ERRCOUNT numberErrors = 0;
   LPSTR inputPath = "MyImagePath.jpg";
   LPSTR outputPath = "mySavedPDF.pdf";
   HIGEAR image = 0;
   UINT firstPage = 0;
   bool overwrite = TRUE;
   // Load image from file into memory, and create a HIGEAR handle for the image.
   numberErrors += IG_load_file(inputPath, &image);
   // Save loaded image as a PDF.
   numberErrors += IG_fltr_save_file(image, outputPath, IG_FORMAT_PDF, firstPage, overwrite);
   // Release the file.
   numberErrors += IG_image_delete(image);