0

We are building and Azure App function and we would like to do an in-memory transition from PDF to PNG. A nuget distributed dll would be ideal.

2 Answers2

3

Patagames PDF SDK is suitable for Azure very well. Also it's distributed via NUGET

PM> Install-Package Pdfium.Net.SDK

code snippet:

PdfCommon.Initialize()
using (var doc = PdfDocument.Load(@"d:\0\test_big.pdf"))
{
    int dpi = 96;
    foreach (var page in doc.Pages)
    {
        int width = (int)(page.Width / 72.0  * dpi);
        int height = (int)(page.Height / 72.0 * dpi);
        using (var bitmap = new PdfBitmap(width, height, true))
        {
            bitmap.FillRect(0, 0, width, height, Color.White);
            page.Render(bitmap, 0, 0, width, height, PageRotate.Normal, RenderFlags.FPDF_LCD_TEXT);
            bitmap.Image.Save(...);
        }
        page.Dispose();
    }
}
Oldman
  • 29
  • 2
0

I preferred Xfinium PDF Library as it also worked with Mono and was pretty easy to use. It is a commercial solution, though.

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
mbnx
  • 912
  • 5
  • 11