1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2025-07-17 06:09:50 +02:00

allow download pdf file

This commit is contained in:
Xuan Sang LE
2018-09-11 10:35:02 +02:00
parent 9d8e0916a2
commit 4710f183e1
8 changed files with 96 additions and 1 deletions

View File

@ -50,3 +50,17 @@ end
function IndexController:actionnotfound(...)
return self:notoc(table.unpack({...}))
end
function IndexController:pdf(...)
local tmp_file = "/tmp/lxsang_cv.pdf"
local cmd = "wkhtmltopdf "..HTTP_ROOT.."/index/notoc "..tmp_file
local r = os.execute(cmd)
if r then
local mime = std.mimeOf(tmp_file)
std.header(mime)
std.fb(tmp_file)
return false
else
return self:error("Sorry.Problem generate PDF file")
end
end

View File

@ -29,6 +29,17 @@
flex-direction: row-reverse;
/*color: #414339;*/
}
.layoutprint{
max-width:960px;
font-family: "Ubuntu";
text-align: justify;
margin:0 auto;
display: flex;
flex-direction: row-reverse;
color: #414339;
}
h1 {
font-size: 25px;
text-align: center;

View File

@ -4,10 +4,24 @@
<script type="text/javascript" src="<?=HTTP_ROOT?>/rst/gscripts/showdown.min.js"></script>
<link rel="stylesheet" type="text/css" href="<?=HTTP_ROOT?>/style.css" />
<link rel="stylesheet" type="text/css" href="<?=HTTP_ROOT?>/rst/font-awesome.css" />
<?lua
if not toc then
?>
<link rel="stylesheet" type="text/css" href="<?=HTTP_ROOT?>/rst/ubuntu-regular.css" />
<?lua
end
?>
<title>Porfolio</title>
</head>
<body>
<div class="layout">
<?lua
local classname = "layout"
if not toc then
classname = "layoutprint"
if user then user:set("preview", true) end
end
?>
<div class="<?=classname?>">
<div class = "cv-content">
<?lua
if user then

View File

@ -11,6 +11,14 @@
<span class="text"><?=data.email?></span>
<span class="fa fa-globe"></span>
<span class="text"><a href ="<?=data.url?>"><?=data.url?></a></span>
<?lua
if not preview then
?>
<span class="fa fa-file-pdf-o"></span>
<span class="text"><a href ="<?=HTTP_ROOT?>/index/pdf">Download</a></span>
<?lua
end
?>
</p>
<p class="shortbio">
<span class="fa fa-quote-left"></span>