vcl/source/filter/ipdf/pdfread.cxx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
New commits: commit fc793fef7b81f47aab80fd6f1f128780a7a22aa5 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Sun Mar 28 09:38:01 2021 -0400 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Sat Apr 10 00:05:24 2021 +0200 vcl: allow for overriding the default PDF rendering resolution Change-Id: Ibd75c6dd71d93322bd77995547e735c2d4849602 Signed-off-by: Ashod Nakashian <ashod.nakash...@collabora.co.uk> diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx index 80f207a68196..715333b2d561 100644 --- a/vcl/source/filter/ipdf/pdfread.cxx +++ b/vcl/source/filter/ipdf/pdfread.cxx @@ -132,11 +132,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<BitmapEx>& 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. _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits