From 93579b96256558ec92410f438946683442308bb0 Mon Sep 17 00:00:00 2001 From: Minho Date: Thu, 11 May 2017 16:05:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9Linux=E4=B8=8B=E7=94=9F?= =?UTF-8?q?=E6=88=90pdf=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/document.go | 2 +- docs/wkhtmltopdf.md | 6 ++++++ utils/pdf_linux.go | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 docs/wkhtmltopdf.md diff --git a/controllers/document.go b/controllers/document.go index 8473659c..c811aa68 100644 --- a/controllers/document.go +++ b/controllers/document.go @@ -610,7 +610,7 @@ func (c *DocumentController) Export() { RecursiveFun(0, "", dpath, c, book, docs, pathList) - defer os.RemoveAll(dpath) + //defer os.RemoveAll(dpath) os.MkdirAll("./cache", 0766) pdfpath := "cache/" + identify + ".pdf" diff --git a/docs/wkhtmltopdf.md b/docs/wkhtmltopdf.md new file mode 100644 index 00000000..55c93f5f --- /dev/null +++ b/docs/wkhtmltopdf.md @@ -0,0 +1,6 @@ +## wkhtmltopdf 安装 + +```bash +apt-get install -y libxrender-dev +apt-get install -y libxext-dev +``` \ No newline at end of file diff --git a/utils/pdf_linux.go b/utils/pdf_linux.go index 00228b6a..e3ac701e 100644 --- a/utils/pdf_linux.go +++ b/utils/pdf_linux.go @@ -19,7 +19,7 @@ func ConverterHtmlToPdf(uri []string,path string) (error) { if exe == "" { return errors.New("wkhtmltopdf not exist.") } - params := []string{"/C",exe,"--margin-bottom","25"} + params := []string{"-c",exe,"--margin-bottom","25"} params = append(params,uri...) params = append(params,path)