[Libreoffice-commits] core.git: vcl/source
Ashod Nakashian (via logerrit)
logerrit at kemper.freedesktop.org
Sat Apr 10 21:23:19 UTC 2021
vcl/source/filter/ipdf/pdfread.cxx | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
New commits:
commit 2a44f2e9b4b139b6f5cc7b9a283cb11a5641a10d
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun Mar 28 09:38:01 2021 -0400
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Apr 10 23:22:35 2021 +0200
vcl: allow for overriding the default PDF rendering resolution
Change-Id: Ibd75c6dd71d93322bd77995547e735c2d4849602
Signed-off-by: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113223
Tested-by: Jenkins
Reviewed-by: Andras Timar <andras.timar at collabora.com>
diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx
index 9cdb10070ef6..be9738a9f32f 100644
--- a/vcl/source/filter/ipdf/pdfread.cxx
+++ b/vcl/source/filter/ipdf/pdfread.cxx
@@ -116,10 +116,26 @@ BinaryDataContainer createBinaryDataContainer(SvStream& rStream)
namespace vcl
{
+/// Get the default PDF rendering resolution in DPI.
+static double getDefaultPdfResolutionDpi()
+{
+ // If an overriding default is set, use it.
+ const char* envar = ::getenv("PDFIMPORT_RESOLUTION_DPI");
+ if (envar)
+ {
+ const double dpi = atof(envar);
+ if (dpi > 0)
+ return dpi;
+ }
+
+ // Fallback to a sensible default.
+ return 96.;
+}
+
size_t RenderPDFBitmaps(const void* pBuffer, int nSize, std::vector<BitmapEx>& rBitmaps,
const size_t nFirstPage, int nPages, const basegfx::B2DTuple* pSizeHint)
{
- const double fResolutionDPI = 96;
+ static const double fResolutionDPI = getDefaultPdfResolutionDpi();
auto pPdfium = vcl::pdf::PDFiumLibrary::get();
if (!pPdfium)
{
More information about the Libreoffice-commits
mailing list