use PDF/A tools from updated base image (pdftools.mk)

This commit is contained in:
Jörn-Michael Miehe 2025-10-02 21:46:10 +00:00
parent e72b5b6730
commit a48e82ba8b
9 changed files with 10 additions and 96 deletions

View file

@ -1,11 +1,6 @@
FROM docker.io/ldericher/autodoc:diagram FROM docker.io/ldericher/autodoc:diagram
RUN set -ex; \ RUN set -ex; \
# install pdfa tools
ln -s \
/workspaces/lev-templates/deploy/pdfa \
/opt/ \
; \
# install TeXoffice # install TeXoffice
ln -s \ ln -s \
/workspaces/lev-templates/deploy/texoffice \ /workspaces/lev-templates/deploy/texoffice \

View file

@ -13,7 +13,7 @@
"configureZshAsDefaultShell": "true" "configureZshAsDefaultShell": "true"
}, },
"ghcr.io/devcontainers/features/git:1": {}, "ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers-contrib/features/git-lfs:1": {}, "ghcr.io/devcontainers/features/git-lfs:1": {},
"ghcr.io/devcontainers-extra/features/apt-get-packages:1": { "ghcr.io/devcontainers-extra/features/apt-get-packages:1": {
"packages": "pdftk,poppler-utils" "packages": "pdftk,poppler-utils"
} }
@ -22,7 +22,8 @@
// Ensure git is installed before git-lfs // Ensure git is installed before git-lfs
"overrideFeatureInstallOrder": [ "overrideFeatureInstallOrder": [
"ghcr.io/devcontainers/features/common-utils", "ghcr.io/devcontainers/features/common-utils",
"ghcr.io/devcontainers/features/git" "ghcr.io/devcontainers/features/git",
"ghcr.io/devcontainers/features/git-lfs"
], ],
// Configure tool-specific properties. // Configure tool-specific properties.

3
.gitattributes vendored
View file

@ -1,3 +1,2 @@
deploy/pdfa/bin/* filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text *.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text *.png filter=lfs diff=lfs merge=lfs -text

View file

@ -3,6 +3,7 @@
"tomoki1207.pdf" "tomoki1207.pdf"
], ],
"unwantedRecommendations": [ "unwantedRecommendations": [
"ms-azuretools.vscode-containers",
"ms-vscode.makefile-tools" "ms-vscode.makefile-tools"
] ]
} }

View file

@ -1,9 +1,4 @@
FROM docker.io/ldericher/autodoc:0.8-diagram FROM docker.io/ldericher/autodoc:diagram
# install pdfa tools as per https://stackoverflow.com/a/39420880
COPY --chown=root:root \
deploy/pdfa \
/opt/pdfa
# install TeXoffice # install TeXoffice
COPY --chown=root:root \ COPY --chown=root:root \

View file

@ -1,39 +0,0 @@
%!
% This prefix file for creating a PDF/A document is derived from
% the sample included with Ghostscript 9.07, released under the
% GNU Affero General Public License.
% Modified 4/15/2013 by MCB Systems.
% Feel free to modify entries marked with "Customize".
% This assumes an ICC profile to reside in the file (AdobeRGB1998.icc),
% unless the user modifies the corresponding line below.
% The color space described by the ICC profile must correspond to the
% ProcessColorModel specified when using this prefix file (GRAY with
% DeviceGray, RGB with DeviceRGB, and CMYK with DeviceCMYK).
% Define entries in the document Info dictionary :
/ICCProfile (/opt/pdfa/bin/AdobeRGB1998.icc) % Customize.
def
[ /Title (Title) % Customize.
/DOCINFO pdfmark
% Define an ICC profile :
[/_objdef {icc_PDFA} /type /stream /OBJ pdfmark
[{icc_PDFA} <</N systemdict /ProcessColorModel get /DeviceGray eq {1} {systemdict /ProcessColorModel get /DeviceRGB eq {3} {4} ifelse} ifelse >> /PUT pdfmark
[{icc_PDFA} ICCProfile (r) file /PUT pdfmark
% Define the output intent dictionary :
[/_objdef {OutputIntent_PDFA} /type /dict /OBJ pdfmark
[{OutputIntent_PDFA} <<
/Type /OutputIntent % Must be so (the standard requires).
/S /GTS_PDFA1 % Must be so (the standard requires).
/DestOutputProfile {icc_PDFA} % Must be so (see above).
/OutputConditionIdentifier (default_rgb) % Customize
>> /PUT pdfmark
[{Catalog} <</OutputIntents [ {OutputIntent_PDFA} ]>> /PUT pdfmark

BIN
deploy/pdfa/bin/AdobeRGB1998.icc (Stored with Git LFS)

Binary file not shown.

BIN
deploy/pdfa/bin/gs-919-linux_x86_64 (Stored with Git LFS)

Binary file not shown.

View file

@ -1,3 +1,5 @@
include /usr/local/share/autodoc/pdftools.mk
# compile markdown using pandoc # compile markdown using pandoc
# params: # params:
# 1: input file # 1: input file
@ -14,40 +16,6 @@ compile_md = pandoc \
$(PANDOCFLAGS) \ $(PANDOCFLAGS) \
--output $(4) --output $(4)
GSFLAGS := \
-sDEVICE=pdfwrite \
-dNOOUTERSAVE \
-dNOPAUSE \
-dQUIET \
-dBATCH
# post-process and compress PDF files
# params:
# 1: input file
# 2: output file
postprocess_pdf = gs \
$(GSFLAGS) \
-sPAPERSIZE=a4 \
-dFIXEDMEDIA \
-dPDFFitPage \
-dCompatibilityLevel=1.7 \
-dPDFSETTINGS=/ebook \
-sOutputFile=$(2) \
$(1)
# convert PDF to PDF/A 2-b
# params:
# 1: input file
# 2: output file
convert_pdfa = /opt/pdfa/bin/gs-919-linux_x86_64 \
$(GSFLAGS) \
-dPDFA=2 \
-sProcessColorModel=DeviceRGB \
-dPDFACompatibilityPolicy=1 \
-sOutputFile=$(2) \
/opt/pdfa/PDFA_def.ps \
$(1)
# convert markdown to LaTeX # convert markdown to LaTeX
# params: # params:
# 1: input file # 1: input file
@ -60,10 +28,10 @@ md2tex = $(call compile_md,$(1),$(2),latex,$(3))
# 1: input file # 1: input file
# 2: pandoc template # 2: pandoc template
# 3: output file # 3: output file
md2pdf = $(call compile_md,$(1),$(2),pdf,-) | $(call postprocess_pdf,-,$(3)) md2pdf = $(call compile_md,$(1),$(2),pdf,-) | $(call pdftools_pdfcat,-,$(3))
# convert markdown to PDF/A 2-b # convert markdown to PDF/A 2-b
# 1: input file # 1: input file
# 2: pandoc template # 2: pandoc template
# 3: output file # 3: output file
md2pdfa = $(call md2pdf,$(1),$(2),-) | $(call convert_pdfa,-,$(3)) md2pdfa = $(call md2pdf,$(1),$(2),-) | $(call pdftools_mkpdfa,3,-,$(3))