wkhtmltopdf configuration
This commit is contained in:
@ -73,15 +73,9 @@ func (c AdminSetting) DoDemo(demoUsername, demoPassword string) revel.Result {
|
|||||||
return c.RenderJson(re)
|
return c.RenderJson(re)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToImage
|
func (c AdminSetting) ExportPdf(path string) revel.Result {
|
||||||
// 长微博的bin路径phantomJs
|
|
||||||
func (c AdminSetting) ToImage() revel.Result {
|
|
||||||
c.RenderArgs["toImageBinPath"] = configService.GetGlobalStringConfig("toImageBinPath")
|
|
||||||
return c.RenderTemplate("admin/setting/toImage.html");
|
|
||||||
}
|
|
||||||
func (c AdminSetting) DoToImage(toImageBinPath string) revel.Result {
|
|
||||||
re := info.NewRe()
|
re := info.NewRe()
|
||||||
re.Ok = configService.UpdateGlobalStringConfig(c.GetUserId(), "toImageBinPath", toImageBinPath)
|
re.Ok = configService.UpdateGlobalStringConfig(c.GetUserId(), "exportPdfBinPath", path)
|
||||||
return c.RenderJson(re)
|
return c.RenderJson(re)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,6 +585,7 @@ func (c ApiNote) GetHistories(noteId string) revel.Result {
|
|||||||
|
|
||||||
// 0.2 新增
|
// 0.2 新增
|
||||||
// 导出成PDF
|
// 导出成PDF
|
||||||
|
// test localhost:9000/api/note/exportPdf?noteId=554f07bf05fcd15fa9000000&token=562211dc99c37ba6a7000001
|
||||||
func (c ApiNote) ExportPdf(noteId string) revel.Result {
|
func (c ApiNote) ExportPdf(noteId string) revel.Result {
|
||||||
re := info.NewApiRe()
|
re := info.NewApiRe()
|
||||||
userId := c.getUserId()
|
userId := c.getUserId()
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
||||||
<li id="adminUserNav">
|
<li id="adminUserNav">
|
||||||
<a href="#">
|
<a href="#">
|
||||||
<i class="fa fa-users icon">
|
<i class="fa fa-users icon">
|
||||||
@ -157,7 +156,7 @@
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a href="/admin/t?t=setting/shareNote">
|
<a href="/admin/t?t=setting/share_note">
|
||||||
<span>
|
<span>
|
||||||
Register Share Note
|
Register Share Note
|
||||||
</span>
|
</span>
|
||||||
@ -171,6 +170,15 @@
|
|||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="/admin/t?t=setting/export_pdf">
|
||||||
|
<span>
|
||||||
|
Export PDF
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
52
app/views/admin/setting/export_pdf.html
Normal file
52
app/views/admin/setting/export_pdf.html
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
{{template "admin/top.html" .}}
|
||||||
|
<div class="m-b-md"> <h3 class="m-b-none">Export PDF</h3></div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<form id="add_user_form">
|
||||||
|
<section class="panel panel-default">
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Wkhtmltopdf Binary Path</label>
|
||||||
|
<input type="text" class="form-control" placeholder="/usr/local/bin/wkhtmltopdf" name="path" value="{{.str.exportPdfBinPath}}">
|
||||||
|
Leanote use <a target="_blank" href="https://sourceforge.net/projects/wkhtmltopdf/">wkhtmltopdf</a> to export pdf. You should install it on your server.
|
||||||
|
<br />
|
||||||
|
Please input the path that wkhtmltopdf installed, e.g. <code>/usr/local/bin/wkhtmltopdf</code>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<footer class="panel-footer text-right bg-light lter">
|
||||||
|
<button type="submit" id="submit" class="btn btn-success btn-s-xs">Submit</button>
|
||||||
|
</footer>
|
||||||
|
</section>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{template "admin/footer.html" .}}
|
||||||
|
<script src="/public/admin/js/jquery-validation-1.13.0/jquery.validate.js"></script>
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
init_validator("#add_user_form");
|
||||||
|
|
||||||
|
$("#submit").click(function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
var t = this;
|
||||||
|
if($("#add_user_form").valid()) {
|
||||||
|
$(t).button('loading');
|
||||||
|
ajaxPost("/adminSetting/exportPdf", getFormJsonData("add_user_form"), function(ret){
|
||||||
|
$(t).button('reset')
|
||||||
|
if(!ret.Ok) {
|
||||||
|
art.alert(ret.Msg)
|
||||||
|
} else {
|
||||||
|
art.tips("Success");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{{template "admin/end.html" .}}
|
@ -907,7 +907,7 @@ body {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
a {
|
a {
|
||||||
color: #2e3e4e;
|
color: #346EA9;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
a:hover,
|
a:hover,
|
||||||
|
@ -1088,7 +1088,7 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: #2e3e4e;
|
color: #346EA9;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user