Jquery 从pdf和word转换为图像
要求是显示所有文档的缩略图,如pdf和ms Word,我们将文档存储在数据库中,我们需要将其转换为文件流,并显示为缩略图图像 现在我能够显示图像,因为它是直接的,同样地,我必须显示pdf和word文档的图像。 我将展示我是如何做的图像 控制器:Jquery 从pdf和word转换为图像,jquery,html,asp.net-mvc,Jquery,Html,Asp.net Mvc,要求是显示所有文档的缩略图,如pdf和ms Word,我们将文档存储在数据库中,我们需要将其转换为文件流,并显示为缩略图图像 现在我能够显示图像,因为它是直接的,同样地,我必须显示pdf和word文档的图像。 我将展示我是如何做的图像 控制器: public ActionResult File(int id) { var fileToRetrieve = db.File.Find(id); return File(fileToRetrieve.Content, fil
public ActionResult File(int id)
{
var fileToRetrieve = db.File.Find(id);
return File(fileToRetrieve.Content, fileToRetrieve.ContentType);
}
视图:
@foreach(模型中的变量项)
{
}
您需要ImageMagick和GhostScript
<?php
$im = new imagick('file.pdf[0]');
$im->setImageFormat('jpg');
header('Content-Type: image/jpeg');
echo $im;
?>
[0]表示第1页。请发布您尝试过的内容。您正在询问如何打印/呈现文档或从支持它的文档生成缩略图。你发布的代码与此无关。你试过什么吗?你有没有试过用谷歌搜索一下如何生成缩略图,或者打印图像?
<?php
$im = new imagick('file.pdf[0]');
$im->setImageFormat('jpg');
header('Content-Type: image/jpeg');
echo $im;
?>