如何擺脫:「套件 hyperref 警告:無法設定 PDF 版本號,因為某些 PDF 物件已寫入」?

如何擺脫:「套件 hyperref 警告:無法設定 PDF 版本號,因為某些 PDF 物件已寫入」?

我想將 pdfx 套件與 LuaLatex 一起使用來產生 PDF/X 相容的 PDF 檔案。

以下警告輸出:

Package hyperref Warning: The PDF version number could not be set,                                                                                                                                                                            
(hyperref)                because some PDF objects are already written:                                                                                                                                                                       
(hyperref)                  3 PDF objects                                                                                                                                                                                                     
(hyperref)                The version should be set as early as possible:                                                                                                                                                                     
(hyperref)                  

答案1

x-1a1標準適用於 PDF 1.3(你真的想要那個嗎?),因此 pdfx 嘗試設定它並使用 hyperref。

問題是,hyperref一方面應該延遲加載,因為它想要修補各種程式碼,另一方面要設定 PDF 版本,它必須提前加載,因為它只能在沒有其他套件寫入任何內容的情況下設定它PDF。

使用 pdfx 時最好的方法是在開始時獨立設定所需的 pdf 版本並忽略警告:

\ExplSyntaxOn
\sys_ensure_backend:
\pdf_version_gset:n{1.3}
\ExplSyntaxOff

\documentclass{...}

答案2

感謝您查看它。

我以不同的順序載入 pdfx 包,警告消失了。

這是我所做的更改的摘錄:

\usepackage[x-1a1]{pdfx}
\usepackage{standalone}
\usepackage{lettrine}
\usepackage{url}

相關內容