Skip to content

Commit

Permalink
Merge pull request OSGeo#10634 from rouault/pdfium_6677
Browse files Browse the repository at this point in the history
PDF: update to PDFium 6677
  • Loading branch information
rouault authored Aug 29, 2024
2 parents d1efd4e + 5ba7acc commit a220d4a
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 41 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/cmake_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ jobs:
- name: Install pdfium
run: |
wget -q https://github.com/rouault/pdfium_build_gdal_3_9/releases/download/pdfium_6309_v1/install-ubuntu2004-rev6309.tar.gz \
&& tar -xzf install-ubuntu2004-rev6309.tar.gz \
wget -q https://github.com/rouault/pdfium_build_gdal_3_10/releases/download/pdfium_6677_v1/install-ubuntu2004-rev6677.tar.gz \
&& tar -xzf install-ubuntu2004-rev6677.tar.gz \
&& sudo chown -R root:root install \
&& sudo mv install/lib/* /usr/lib/ \
&& sudo mv install/include/* /usr/include/ \
&& sudo rm -rf install-ubuntu2004-rev6309.tar.gz install \
&& sudo rm -rf install-ubuntu2004-rev6677.tar.gz install \
&& sudo apt-get update -y \
&& sudo apt-get install -y --fix-missing --no-install-recommends liblcms2-dev
- name: Configure ccache
Expand Down Expand Up @@ -437,8 +437,8 @@ jobs:
- name: Install pdfium
shell: bash -l {0}
run: |
curl -LOs https://github.com/rouault/pdfium_build_gdal_3_9/releases/download/pdfium_6309_v1/install-win10-vs2019-x64-rev6309.zip
unzip install-win10-vs2019-x64-rev6309.zip
curl -LOs https://github.com/rouault/pdfium_build_gdal_3_10/releases/download/pdfium_6677_v1/install-win10-vs2019-x64-rev6677.zip
unzip install-win10-vs2019-x64-rev6677.zip
mv install install-pdfium
- name: Remove conflicting libraries
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ubuntu_20.04/Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,12 @@ RUN mkdir geos \
&& rm -rf geos

# Install pdfium
RUN wget -q https://github.com/rouault/pdfium_build_gdal_3_9/releases/download/pdfium_6309_v1/install-ubuntu2004-rev6309.tar.gz \
&& tar -xzf install-ubuntu2004-rev6309.tar.gz \
RUN wget -q https://github.com/rouault/pdfium_build_gdal_3_10/releases/download/pdfium_6677_v1/install-ubuntu2004-rev6677.tar.gz \
&& tar -xzf install-ubuntu2004-rev6677.tar.gz \
&& chown -R root:root install \
&& mv install/lib/* /usr/lib/ \
&& mv install/include/* /usr/include/ \
&& rm -rf install-ubuntu2004-rev6309.tar.gz install
&& rm -rf install-ubuntu2004-rev6677.tar.gz install

# HANA: client side
# Install hdbsql tool
Expand Down
10 changes: 8 additions & 2 deletions doc/source/drivers/raster/pdf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -728,8 +728,14 @@ Only GDAL builds against static builds of PDFium have been tested.
Building PDFium can be challenging, and particular builds must be used to
work properly with GDAL.

With GDAL >= 3.9
++++++++++++++++
With GDAL >= 3.10
+++++++++++++++++

The scripts in the `<https://github.com/rouault/pdfium_build_gdal_3_10>`__
repository must be used to build a patched version of PDFium.

With GDAL = 3.9
+++++++++++++++

The scripts in the `<https://github.com/rouault/pdfium_build_gdal_3_9>`__
repository must be used to build a patched version of PDFium.
Expand Down
8 changes: 4 additions & 4 deletions docker/ubuntu-full/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ RUN . /buildscripts/bh-set-envvars.sh \
&& cd .. \
&& rm -rf libOpenDRIVE-${OPENDRIVE_VERSION} \
); fi

#Build File Geodatabase

ARG WITH_FILEGDB=
Expand Down Expand Up @@ -221,12 +221,12 @@ RUN . /buildscripts/bh-set-envvars.sh \

ARG WITH_PDFIUM=yes
RUN if echo "$WITH_PDFIUM" | grep -Eiq "^(y(es)?|1|true)$" ; then ( \
wget -q https://github.com/rouault/pdfium_build_gdal_3_9/releases/download/pdfium_6309_v1/install-ubuntu2004-rev6309.tar.gz \
&& tar -xzf install-ubuntu2004-rev6309.tar.gz \
wget -q https://github.com/rouault/pdfium_build_gdal_3_10/releases/download/pdfium_6677_v1/install-ubuntu2004-rev6677.tar.gz \
&& tar -xzf install-ubuntu2004-rev6677.tar.gz \
&& chown -R root:root install \
&& mv install/lib/* /usr/lib/ \
&& mv install/include/* /usr/include/ \
&& rm -rf install-ubuntu2004-rev6309.tar.gz install \
&& rm -rf install-ubuntu2004-rev6677.tar.gz install \
&& apt-get update -y \
&& apt-get install -y --fix-missing --no-install-recommends liblcms2-dev${APT_ARCH_SUFFIX} \
&& rm -rf /var/lib/apt/lists/* \
Expand Down
49 changes: 24 additions & 25 deletions frmts/pdf/pdfdataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1559,18 +1559,18 @@ class GDALPDFiumRenderDeviceDriver : public RenderDeviceDriverIface
blend_typeL);
}

virtual bool GetClipBox(FX_RECT *pRect) override
virtual FX_RECT GetClipBox() const override
{
return m_poParent->GetClipBox(pRect);
return m_poParent->GetClipBox();
}

virtual bool GetDIBits(const RetainPtr<CFX_DIBitmap> &pBitmap, int left,
int top) override
virtual bool GetDIBits(RetainPtr<CFX_DIBitmap> bitmap, int left,
int top) const override
{
return m_poParent->GetDIBits(pBitmap, left, top);
return m_poParent->GetDIBits(bitmap, left, top);
}

virtual RetainPtr<CFX_DIBitmap> GetBackDrop() override
virtual RetainPtr<const CFX_DIBitmap> GetBackDrop() const override
{
return m_poParent->GetBackDrop();
}
Expand Down Expand Up @@ -1599,19 +1599,19 @@ class GDALPDFiumRenderDeviceDriver : public RenderDeviceDriverIface
pClipRect, options, blend_type);
}

virtual bool StartDIBits(RetainPtr<const CFX_DIBBase> bitmap, float alpha,
uint32_t color, const CFX_Matrix &matrix,
const FXDIB_ResampleOptions &options,
std::unique_ptr<CFX_ImageRenderer> *handle,
BlendMode blend_type) override
virtual StartResult StartDIBits(RetainPtr<const CFX_DIBBase> bitmap,
float alpha, uint32_t color,
const CFX_Matrix &matrix,
const FXDIB_ResampleOptions &options,
BlendMode blend_type) override
{
if (!bEnableBitmap && !bTemporaryEnableVectorForTextStroking)
return true;
return StartResult(Result::kSuccess, nullptr);
return m_poParent->StartDIBits(std::move(bitmap), alpha, color, matrix,
options, handle, blend_type);
options, blend_type);
}

virtual bool ContinueDIBits(CFX_ImageRenderer *handle,
virtual bool ContinueDIBits(CFX_AggImageRenderer *handle,
PauseIndicatorIface *pPause) override
{
return m_poParent->ContinueDIBits(handle, pPause);
Expand Down Expand Up @@ -1646,16 +1646,16 @@ class GDALPDFiumRenderDeviceDriver : public RenderDeviceDriverIface
return m_poParent->GetDriverType();
}

virtual bool DrawShading(const CPDF_ShadingPattern *pPattern,
const CFX_Matrix *pMatrix,
const FX_RECT &clip_rect, int alpha,
bool bAlphaMode) override
#if defined(_SKIA_SUPPORT_)
virtual bool DrawShading(const CPDF_ShadingPattern &pattern,
const CFX_Matrix &matrix, const FX_RECT &clip_rect,
int alpha) override
{
if (!bEnableBitmap && !bTemporaryEnableVectorForTextStroking)
return true;
return m_poParent->DrawShading(pPattern, pMatrix, clip_rect, alpha,
bAlphaMode);
return m_poParent->DrawShading(pattern, matrix, clip_rect, alpha);
}
#endif

bool MultiplyAlpha(float alpha) override
{
Expand Down Expand Up @@ -1696,10 +1696,10 @@ class GDALPDFiumRenderDeviceDriver : public RenderDeviceDriverIface
/* PDFiumRenderPageBitmap() */
/************************************************************************/

/* This method is a customization of FPDF_RenderPageBitmap()
from pdfium/fpdfsdk/fpdf_view.cpp to allow selection of which OGC/layer are
/* This method is a customization of RenderPageImpl()
from pdfium/fpdfsdk/cpdfsdk_renderpage.cpp to allow selection of which OGC/layer are
active. Thus it inherits the following license */
// Copyright 2014 PDFium Authors. All rights reserved.
// Copyright 2014-2020 PDFium Authors. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
Expand Down Expand Up @@ -1781,8 +1781,7 @@ static void myRenderPageImpl(PDFDataset *poDS, CPDF_PageRenderContext *pContext,

// TODO(https://crbug.com/pdfium/993) - maybe pass true here.
const bool bShowWidget = false;
pList->DisplayAnnots(pPage, pContext->m_pDevice.get(),
pContext->m_pContext.get(), bPrinting, matrix,
pList->DisplayAnnots(pContext->m_pContext.get(), bPrinting, matrix,
bShowWidget);
}

Expand Down
2 changes: 1 addition & 1 deletion frmts/pdf/pdfobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2456,7 +2456,7 @@ const std::string &GDALPDFObjectPdfium::GetString()
if (bs.IsEmpty())
return (osStr = "");
return (osStr = GDALPDFGetUTF8StringFromBytes(
static_cast<const GByte *>(bs.raw_str()),
reinterpret_cast<const GByte *>(bs.c_str()),
static_cast<int>(bs.GetLength())));
}
else
Expand Down
3 changes: 2 additions & 1 deletion frmts/pdf/pdfsdk_headers_pdfium.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@
#include "core/fxge/cfx_defaultrenderdevice.h"
#include "core/fxge/dib/cfx_dibitmap.h"
#include "core/fxge/cfx_renderdevice.h"
#include "core/fxge/agg/fx_agg_driver.h"
#include "core/fxge/agg/cfx_agg_devicedriver.h"
#include "core/fxge/agg/cfx_agg_imagerenderer.h"
#include "core/fxge/renderdevicedriver_iface.h"
#include "fpdfsdk/cpdfsdk_helpers.h"
#include "fpdfsdk/cpdfsdk_pauseadapter.h"
Expand Down

0 comments on commit a220d4a

Please sign in to comment.