Perfectly Clear SDK Documentation  9.1.1.325
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PDF Usage Example

PDF support in this SDK allows you to quickly extract embedded images from a PDF file, correct them with Perfectly Clear, then replace the original images with the corrected version. The result will be a PDF file in the exact same structure as the original - but all the photos will be Perfectly Clear!

Access image files embedded in PDF files easily with our PFCPDFImageIterator, then use a PFCPDFImage and PFCImage to access the image itself.

The results will automatically be embedded back in the PDF file.

  1. Create a PFCPDFImageIterator and load the PDF file
    if(file.load(inputPath) != PFCPDFImageIterator::LoadStatus::Ok) {
    printf("Cannot load path %s\n", inputPath);
    return 1;
    }
  2. Begin iterating over the images
    int i = 0;
    while(PFCPDFImage* pdfImage = file.nextImage()) {
  3. Create a PFCImageFile from the extracted image
    PFCImageFile* imgFile = pdfImage->imageFile;
    printf(" working on image %d\n", i);
    Then correct the PFCImageFile as normal
  4. Once done with all embedded images, save the resulting PDF:
    if(file.save(outputPath) != PFCPDFImageIterator::SaveStatus::Ok) {
    printf("Cannot save to %s\n", outputPath);
    return 1;
    }
    We provide full source code to a ready-to-run command line application to make it easy to get stated with PDF file processing.

Notes

  • Images need to be embedded in a PDF file for them to be accessible to the SDK. "Flattened" PDFs are not supported.
    * Each image that is processed will be evaluated by our AI-based Clipart Detection. This will allow images for headings, borders, and other clipart to skip Perfectly Clear processing - ensuring these files look exactly as the customer intended. Control this detection method using the PFCREJECTOPTION flag.