Patagames Software Support Forum
»
Pdfium.Net SDK
»
FAQ
»
How to convert each page of Pdf to Image
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
Questionhi. How to convert each page of Pdf to Image of same size(jpg/png/...)? Please guid me with an example. AnswerCode:
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();
}
}
Edited by user Saturday, October 15, 2016 8:04:53 PM(UTC)
| Reason: Not specified
|
|
|
|
|
|
Patagames Software Support Forum
»
Pdfium.Net SDK
»
FAQ
»
How to convert each page of Pdf to Image
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close