New PDF rendering engine for Debenu Quick PDF Library

Please note that the information and files shared in this blog post are private and confidential and should not be discussed on any public forums until otherwise stated by Debenu.

We’re really excited to share with you a new rendering engine that we’ve been working on for Debenu Quick PDF Library. This new rendering engine no longer relies on GDI+ and has major improvements in the following areas:

  • Full transparency support (transparency groups, soft masks, including all supported blend modes)
  • Shading patterns support (function-based shadings, axial shadings, radial shadings, triangle meshes, coons patch meshes, tensor-product patch meshes)
  • Tiling patterns support (colored, uncolored)
  • Line dash pattern support
  • Image handling improvements (images can now be passed to DPLR as a pure data, new image transformation tool)
  • Additional image rendering filters (bilinear, bicubic) to improve image antialiasing
  • PDF functions bug fixes

This new rendering engine will be part of the standard Debenu Quick PDF Library although it will be a separate DLL which will need to be called from within the main library binary file.

The steps for installing and using this new rendering engine are provided below.

Steps

  1. Download and install Debenu Quick PDF Library 10.12 from the product updates page (if you haven’t already got it installed. You will need version 10.12 in order to use the new rendering engine.
  2. Download the new Debenu PDF Renderer (DebenuPDFRendererDLL1012.dll is 32-bit and DebenuPDFRenderer64DLL1012.dll is 64-bit) binaries.
  3. In your code call the SetDPLRFileName function to specify the location of the DebenuPDFRenderer.dll binary file on your machine. Then call the SelectRenderer function and specify 3 as the value for the RendererID parameter to select the new Debenu PDF Renderer.
  4. Now call either the RenderPageToDC or DARenderPageToDC functions to see the results of the new rendering engine. Currently only rendering to DC (device context) is supported but support will also be added for functions such as RenderPageToFile shortly.

Sample Code

Here’s some sample code in C# which demonstrates how to choose the new rendering engine and then render each page as an image.

DPL.LoadFromFile("Test.PDF", "");
 
double pw, ph;
double scale, sx, sy;
 
if ((DPL.PageRotation() % 180) == 0)
{
    pw = DPL.GetPageBox(2, 2);  // Width
    ph = DPL.GetPageBox(2, 3);  // Height
}
else
{
    pw = DPL.GetPageBox(2, 3);  // Rotated Height
    ph = DPL.GetPageBox(2, 2);  // Rotated Width
}
 
sx = pictureBox1.Width / pw;
sy = pictureBox1.Height / ph;
 
scale = Math.Min(sx, sy);
 
int page = 1;
 
Bitmap b = new Bitmap((int)pictureBox1.Width, (int)pictureBox1.Height, PixelFormat.Format32bppArgb);
using (Graphics g = Graphics.FromImage(b))
{
    IntPtr dc = g.GetHdc();
 
	// Point to the new DPLR DLL
    int SetDPLRVal = DPL.SetDPLRFileName(@"C:\Temp\RenderAGG\DebenuPDFRendererDLL1012.dll");
 
	// Select the new DPLR engine
    int SelectRendVal = DPL.SelectRenderer(3);
 
	// Render to DC
    DPL.RenderPageToDC(72 * scale, page, (int)dc);
    g.ReleaseHdc(dc);
    pictureBox1.Image = b;
}

Feedback

Do you like what you see with the new rendering engine? Leave a comment either way, we’d love to hear from you.

10 thoughts on “New PDF rendering engine for Debenu Quick PDF Library

  1. Alain Perrez

    First, thank you to let us try out your new rendering engine !
    Unless I’m mistaken, the text markup annotations (AddTextMarkupAnnotation) that are created with transparency and blending are not rendered. Is this planned ?
    I’m waiting RenderPageToStream support for doing more tests …

  2. Rowan

    Hello Alain,

    Text markup annotations are not currently supported but they will be supported shortly. We’ll also add the new rendering functionality to all of the rendering functions within the next couple of weeks.

    Finally, in case anyone is wondering, we will be enhancing our printing functionality with the same improvements within the next couple of months, so stay tuned for that beta as well.

    – Rowan.

    1. DebenuLabs Post author

      We are looking into this, looks like a bug in building process, mfc100u.dll should not be necessary for the renderer. Thanks for pointing this out.

      -Matus (dev@debenu)

  3. Vladimir Cheplygin

    Found it.
    SelectRenderer(3) returns 3, which I considered to be an error, but actually it seems to be an ID of the new renderer.
    New renderer solves the problem reported in Case #7260.
    However PDF reported in Case #2109 is shown incorrectly, according to Andrew:
    “That PDF is heavily compressed and is using JBIG2 encoding as a mask and 2 other images that are merged together”

Leave a Reply