Enabling Advanced PDF Features in PixTools 8.3

Prior to the recent PixTools 8.3 release, PixTools supported Image Only PDF files.  With the new release, the following PDF types will also be supported:

 

  • Image only
  • Image plus text
  • Vector
  • Non-vector
  • Mixed Raster Content
  • JBIG2 compressed
  • JPEG 2000 compressed
  • PDF 1.6 and later compression using JPEG2000

 

To get the newer PDF features enabled in your code, see the function SetPDFRendering in the below listing. The code in this function must be called before the ReadFileDriver object is created.  This is because the PDFRendering property must be set prior to making the ReadFileDriver instance.  Here is a code excerpt illustrating how to enable the new PDF features in PixTools 8.3:

 


PDFRenderingSettings pdfSettings;

public void SetPDFRendering()
{
      // Get current PDF rendering settings
      pdfSettings = PixTools.PixScan.ReadFileDriver.PDFRendering;
     
      // Change settings
      pdfSettings.EnableRendering = true;
      pdfSettings.DetectPageResolution = false;
      pdfSettings.Resolution = 100; // DPI
      pdfSettings.Smoothing = PixPDFSmoothing.None;
      // Set new PDF rendering settings
      ReadFileDriver.PDFRendering = pdfSettings;
}

private void buttonScan_Click(object sender, EventArgs e)
{
      SetPDFRendering();
      ReadFileDriver driver = new ReadFileDriver();
      SimpleScanner scanner = new SimpleScanner(driver);
      scanner.OnPage += new EventHandler(scanner_OnPage);
      foreach (FileInfo f in files)
      {
           try
           {
                driver.OpenFile(f.FullName);
                scanner.Scan();
           }
                catch (PixException er);
           {
                MessageBox.Show(er.Message);
           }
      }
}

private void scanner_OnPage(object sender, PageEventArgs e)
{
      document.Add(e.Page);
      PixImageNode node = document.Children[imageCounter] as PixImageNode;
      pixView.Image = node.Image;
      imageCounter++;
}