You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何为Ghostscript转CMYK PDF过程中的文本添加Overprint Fill

问题:仅为PDF中的黑色文本设置叠印(Overprint)

我有一条Ghostscript命令可将输入PDF转换为CMYK PDF,需求是仅为黑色文本(100%专黑)设置叠印,使得在Adobe Acrobat中打开生成的PDF后,进入「印刷生产」→「输出预览」,取消勾选「Process Black(专黑)」时,文本会消失(被背景叠印覆盖)。


当前使用的Ghostscript命令

gswin64c -q -dQUIET -dBATCH -dNOPAUSE -r300 -sDEVICE=pdfwrite -sOutputFile=output_cmyk.pdf -dProcessColorModel=/DeviceCMYK -sColorConversionStrategy=CMYK -dOverrideICC -sDefaultCMYKProfile=TIC220_WANIFRA_NP26.icc -dOPM=1 -dOverprint=/enable -dCompatibilityLevel=1.6 -f PDFX_def3.ps output.pdf

当前PDFX_def3.ps内容

systemdict /ProcessColorModel known {
  systemdict /ProcessColorModel get /DeviceCMYK ne
} {
  true
} ifelse
{ (ERROR: ProcessColorModel must be /DeviceCMYK.)=
  /ProcessColorModel cvx /rangecheck signalerror
} if

% Define entries to the document Info dictionary :
 

[ /GTS_PDFXVersion (PDF/X-4) % Must be so (the standard requires).
  /Title (Classified Ad)          % Customize.
  /Trapped /False                  % Must be so (Ghostscript doesn't provide other).
  /DOCINFO pdfmark

% Define an ICC profile :

currentdict /ICCProfile known {
  [/_objdef {icc_PDFX} /type /stream /OBJ pdfmark
  [{icc_PDFX} <<N 4 >> /PUT pdfmark
  [{icc_PDFX} ICCProfile (r) file /PUT pdfmark
} if

% Define the output intent dictionary :

[/_objdef {OutputIntent_PDFX} /type /dict /OBJ pdfmark
[{OutputIntent_PDFX} <<
  /Type /OutputIntent              % Must be so (the standard requires).
  /S /GTS_PDFX                     % Must be so (the standard requires).
  /OutputCondition (TIC220_WANIFRA_NP26) % Customize
  /Info (none)                     % Customize
  /OutputConditionIdentifier (TIC220_WANIFRA_NP26)      % Customize
  /RegistryName (http://www.color.org)   % Must be so (the standard requires).
  currentdict /ICCProfile known {
    /DestOutputProfile {icc_PDFX}  % Must be so (see above).
  } if
>> /PUT pdfmark
[{Catalog} <<OutputIntents [ {OutputIntent_PDFX} ]>> /PUT pdfmark

% Ensure overprint settings for all pages
/BeginPage {
  % Enable overprint for fills and strokes
  true setoverprint
} bind def
 

% Ensure BeginPage is called for each page
<< /BeginPage {BeginPage} >> setpagedevice

现有问题

上述PS文件中以下代码会为整个页面的所有元素启用叠印,但我需要仅对黑色文本应用叠印:

% Ensure overprint settings for all pages
/BeginPage {
  % Enable overprint for fills and strokes
  true setoverprint
} bind def
 

% Ensure BeginPage is called for each page
<< /BeginPage {BeginPage} >> setpagedevice

尝试过的修改(编辑1)

我尝试在PS文件中添加以下代码,试图仅为100%黑色内容设置叠印,但黑色文本仍未获得Overprint Fill:

% Ensure overprint settings for all pages
/BeginPage {
  true setoverprint
} bind def

% Ensure BeginPage is called for each page
<< /BeginPage {BeginPage} >> setpagedevice

% Apply overprint specifically to Black (100% K)
/setOP {  
  gsave
  currentcmykcolor
  % Store the CMYK values on the stack
  /K exch def
  /Y exch def
  /M exch def
  /C exch def

  K 1 eq
  C 0 eq
  M 0 eq
  Y 0 eq
  exch and                           
  exch and                           
  exch and  
  {              
    true setoverprint % Set overprint if color is 100% black
  } {              
    false setoverprint % Unset overprint otherwise
  } ifelse
    grestore
} bind def

/show { setOP } bind def 
setOP

内容的提问来源于stack exchange,提问作者K S

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.21 05:49:55