Skip to content

Commit f7d77d6

Browse files
Merge pull request #3 from CoreFiling/feature/support-jpeg2000
Add build step with necessary patches for pdf2htmlEX
2 parents a30d417 + ae7d2a0 commit f7d77d6

8 files changed

Lines changed: 79 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
## develop
44

55
* Increase `font-size-multiplier` to increase text rendering fidelity and get rid of sporadic empty spaces at the end of numbers.
6+
* Patch and build `pdf2htmlEX` as part of this build process to use `libopenjp` instead of `libjpeg` for JPEG-2000 support.
7+
* All patches are in this source tree, and are applied to directly to the source of the upstream tag during build.
68

79
## 0.1.0
810

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ This project is a lightweight HTTP(S) interface to the [pdf2htmlex library](http
66

77
Since pdf2htmlex is licensed under the GPL, this project is too (see the LICENSE.TXT file).
88

9-
As you can see from the build process, pdf2htmlEX itself is not modified by this project and as such we have not repeated pdf2htmlEX's source code here; you can find it via the link above.
9+
As you can see from the build process, pdf2htmlEX itself is patched by the patches within this project (see [src/Pdf2Html/patches](tree/src/Pdf2Html/patches)), based on a clone of the upstream project tag we are targeting. As such we have not repeated pdf2htmlEX's source code here; you can find it via the link above.

src/Pdf2Html/Dockerfile

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,40 @@
11
# syntax=docker/dockerfile:1
2+
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build-pdf2htmlex
3+
4+
# Produces a patched pdf2htmlEX using libopenjp 2.7 instead of libjpeg to get JPEG2000 support.
5+
6+
ENV PDF2HTMLEX_BRANCH=cfl1
7+
ENV UNATTENDED="--assume-yes"
8+
ENV MAKE_PARALLEL="-j 4"
9+
ENV PDF2HTMLEX_PREFIX=/usr/local
10+
ENV DEBIAN_FRONTEND=noninteractive
11+
12+
WORKDIR /source
13+
RUN apt update && apt install -y git patch sudo
14+
RUN git clone --depth=1 --branch v0.18.8.rc1 https://github.com/pdf2htmlEX/pdf2htmlEX
15+
WORKDIR /source/pdf2htmlEX
16+
17+
COPY ./pdf2htmlEX/patches ./patches
18+
RUN patch ./buildScripts/versionEnvs ./patches/versionEnvs.patch
19+
RUN patch ./buildScripts/buildPoppler ./patches/buildPoppler.patch
20+
RUN patch ./buildScripts/getBuildToolsApt ./patches/getBuildToolsApt.patch
21+
RUN patch ./buildScripts/getDevLibrariesApt ./patches/getDevLibrariesApt.patch
22+
RUN patch ./pdf2htmlEX/CMakeLists.txt ./patches/CMakeLists.patch
23+
24+
RUN ./buildScripts/versionEnvs
25+
RUN ./buildScripts/reportEnvs
26+
RUN ./buildScripts/getBuildToolsApt
27+
RUN ./buildScripts/getDevLibrariesApt
28+
RUN ./buildScripts/getPoppler
29+
RUN ./buildScripts/buildPoppler
30+
RUN ./buildScripts/getFontforge
31+
RUN ./buildScripts/buildFontforge
32+
RUN ./buildScripts/buildPdf2htmlEX
33+
RUN ./buildScripts/installPdf2htmlEX
34+
RUN git config user.name "CoreFiling"
35+
RUN git config user.email "opensource@corefiling.com"
36+
RUN ./buildScripts/createDebianPackage
37+
238
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
339
WORKDIR /source
440
COPY ./ .
@@ -8,8 +44,8 @@ FROM mcr.microsoft.com/dotnet/aspnet:7.0
844
RUN apt update && apt install -y wget
945
RUN wget http://archive.ubuntu.com/ubuntu/pool/main/libj/libjpeg-turbo/libjpeg-turbo8_2.0.3-0ubuntu1_amd64.deb
1046
RUN apt install -y ./libjpeg-turbo8_2.0.3-0ubuntu1_amd64.deb
11-
RUN wget https://github.com/pdf2htmlEX/pdf2htmlEX/releases/download/v0.18.8.rc1/pdf2htmlEX-0.18.8.rc1-master-20200630-Ubuntu-bionic-x86_64.deb
12-
RUN apt install -y ./pdf2htmlEX-0.18.8.rc1-master-20200630-Ubuntu-bionic-x86_64.deb
47+
COPY --from=build-pdf2htmlex /source/pdf2htmlEX/imageBuild/*.deb /pdf2htmlEX/
48+
RUN apt install -y libjpeg62 libopenjp2-7 /pdf2htmlEX/pdf2htmlEX-0.18.8.rc1-cfl1-*-x86_64.deb
1349

1450
WORKDIR /app
1551
COPY --from=build /app ./
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@@ -97,6 +97,7 @@
2+
${LIB_INTL_LIBRARIES}
3+
${CAIRO_LIBRARIES}
4+
-ljpeg
5+
+ -lopenjp2
6+
-lpng
7+
-lfontconfig
8+
-lfreetype
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@@ -27,7 +27,7 @@
2+
-DENABLE_GOBJECT_INTROSPECTION=OFF \
3+
-DENABLE_GTK_DOC=OFF \
4+
-DENABLE_QT5=OFF \
5+
- -DENABLE_LIBOPENJPEG="none" \
6+
+ -DENABLE_LIBOPENJPEG="openjpeg2" \
7+
-DENABLE_CMS="none" \
8+
-DENABLE_DCTDECODER="libjpeg" \
9+
-DENABLE_LIBCURL=OFF \
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@@ -30,6 +30,6 @@ sudo apt-get $UNATTENDED install \
2+
dpkg \
3+
dpkg-dev \
4+
gettext \
5+
- openjdk-8-jre-headless \
6+
+ openjdk-11-jre-headless \
7+
jq
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@@ -21,3 +21,4 @@
2+
libpng-dev \
3+
libjpeg-dev \
4+
libxml2-dev \
5+
+ libopenjp2-7-dev \
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@@ -6,7 +6,7 @@
2+
# see: https://poppler.freedesktop.org/releases.html
3+
# current working: 0.89.0
4+
5+
-export PDF2HTMLEX_VERSION=0.18.8.rc2
6+
+export PDF2HTMLEX_VERSION=0.18.8.rc1
7+
8+
export POPPLER_VERSION=poppler-0.89.0
9+
#export POPPLER_VERSION=poppler-0.88.0

0 commit comments

Comments
 (0)