Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
Render at high DPI with max width |
Post Reply |
Author | |
Rowan
Moderator Group Joined: 10 Jan 09 Status: Offline Points: 398 |
Post Options
Thanks(0)
Posted: 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 | |
Tweet
|
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 © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store