Reputation: 93
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.
Upvotes: 0
Views: 1284
Reputation: 942
I preferred Xfinium PDF Library as it also worked with Mono and was pretty easy to use. It is a commercial solution, though.
Upvotes: 0
Reputation: 29
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();
}
}
Upvotes: 3