Browse Source

bug-fix: always constrain the image width when exporting PDF

Otherwise, the exported PDF will have just part of the large image.
Le Tan 8 years ago
parent
commit
c6986eeaf6
1 changed files with 6 additions and 0 deletions
  1. 6 0
      src/vnote.cpp

+ 6 - 0
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);
 }