显示PDF [英] Displaying PDFs
问题描述
目前我有代码显示PNG图像和来自链接到每个图像的数据库的注释。我意识到,我还需要这样做的PDF文件。
如何编辑当前代码以显示PDF文档而不是PNG图片?
非常感谢。
感谢,
<!DOCTYPE html&
< html>
< head>
< meta http-equiv =Content-Typecontent =text / html; charset = iso-8859-1>
< title>无标题文档< / title>
< cfquery datasource =AccessTestname =qTest>
SELECT P.Account,P.Image,P.Image_ID,C.Remarks,C.Users,C.Accounts,C.Date_Time
FROM PictureDB AS P
INNER JOIN CommentsDB AS C
ON C.Image_ID = P.Image_ID
ORDER BY P.Image_ID
< / cfquery>
< script src =http://code.jquery.com/jquery-2.0.3.js>
< / script>
< script>
$(document).ready(function(){
var images = {
< cfoutput query =qTestgroup =Image_ID>
#qTest。 Image_ID#:{
image:#qTest.Image#,
remarks:[
< cfoutput>
#qTest.Users#,# qTest.Date_Time#< br>#qTest.Remarks#< br>< / br>,
< / cfoutput>
]
},
& / cfoutput>
};
$(button)click(function(event){
event.preventDefault();
var id = $(this).data (id);
var src = images [id] .image;
var desc = images [id] .remarks.toString();
$ theImage)。attr(src,src).removeClass(hide);
$(#theDescription)。html(desc).removeClass(hide);
} ;
});
< / script>
< / head>
< body>
< cfoutput query =qTestgroup =Account>
< button data-id =#qTest.Image_ID#>
< table width =230>#qTest.Account#< / table>
< / button>
< / cfoutput>
< img id =theImageclass =hide>
< div id =theDescriptionclass =hide>
< / div>
< / body>
< / html>
由于没有简单的方法来显示pdf以类似于图像的方式,您可以考虑以下内容:
- 使用
cfpdf action =thumbnail code>到将PDF转换为一系列图片。 li>
- 然后,将给定pdf的图片加载到
- 然后,将给定pdf的图片加载到
p>使用轮播包含并显示'pdf'的页面将给您类似于显示单个图像以供审核的结果,并且可能会让您保留对您的页面类似的外观和感觉。
Currently I have code that displays PNG images and comments from a database linked to each Image. I realized that I will also need to do this for PDF files.
How would I edit the current code to display PDF documents instead of PNG Images?
Any help would be much appreciated.
Thanks,
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<cfquery datasource="AccessTest" name="qTest">
SELECT P.Account, P.Image, P.Image_ID, C.Remarks, C.Users, C.Accounts, C.Date_Time
FROM PictureDB AS P
INNER JOIN CommentsDB AS C
ON C.Image_ID = P.Image_ID
ORDER BY P.Image_ID
</cfquery>
<script src="http://code.jquery.com/jquery-2.0.3.js">
</script>
<script>
$(document).ready(function(){
var images = {
<cfoutput query="qTest" group="Image_ID">
"#qTest.Image_ID#": {
"image": "#qTest.Image#",
"remarks": [
<cfoutput>
"#qTest.Users#, #qTest.Date_Time# <br> #qTest.Remarks# <br> </br>",
</cfoutput>
]
},
</cfoutput>
};
$("button").click(function(event){
event.preventDefault();
var id = $(this).data("id");
var src = images[id].image;
var desc = images[id].remarks.toString();
$("#theImage").attr("src", src).removeClass("hide");
$("#theDescription").html(desc).removeClass("hide");
});
});
</script>
</head>
<body>
<cfoutput query="qTest" group="Account">
<button data-id="#qTest.Image_ID#">
<table width="230">#qTest.Account# </table>
</button>
</cfoutput>
<img id="theImage" class="hide">
<div id="theDescription" class="hide">
</div>
</body>
</html>
Given that there is no straightforward way to display pdfs inline in a similar manner to images, you could consider the following:
- Use
cfpdf action = "thumbnail"
to convert the pdf to a series of images. - Then, load the images for a given pdf in a jquery carousel to make them available to review.
Using a carousel to contain and display the pages of the 'pdf' would give you a result similar to when you display a single image for review and would probably let you retain a similar look and feel to your page.
这篇关于显示PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!