Cairo Rendering

Version 3.9.9 adds optional Cairo rendering on Windows. Applications can call SetCairoFileName with the full path to cairo.dll, then call SelectRenderer(2) to render with Cairo. SelectRenderer(1) switches back to GDI+, and SelectRenderer(3) selects PDFium when PDFium support is available.

Version 3.9.10 fixes Cairo graphics-state restoration so clipped image regions do not limit subsequent page content after PDF q/Q save and restore operators.

Version 3.9.11 fixes Cairo rendering for PDF image XObjects that use color-key /Mask arrays, including logos and images with transparent background colors.

Version 3.9.12 improves default GDI+ image quality by enabling smooth image interpolation and using high-quality bicubic resampling for scaled images. Applications can still call SetGDIPlusOptions(3, 0) to restore the previous sharper nearest-neighbor image scaling behavior.

Supported rendering paths

- RenderPageToStream and RenderPageToFile support Cairo bitmap, JPEG, PNG, GIF, TIFF, and G4 TIFF output.

- RenderDocumentToFile supports multi-page Cairo raster output for the same image formats.

- RenderPageToDC renders the selected page to a Windows device context using Cairo.

- PrintDocument and PrintPages use Cairo when renderer 2 is selected.

- RenderPageToMemory is not supported by the Cairo renderer.

Deployment notes

The Cairo DLL must match the process architecture. The distribution stores the runtime files under DLL\Cairo\Win32 and DLL\Cairo\Win64. Deploy cairo.dll with the application or configure the application to pass an absolute DLL path to SetCairoFileName.

Delphi syntax

function TPDFlib.SetCairoFileName(const FileName: WideString): Integer;
function TPDFlib.SelectRenderer(RendererID: Integer): Integer;
function TPDFlib.SelectedRenderer: Integer;