C# 在调用Acrobat.dll使PDF文件转换为JPG文件后,JPG文件的分辨率缩小了

ziyi1010 2010-01-08 11:03:06
在使用Acrobat工具把PDF文件导出JPG文件时,生成的JPG文件的大小为:6924 x 5351;
但是使用C#调用Acrobat.dll生成的JPG文件大小只有2493 x 1926;
代码如下:
pdfPage = (Acrobat.CAcroPDPage)ddd.AcquirePage(i);
pdfPoint = (Acrobat.CAcroPoint)pdfPage.GetSize();
pdfRect = (Acrobat.CAcroRect)Microsoft.VisualBasic.Interaction.CreateObject("AcroExch.Rect", "");
pdfRect.Left = 0;
pdfRect.right =pdfPoint.x;
pdfRect.Top = 0;
pdfRect.bottom = pdfPoint.y;
其中x和y根本就不是PDF文件的真实大小;
请高手解答如何获取PDF真实大小???
...全文
1047 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
劼哥stone 2012-02-13
  • 打赏
  • 举报
回复
你可以把一下参数按比例放大,得到的图片也全部都放大了,但是如何得到原来的分辨率这个还真不知道。
imgWidth
imgHeight
pdfPage.CopyToClipboard(pdfRect, 0, 0, 100)



int imgWidth = pdfPoint.x * (int)definition;
int imgHeight = pdfPoint.y * (int)definition;

pdfRect.Left = 0;
pdfRect.right = (short)imgWidth;
pdfRect.Top = 0;
pdfRect.bottom = (short)imgHeight;

// Render to clipboard, scaled by 100 percent (ie. original size)
// Even though we want a smaller image, better for us to scale in .NET
// than Acrobat as it would greek out small text
pdfPage.CopyToClipboard(pdfRect, 0, 0, (short)(100 * (int)definition));

IDataObject clipboardData = Clipboard.GetDataObject();

if (clipboardData.GetDataPresent(DataFormats.Bitmap))
{
Bitmap pdfBitmap = (Bitmap)clipboardData.GetData(DataFormats.Bitmap);
pdfBitmap.Save(imageOutputPath + imageName + i.ToString() + "." + imageFormat.ToString(), imageFormat);
pdfBitmap.Dispose();
}
程序海哥 2010-05-10
  • 打赏
  • 举报
回复
Acrobat工具功能做得很好了。直接用不就行了,为何要重写一个?
xu520tao 2010-05-10
  • 打赏
  • 举报
回复
我想学学怎么把PDF转JPG,楼主加我QQ:281468598
xu520tao 2010-05-10
  • 打赏
  • 举报
回复
密切关注中,。。。
不知道楼主解决了吗
ziyi1010 2010-01-08
  • 打赏
  • 举报
回复
自己顶起来
ziyi1010 2010-01-08
  • 打赏
  • 举报
回复
自己顶起来
ziyi1010 2010-01-08
  • 打赏
  • 举报
回复
自己顶起来

110,570

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧