From 7b7ffb427d7f441a8ef5a9c44601af3fc8570e50 Mon Sep 17 00:00:00 2001 From: Julien Neuhart Date: Fri, 15 Mar 2024 10:56:35 +0100 Subject: [PATCH] fix(chromium): disable PDF tagging --- pkg/modules/chromium/browser.go | 4 +++- pkg/modules/chromium/tasks.go | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/modules/chromium/browser.go b/pkg/modules/chromium/browser.go index bb23ae6f..df0516cf 100644 --- a/pkg/modules/chromium/browser.go +++ b/pkg/modules/chromium/browser.go @@ -90,6 +90,8 @@ func (b *chromiumBrowser) Start(logger *zap.Logger) error { // https://github.com/puppeteer/puppeteer/issues/2410 chromedp.Flag("font-render-hinting", "none"), chromedp.UserDataDir(b.userProfileDirPath), + // See https://github.com/gotenberg/gotenberg/issues/831. + chromedp.Flag("disable-pdf-tagging", true), ) if b.arguments.incognito { @@ -164,7 +166,7 @@ func (b *chromiumBrowser) Stop(logger *zap.Logger) error { go func() { // FIXME: Chromium seems to recreate the user profile directory // right after its deletion if we do not wait a certain amount - // of time before re-deleting it. + // of time before deleting it. <-time.After(10 * time.Second) err := os.RemoveAll(userProfileDirPath) diff --git a/pkg/modules/chromium/tasks.go b/pkg/modules/chromium/tasks.go index f224fdb2..d1d4b8f4 100644 --- a/pkg/modules/chromium/tasks.go +++ b/pkg/modules/chromium/tasks.go @@ -47,6 +47,8 @@ func printToPdfActionFunc(logger *zap.Logger, outputPath string, options PdfOpti WithMarginRight(options.MarginRight). WithPageRanges(pageRanges). WithPreferCSSPageSize(options.PreferCssPageSize). + // Does not seem to work. + // See https://github.com/gotenberg/gotenberg/issues/831. WithGenerateTaggedPDF(false) hasCustomHeaderFooter := options.HeaderTemplate != DefaultPdfOptions().HeaderTemplate ||