//// This code is part of Document Solutions for PDF .NET demos.// Copyright (c) MESCIUS inc. All rights reserved.//usingSystem.IO;usingSystem.Drawing;usingSystem.Text;usingGrapeCity.Documents.Pdf;usingGrapeCity.Documents.Drawing;usingGCTEXT = GrapeCity.Documents.Text;usingGCDRAW = GrapeCity.Documents.Drawing; namespaceDsPdfWeb.Demos{// This sample shows how to add output intents to a PDF. // It adds several versions of the ICC Probe Profile// which deliberately distorts the rendered colors, so that it is easy// to make sure that a profile is actually being used. To see the effect// in this PDF, you may open it in Adobe Acrobat Reader DC, and set the// Edit | Preferences | Page Display | Show Overprint Preview option to 'Always'.// Then the deliberate color distortion added by the Probe Profile will be obvious.// For details please see the "Output Intents" section of the PDF Specification.publicclassOutputIntents {publicintCreatePDF(Stream stream) {// The different versions of the ICC Probe profile:var profiles = new (string, string)[] { ("Probev2_ICCv4.icc", @"https://www.color.org/probeprofile.xalter"), ("Probev1_ICCv4.icc", @"https://www.color.org/probeprofile.xalter"), ("Probev1_ICCv2.icc", @"https://www.color.org/probeprofile.xalter"), };//var doc = newGcPdfDocument();var page = doc.NewPage();var g = page.Graphics;var sb = newStringBuilder();conststringbullet = "\x2022\x2003"; sb.AppendLine("This document contains the following output intents (first one is the default):");int i = 0;foreach (var profile in profiles) { sb.AppendLine($"{bullet}{profile.Item1}, source: {profile.Item2}");using (FileStream fs = File.OpenRead(Path.Combine("Resources", "Misc", profile.Item1))) {var oi = OutputIntent.Create($"Output intent testing {i++}", "", "http://www.color.org", profile.Item1, fs); doc.OutputIntents.Add(oi); } } sb.AppendLine("Colors processed via the ICC Probe Profile are deliberately distorted, " +"so that it is easy to visually confirm that a profile is being used. " +"To see the effect in this PDF, you may open it in Adobe Acrobat Reader DC and make sure that " +"Edit | Preferences | Page Display | Show Overprint Preview is set to 'Always', " +"then the deliberate color distortion will be obvious.");var rc = Common.Util.AddNote(sb.ToString(), page); g.DrawImage(GCDRAW.Image.FromFile(Path.Combine("Resources", "Images", "roofs.jpg")),newRectangleF(rc.Left, rc.Bottom + 24, rc.Width, rc.Width), null, ImageAlign.StretchImage);// doc.Save(stream);return doc.Pages.Count; } }}