forked from Uzi-Granot/PdfFileWriter
-
Notifications
You must be signed in to change notification settings - Fork 1
3.4 Draw Frame with Background Pattern
OgreTransporter edited this page Mar 2, 2020
·
1 revision
The DrawFrameAndBackgroundWaterMark
method draws a frame around the example area with background water mark pattern. The pattern resource was define in the previous subsection.
// Draw frame around example area
private void DrawFrameAndBackgroundWaterMark()
{
// save graphics state
Contents.SaveGraphicsState();
// Draw frame around the page
// Set line width to 0.02"
Contents.SetLineWidth(0.02);
// set frame color dark blue
Contents.SetColorStroking(Color.DarkBlue);
// use water mark tiling pattern to fill the frame
Contents.SetPatternNonStroking(WaterMark);
// rectangle position: x=1.0", y=1.0", width=6.5", height=9.0"
Contents.DrawRectangle(1.0, 1.0, 6.5, 9.0, PaintOp.CloseFillStroke);
// restore graphics sate
Contents.RestoreGraphicsState();
// draw article name under the frame
// Note: the \u00a4 is character 164 that was substituted during Font resource definition
// this character is a solid circle it is normally Unicode 9679 or \u25cf in the Arial family
Contents.DrawText(ArialNormal, 9.0, 1.1, 0.85, "PdfFileWriter \u25cf PDF File Writer C# Class Library \u25cf Author: Uzi Granot");
// draw web link to the article
Contents.DrawWebLink(Page, ArialNormal, 9.0, 7.4, 0.85, TextJustify.Right,
DrawStyle.Underline, Color.Blue, "Click to view article", ArticleLink);
return;
}
This page is a copy from https://www.codeproject.com/Articles/570682/PDF-File-Writer-Csharp-Class-Library by Uzi Granot. The article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL). All rights to the texts and source code remain with Uzi Granot.