生成HTML格式的PDF文件的缩略图 [英] Generate a thumbnail of PDF file in HTML

查看:705
本文介绍了生成HTML格式的PDF文件的缩略图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要生成HTML格式的PDF文件的缩略图.现在我使用:

I need to generate a thumbnail of PDF file in HTML. Now I use:

<embed width="100%" height="100%" name="plugin" src="http://localhost:54149/Documento/VersaoView?chave=FDC4875EE17FB17B" type="application/pdf">

如何设置此PDF的大小(191x207px)?

How can I set the size(191x207px) on this PDF?

推荐答案

您可以将"width"和"height"参数更改为所需的值:

You can just change those "width" and "height" parameters to values you want:

<embed width="191" height="207" name="plugin" src="http://localhost:54149/Documento/VersaoView?chave=FDC4875EE17FB17B" type="application/pdf">

width="191"告诉浏览器将宽度设置为191像素.

width="191" tells browser to set width to 191 pixels.

此方法虽然会加载整个pdf,而不只是缩略图. 为了自动生成缩略图,您可以按照以下说明使用PHP 如何转换PDF文档到PHP中的预览图像?

This method loads the whole pdf though, not just a thumbnail. For automatic thumbnails generation, you might use PHP as described here How do I convert a PDF document to a preview image in PHP?

或者您可以手动创建缩略图,然后将其作为带有pdf文件链接的图像添加到您的网站上:

Or you could just create a thumbnail image manually, and then add it on your website as an image with link to the pdf file:

<a href="http://example.com/mydocument.pdf">
    <img src="http://example.com/mydocument-thumbnail.jpg" />
</a>

这篇关于生成HTML格式的PDF文件的缩略图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆