Back to Blog

    Developer Blog

    Rendering PDFs Through Quick PDF Library

    Tech
    Rendering in QPL

    Most Quick PDF Library developers use Quick PDF Library SDK to render PDF documents in many different ways through their applications. The Library employs 3 different rendering engines to account for the many different situations customers may want.

    Our standard renderer (GDI) is built into Quick PDF Library directly and works out of the box if a user calls one of the many rendering functions. But in addition to this, Quick PDF Library is setup to call the API of another 2 renderers in the form of DLL files. Both of these renderers are part of the install package and can be found in the Quick PDF Library installation location. These rendering engines are AGG and PDFium.

    GDI

    The default renderer, GDI, is good for rendering simple PDF files which use standard text/image objects and simple layout. If the file is more complicated, with advanced graphics, transparencies, shading or tiling patterns, GDI may not be as optimized. This is where using AGG or PDFium comes into play. Because GDI is the default renderer, there is additional work required to implement the other renderers.

    Implementation

    The best way to proceed is first to take the renderer DLLs that are in the install location and put it into your project directory. Just note that the AGG render DLL is named DebenuPDFLibraryRenderer. You only need to initialize the external renderer in your code once through finding your UnlockKey function call and initialize the renderer right after the Quick PDF Library is unlocked.

    AGG

    For AGG you will need to put just 2 lines right after the UnlockKey function call:

    QPL.SetDPLRFileName(path to AGG DLL); //you have to provide the correct path to the DLL file
    QPL.SelectRenderer(3); //calling this function with parameter 3 will set the rendering routines to AGG DLL

    After this, you can call the rendering functions and AGG will do the rendering previously done by GDI.

    PDFium

    It is a similar process to initialize PDFium.

    QPL.SetPDFiumFileName(path to PDFium DLL); //you have to provide the correct path to the DLLfile
    QPL.SelectRenderer(4); //calling this function with parameter 4 will set the rendering routines to PDFium DLL

    In Summary

    Technically, you could initialize all renderers in your code using the code above and then simply use the SelectRender function to switch between the renderers as required. For comparison, you can take a look at the different rendering outputs of the same page that were rendered using GDI, AGG and PDFium below.

    outGDI

    GDI Output

    outAGG

    AGG Output

    outPDFium

    PDFium Output