summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2021-03-28 09:38:01 -0400
committerJan Holesovsky <kendy@collabora.com>2021-03-31 10:59:11 +0200
commit860ea6c6693608165cfde42656d6c48c3bde91eb (patch)
tree1d6a7ca16b7372640adb433eac8395d7a5fb9b79
parent9180416ee296acad5bcd482569c6c53ecfff5b20 (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/+/113255 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Jan Holesovsky <kendy@collabora.com>
-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 2fb7a11bb681..e4af2a0e865b 100644
--- a/vcl/source/filter/ipdf/pdfread.cxx
+++ b/vcl/source/filter/ipdf/pdfread.cxx
@@ -146,11 +146,27 @@ VectorGraphicDataArray createVectorGraphicDataArray(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<Bitmap>& rBitmaps,
const size_t nFirstPage, int nPages, const basegfx::B2DTuple* pSizeHint)
{
#if HAVE_FEATURE_PDFIUM
- const double fResolutionDPI = 96;
+ static const double fResolutionDPI = getDefaultPdfResolutionDpi();
auto pPdfium = vcl::pdf::PDFiumLibrary::get();
// Load the buffer using pdfium.