Skip to content

Commit ebecb90

Browse files
author
Ethan Bishop
committed
Fix issue with conversion of complex backgrounds to PNGs
Improve version strings
1 parent 1d17b90 commit ebecb90

File tree

5 files changed

+29
-4
lines changed

5 files changed

+29
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.2.2
4+
5+
* Add patch to generate PNG background images of the correct size.
6+
37
## 0.2.1
48

59
* Process PDF annotations (e.g. stamps) by default.

src/Pdf2Html/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM ubuntu:noble AS build-pdf2htmlex
33

44
# Produces a patched pdf2htmlEX using libopenjp 2.7 instead of libjpeg to get JPEG2000 support.
55

6-
ENV PDF2HTMLEX_BRANCH=cfl1
6+
ENV PDF2HTMLEX_BRANCH=
77
ENV UNATTENDED="--assume-yes"
88
ENV MAKE_PARALLEL="-j 4"
99
ENV PDF2HTMLEX_PREFIX=/usr/local
@@ -19,6 +19,7 @@ RUN patch ./buildScripts/versionEnvs ./patches/versionEnvs.patch
1919
RUN patch ./buildScripts/buildPoppler ./patches/buildPoppler.patch
2020
RUN patch ./buildScripts/getBuildToolsApt ./patches/getBuildToolsApt.patch
2121
RUN patch ./buildScripts/getDevLibrariesApt ./patches/getDevLibrariesApt.patch
22+
RUN patch ./pdf2htmlEX/src/BackgroundRenderer/SplashBackgroundRenderer.cc ./patches/SplashBackgroundRenderer.cc.patch
2223
RUN patch ./pdf2htmlEX/src/util/unicode.cc ./patches/unicode.cc.patch
2324
RUN patch ./pdf2htmlEX/src/util/unicode.h ./patches/unicode.h.patch
2425
RUN patch ./pdf2htmlEX/CMakeLists.txt ./patches/CMakeLists.patch
@@ -49,7 +50,7 @@ RUN apt update && apt install -y wget
4950
RUN wget http://archive.ubuntu.com/ubuntu/pool/main/libj/libjpeg-turbo/libjpeg-turbo8_2.0.3-0ubuntu1_amd64.deb
5051
RUN apt install -y ./libjpeg-turbo8_2.0.3-0ubuntu1_amd64.deb
5152
COPY --from=build-pdf2htmlex /source/pdf2htmlEX/imageBuild/*.deb /pdf2htmlEX/
52-
RUN apt install -y libjpeg62 libopenjp2-7 /pdf2htmlEX/pdf2htmlEX-0.18.8.rc1-cfl1-*-x86_64.deb
53+
RUN apt install -y libjpeg62 libopenjp2-7 /pdf2htmlEX/pdf2htmlEX-0.18.8.rc1-cfl2-*-x86_64.deb
5354

5455
WORKDIR /app
5556
COPY --from=build /app ./

src/Pdf2Html/Pdf2Html.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFramework>net8.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
7-
<Version>0.2.0</Version>
7+
<Version>0.2.2</Version>
88
<AssemblyName>Pdf2Html</AssemblyName>
99
<RootNamespace>Pdf2Html</RootNamespace>
1010
</PropertyGroup>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
@@ -137,7 +137,7 @@ void SplashBackgroundRenderer::embed_image(int pageno)
2+
// end of hack
3+
4+
// dump the background image only when it is not empty
5+
- if((xmin <= xmax) && (ymin <= ymax))
6+
+ if((xmin < xmax) && (ymin < ymax))
7+
{
8+
{
9+
auto fn = html_renderer->str_fmt("%s/bg%x.%s", (param.embed_image ? param.tmp_dir : param.dest_dir).c_str(), pageno, format.c_str());
10+
@@ -185,8 +185,8 @@ void SplashBackgroundRenderer::embed_image(int pageno)
11+
// There might be mem leak when exception is thrown !
12+
void SplashBackgroundRenderer::dump_image(const char * filename, int x1, int y1, int x2, int y2)
13+
{
14+
- int width = x2 - x1 + 1;
15+
- int height = y2 - y1 + 1;
16+
+ int width = x2 - x1;
17+
+ int height = y2 - y1;
18+
if((width <= 0) || (height <= 0))
19+
throw "Bad metric for background image";
20+

src/Pdf2Html/pdf2htmlEX/patches/versionEnvs.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# current working: 0.89.0
44

55
-export PDF2HTMLEX_VERSION=0.18.8.rc2
6-
+export PDF2HTMLEX_VERSION=0.18.8.rc1
6+
+export PDF2HTMLEX_VERSION=0.18.8.rc1-cfl2
77

88
export POPPLER_VERSION=poppler-0.89.0
99
#export POPPLER_VERSION=poppler-0.88.0

0 commit comments

Comments
 (0)