Код: Выделить всё
static void Main(string[] args)
{
// Create a new PDF document
Doc theDoc = new Doc();
// HTML content
string htmlContent = @"
Black text should become yellow when Process Black is unchecked in Output Preview in Acrobat
";
// Add the HTML to the document
theDoc.HtmlOptions.Engine = EngineType.MSHtml;
theDoc.Rendering.ColorSpace = XRendering.ColorSpaceType.Cmyk;
theDoc.Rendering.Overprint = true;
theDoc.AddImageHtml(htmlContent);
foreach (IndirectObject io in theDoc.ObjectSoup)
{
if (io is StreamObject)
{
StreamObject so = (StreamObject)theDoc.ObjectSoup[io.ID];
so.Decompress();
string content = so.GetText();
// Ensure black text is overprinted by yellow background
string newContent = content.Replace("0 0 0 rg", "0 0 0 1 k") // Overprint black fill
.Replace("0 0 0 RG", "0 0 0 1 K") // Overprint black stroke
.Replace("1 1 0 RG", "0 0 1 0 K") // Yellow fill
.Replace("1 1 0 rg", "0 0 1 0 k"); // Yellow stroke
// Only set new content if changed
if (newContent != content)
so.SetText(newContent);
so.Compress();
}
}
// Save the document
theDoc.Save("output.pdf");
theDoc.Clear();
}
Когда я открываю этот PDF-файл CMYK в Adobe Acrobat и снимаю флажок «Обрабатывать черный», текст становится белым, но он должен быть желтым, он должен быть наложен на фон.
Эти строки не не помогу
Код: Выделить всё
theDoc.Rendering.ColorSpace = XRendering.ColorSpaceType.Cmyk;
theDoc.Rendering.Overprint = true;
Подробнее здесь: https://stackoverflow.com/questions/787 ... ext-in-pdf