From c6986eeaf674f76a20cd0ca4f90b3af0628ae2af Mon Sep 17 00:00:00 2001 From: Le Tan Date: Fri, 23 Jun 2017 19:52:36 +0800 Subject: [PATCH] bug-fix: always constrain the image width when exporting PDF Otherwise, the exported PDF will have just part of the large image. --- src/vnote.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/vnote.cpp b/src/vnote.cpp index 4f115e15..bb658399 100644 --- a/src/vnote.cpp +++ b/src/vnote.cpp @@ -194,6 +194,12 @@ void VNote::updateTemplate() // Shoudl not display scrollbar in PDF. cssStyle += "pre code { white-space: pre-wrap !important; " "word-break: break-all !important; }\n"; + if (!vconfig.getEnableImageConstraint()) { + // Constain the image width by force in PDF, otherwise, the PDF will + // be cut off. + cssStyle += "img { max-width: 100% !important; height: auto !important; }\n"; + } + s_markdownTemplatePDF.replace(styleHolder, cssStyle); }