python烧瓶应用程序未显示我在html文件中制作的pdf文件容器
我有一个带有以下代码的HTML文件,该文件显示网页上的嵌入PDF文件。在运行app.py时,网页显示良好,但未显示PDF。我也尝试将文件添加到静态文件夹中,但不起作用。有人可以在这里帮我吗?谢谢!
html 标记:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>display pdf on webpage</title>
<!--This will align our textboxes and labels-->
<style type="text/css">
label{
width: 100px;
display:inline-block;}>
.container{padding: 30px;}
</style>
<style>
body
{
background-image: url({{url_for('static',filename='bg_image.jpg')}});
background-attachment: fixed;
background-size: cover;
}
</style>
</head>
<body>
<!--Title-->
<h2 align="center">Title</h2>
<h3 align="center" style="position:relative; bottom:15px;">Please select your Data </h3>
<!--Label and input-->
<label style="position:relative; left:5px; bottom:15px;"> Data 1:</label>
<input name ="data1" type="text" style="position:relative; bottom:15px;">
<label style="position:relative; left:10px; bottom:15px;"> Data 2:</label>
<input name ="data 2" type="text" style="position:relative; bottom:15px;">
<label style="position:relative; left:10px; bottom:15px;"> date:</label>
<input name ="date" type="date" style="position:relative; bottom:15px;">
<!--Buttons:-->
<input style="position:relative; bottom:15px; left:20px;" type="submit" value="Generate"/>
<input style="position:relative; bottom:15px; left:20px;" type="reset" value="reset" />
<p></p>
<!--pdf container-->
<div
class = "container" style="position:relative; bottom:20px">
<embed src = "\location\filename.pdf" type="application/pdf" width = "100%" height = "590px" />
</div>
</body>
</html>
app.py :
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route("/", methods=["GET", "POST"])
def main():
return render_template("html_code.html")
if __name__ == '__main__':
app.run(debug=True)
I have a html file with below code which is displays an embed pdf file on webpage. while running the app.py, webpage is displaying just fine but pdf is not displayed. I tried adding file to static folder as well but didn't work. can someone help me out here? Thanks!
HTML markup:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>display pdf on webpage</title>
<!--This will align our textboxes and labels-->
<style type="text/css">
label{
width: 100px;
display:inline-block;}>
.container{padding: 30px;}
</style>
<style>
body
{
background-image: url({{url_for('static',filename='bg_image.jpg')}});
background-attachment: fixed;
background-size: cover;
}
</style>
</head>
<body>
<!--Title-->
<h2 align="center">Title</h2>
<h3 align="center" style="position:relative; bottom:15px;">Please select your Data </h3>
<!--Label and input-->
<label style="position:relative; left:5px; bottom:15px;"> Data 1:</label>
<input name ="data1" type="text" style="position:relative; bottom:15px;">
<label style="position:relative; left:10px; bottom:15px;"> Data 2:</label>
<input name ="data 2" type="text" style="position:relative; bottom:15px;">
<label style="position:relative; left:10px; bottom:15px;"> date:</label>
<input name ="date" type="date" style="position:relative; bottom:15px;">
<!--Buttons:-->
<input style="position:relative; bottom:15px; left:20px;" type="submit" value="Generate"/>
<input style="position:relative; bottom:15px; left:20px;" type="reset" value="reset" />
<p></p>
<!--pdf container-->
<div
class = "container" style="position:relative; bottom:20px">
<embed src = "\location\filename.pdf" type="application/pdf" width = "100%" height = "590px" />
</div>
</body>
</html>
app.py:
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route("/", methods=["GET", "POST"])
def main():
return render_template("html_code.html")
if __name__ == '__main__':
app.run(debug=True)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论