Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 从pdf和word转换为图像_Jquery_Html_Asp.net Mvc - Fatal编程技术网

Jquery 从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

要求是显示所有文档的缩略图,如pdf和ms Word,我们将文档存储在数据库中,我们需要将其转换为文件流,并显示为缩略图图像

现在我能够显示图像,因为它是直接的,同样地,我必须显示pdf和word文档的图像。 我将展示我是如何做的图像

控制器:

 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;
?>