OutputIntents.vb
C# VB
'''' This code is part of Document Solutions for PDF .NET demos.'' Copyright (c) MESCIUS inc. All rights reserved.''Imports System.IOImports System.DrawingImports System.TextImports GrapeCity.Documents.PdfImports GrapeCity.Documents.DrawingImports GCDRAW = GrapeCity.Documents.Drawing
Public Class OutputIntents Public Function CreatePDF(ByVal stream As Stream) As Integer ' The different versions of the ICC Probe profile: Dim 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") } ' Dim doc = New GcPdfDocument() Dim page = doc.NewPage() Dim g = page.Graphics Dim sb = New StringBuilder() Dim bullet = ChrW(&H2022) & ChrW(&H2003) sb.AppendLine("This document contains the following output intents (first one is the default):") Dim i = 0 For Each profile In profiles sb.AppendLine($"{bullet}{profile.Item1}, source: {profile.Item2}") Using fs = File.OpenRead(Path.Combine("Resources", "Misc", profile.Item1)) Dim oi = OutputIntent.Create($"Output intent testing {i}", "", "http://www.color.org", profile.Item1, fs) doc.OutputIntents.Add(oi) i += 1 End Using Next 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.") Dim rc = Util.AddNote(sb.ToString(), page) g.DrawImage(GCDRAW.Image.FromFile(Path.Combine("Resources", "Images", "roofs.jpg")), New RectangleF(rc.Left, rc.Bottom + 24, rc.Width, rc.Width), Nothing, ImageAlign.StretchImage) ' doc.Save(stream) Return doc.Pages.Count End FunctionEnd Class