summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2021-03-28 09:38:01 -0400
committerAndras Timar <andras.timar@collabora.com>2021-04-10 23:22:35 +0200
commit2a44f2e9b4b139b6f5cc7b9a283cb11a5641a10d (patch)
treef5994724362bd1a338349a806a38bdbe06b2ef18 /vcl
parentcdab3bec73a0a5137b8d102f5781f88231721db3 (diff)
vcl: allow for overriding the default PDF rendering resolution
Change-Id: Ibd75c6dd71d93322bd77995547e735c2d4849602 Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113223 Tested-by: Jenkins Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/filter/ipdf/pdfread.cxx18
1 files changed, 17 insertions, 1 deletions
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)
{