我正在尝试从'document.HTML'页面中显示PDF页面
文件结构是
1.Client2->目录->静态->目录->我的CSS文件等
pdf的引用为src .. {images / .. pdf}等
文档HTML页面
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
{% load static %}
</head>
<body>
<!-- Type is pdf and is located in the documents.html directory aka (catalog) but within a sub-folder 'images'-->
<embed type="application/pdf"
src="images/Logs_Guide.pdf"
width="250"
height="200">
<embed type="application/pdf"
src="images/AD_Guide.pdf"
width="250"
height="200">
<img src="images/ER_Diagram.jpg">
</body>
</html>
但是,当我在Django前端中尝试并单击获得的pdf时
"GET /catalog/documents/images/Logs_Guide.pdf HTTP/1.1" 404 3366
但是,存储PDf文件的图像文件夹位于在模板/目录/图像
所以我需要在static / catalog / images中移动此文件夹,然后然后可以将源更改为:
<embed type="application/pdf"
src="{% static 'catalog/images/Logs_Guide.pdf'%}"
width="250"
height="200">
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
{% load static %}
</head>
<body>
<!-- Type is pdf and is located in the documents.html directory aka (catalog) but within a sub-folder 'images'-->
<embed type="application/pdf"
src="images/Logs_Guide.pdf"
width="250"
height="200">
<embed type="application/pdf"
src="images/AD_Guide.pdf"
width="250"
height="200">
<img src="images/ER_Diagram.jpg">
</body>
</html>