【发布时间】:2017-03-09 20:26:24
【问题描述】:
我希望获得与使用 Adobe Acrobat 导出 pdf 到 png 相同的图像质量。
但不知何故,这对我不起作用。如果我在 Adobe Acrobat 工具的帮助下将 pdf 导出为 png,我得到的尺寸是: 宽度:11264 像素 高度:15940 像素
如您所见,我为您提供了用于阅读 pdf 并为每页创建一个图像的方法。我所拥有的可能性是使用需要 int page(index) float dpiX, float dpiY, bool forPrinting
的 .Render 方法但是有些如何它对保存的图像没有影响?
using (var document = PdfiumViewer.PdfDocument.Load(file))
{
//This int is used to get the page count for each document
int pagecount = document.PageCount;
//With the int pagecount we can create as may screenshots as there are pages in the document
for (int index = 0; index < pagecount; index++)
{
//render the image created
var image = document.Render(index,8448,11955, true);
//savde the created screenshot temporerlay as a png + number (count)
image.Save(@"C:\Users\chnikos\Desktop\Test\output" + index.ToString("000") + ".png",ImageFormat.Png);
application.Selection.InlineShapes.AddPicture(@"C:\Users\chnikos\Desktop\Test\output" + index.ToString("000") + ".png");
}
}
【问题讨论】: