Do you own a Debenu Quick PDF Library 8 or earlier license? Upgrade to Debenu Quick PDF Library 9 today!
![]() |
Render at high DPI with max width |
Post Reply
|
| Author | |
Rowan
Moderator Group
Joined: 10 Jan 09 Online Status: Offline Posts: 319 |
Post Options
Quote Reply
Topic: Render at high DPI with max widthPosted: 30 Mar 12 at 9:39AM |
|
int outputDPI = 200; int maxWidth = 1000; for (int page = 1; page <= totalIMGS; page++) { lib.SelectPage(page); double pageWidth = lib.PageWidth(); double pageHeight = lib.PageHeight(); double scale = 1; int imgWidth = Convert.ToInt32((pageWidth / 72) * outputDPI); int imgHeight = Convert.ToInt32((pageHeight / 72) * outputDPI); if (imgWidth > maxWidth) { scale = (double)maxWidth / (double)imgWidth; imgWidth = maxWidth; imgHeight = Convert.ToInt32(imgHeight * scale); } using (Bitmap dcBmp = new Bitmap(imgWidth, imgHeight)) { using (Graphics g = Graphics.FromImage(dcBmp)) { IntPtr hdc = g.GetHdc(); lib.SetRenderScale(scale); lib.RenderPageToDC(outputDPI, page, hdc); g.ReleaseHdc(hdc); } // dcBmp.Save("page" + page.ToString() + ".bmp"); } } |
|
![]() |
|
Post Reply
|
| Forum Jump | Forum Permissions ![]() 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 |
Copyright © 2013 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store