First commit

Send all results
This commit is contained in:
2020-09-04 12:49:15 +05:00
commit 330a2ccfda
2819 changed files with 226201 additions and 0 deletions

View File

@@ -0,0 +1,399 @@
#region PDFsharp - A .NET library for processing PDF
//
// Authors:
// Stefan Lange
//
// Copyright (c) 2005-2017 empira Software GmbH, Cologne Area (Germany)
//
// http://www.pdfsharp.com
// http://sourceforge.net/projects/pdfsharp
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
using System;
using PdfSharp.Drawing;
namespace PdfSharp.Pdf.Annotations
{
/// <summary>
/// Represents the base class of all annotations.
/// </summary>
public abstract class PdfAnnotation : PdfDictionary
{
/// <summary>
/// Initializes a new instance of the <see cref="PdfAnnotation"/> class.
/// </summary>
protected PdfAnnotation()
{
Initialize();
}
/// <summary>
/// Initializes a new instance of the <see cref="PdfAnnotation"/> class.
/// </summary>
protected PdfAnnotation(PdfDocument document)
: base(document)
{
Initialize();
}
/// <summary>
/// Initializes a new instance of the <see cref="PdfAnnotation"/> class.
/// </summary>
internal PdfAnnotation(PdfDictionary dict)
: base(dict)
{ }
void Initialize()
{
Elements.SetName(Keys.Type, "/Annot");
Elements.SetString(Keys.NM, Guid.NewGuid().ToString("D"));
Elements.SetDateTime(Keys.M, DateTime.Now);
}
/// <summary>
/// Removes an annotation from the document
/// <seealso cref="PdfAnnotations.Remove(PdfAnnotation)"/>
/// </summary>
[Obsolete("Use 'Parent.Remove(this)'")]
public void Delete()
{
Parent.Remove(this);
}
/// <summary>
/// Gets or sets the annotation flags of this instance.
/// </summary>
public PdfAnnotationFlags Flags
{
get { return (PdfAnnotationFlags)Elements.GetInteger(Keys.F); }
set
{
Elements.SetInteger(Keys.F, (int)value);
Elements.SetDateTime(Keys.M, DateTime.Now);
}
}
/// <summary>
/// Gets or sets the PdfAnnotations object that this annotation belongs to.
/// </summary>
public PdfAnnotations Parent
{
get { return _parent; }
set { _parent = value; }
}
PdfAnnotations _parent;
/// <summary>
/// Gets or sets the annotation rectangle, defining the location of the annotation
/// on the page in default user space units.
/// </summary>
public PdfRectangle Rectangle
{
get { return Elements.GetRectangle(Keys.Rect, true); }
set
{
Elements.SetRectangle(Keys.Rect, value);
Elements.SetDateTime(Keys.M, DateTime.Now);
}
}
/// <summary>
/// Gets or sets the text label to be displayed in the title bar of the annotation<6F>s
/// pop-up window when open and active. By convention, this entry identifies
/// the user who added the annotation.
/// </summary>
public string Title
{
get { return Elements.GetString(Keys.T, true); }
set
{
Elements.SetString(Keys.T, value);
Elements.SetDateTime(Keys.M, DateTime.Now);
}
}
/// <summary>
/// Gets or sets text representing a short description of the subject being
/// addressed by the annotation.
/// </summary>
public string Subject
{
get { return Elements.GetString(Keys.Subj, true); }
set
{
Elements.SetString(Keys.Subj, value);
Elements.SetDateTime(Keys.M, DateTime.Now);
}
}
/// <summary>
/// Gets or sets the text to be displayed for the annotation or, if this type of
/// annotation does not display text, an alternate description of the annotation<6F>s
/// contents in human-readable form.
/// </summary>
public string Contents
{
get { return Elements.GetString(Keys.Contents, true); }
set
{
Elements.SetString(Keys.Contents, value);
Elements.SetDateTime(Keys.M, DateTime.Now);
}
}
/// <summary>
/// Gets or sets the color representing the components of the annotation. If the color
/// has an alpha value other than 1, it is ignored. Use property Opacity to get or set the
/// opacity of an annotation.
/// </summary>
public XColor Color
{
get
{
PdfItem item = Elements[Keys.C];
PdfArray array = item as PdfArray;
if (array != null) // TODO: check for iref?
{
if (array.Elements.Count == 3)
{
// TODO: an array.GetColor() function may be useful here
return XColor.FromArgb(
(int)(array.Elements.GetReal(0) * 255),
(int)(array.Elements.GetReal(1) * 255),
(int)(array.Elements.GetReal(2) * 255));
}
}
return XColors.Black;
}
set
{
// TODO: an array.SetColor(clr) function may be useful here
PdfArray array = new PdfArray(Owner, new PdfReal[] { new PdfReal(value.R / 255.0), new PdfReal(value.G / 255.0), new PdfReal(value.B / 255.0) });
Elements[Keys.C] = array;
Elements.SetDateTime(Keys.M, DateTime.Now);
}
}
/// <summary>
/// Gets or sets the constant opacity value to be used in painting the annotation.
/// This value applies to all visible elements of the annotation in its closed state
/// (including its background and border) but not to the popup window that appears when
/// the annotation is opened.
/// </summary>
public double Opacity
{
get
{
if (!Elements.ContainsKey(Keys.CA))
return 1;
return Elements.GetReal(Keys.CA, true);
}
set
{
if (value < 0 || value > 1)
throw new ArgumentOutOfRangeException("value", value, "Opacity must be a value in the range from 0 to 1.");
Elements.SetReal(Keys.CA, value);
Elements.SetDateTime(Keys.M, DateTime.Now);
}
}
/// <summary>
/// Predefined keys of this dictionary.
/// </summary>
public class Keys : KeysBase
{
// ReSharper disable InconsistentNaming
/// <summary>
/// (Optional) The type of PDF object that this dictionary describes; if present,
/// must be Annot for an annotation dictionary.
/// </summary>
[KeyInfo(KeyType.Name | KeyType.Optional, FixedValue = "Annot")]
public const string Type = "/Type";
/// <summary>
/// (Required) The type of annotation that this dictionary describes.
/// </summary>
[KeyInfo(KeyType.Name | KeyType.Required)]
public const string Subtype = "/Subtype";
/// <summary>
/// (Required) The annotation rectangle, defining the location of the annotation
/// on the page in default user space units.
/// </summary>
[KeyInfo(KeyType.Rectangle | KeyType.Required)]
public const string Rect = "/Rect";
/// <summary>
/// (Optional) Text to be displayed for the annotation or, if this type of annotation
/// does not display text, an alternate description of the annotation<6F>s contents
/// in human-readable form. In either case, this text is useful when
/// extracting the document<6E>s contents in support of accessibility to users with
/// disabilities or for other purposes.
/// </summary>
[KeyInfo(KeyType.TextString | KeyType.Optional)]
public const string Contents = "/Contents";
// P
/// <summary>
/// (Optional; PDF 1.4) The annotation name, a text string uniquely identifying it
/// among all the annotations on its page.
/// </summary>
[KeyInfo(KeyType.TextString | KeyType.Optional)]
public const string NM = "/NM";
/// <summary>
/// (Optional; PDF 1.1) The date and time when the annotation was most recently
/// modified. The preferred format is a date string, but viewer applications should be
/// prepared to accept and display a string in any format.
/// </summary>
[KeyInfo(KeyType.Date | KeyType.Optional)]
public const string M = "/M";
/// <summary>
/// (Optional; PDF 1.1) A set of flags specifying various characteristics of the annotation.
/// Default value: 0.
/// </summary>
[KeyInfo("1.1", KeyType.Integer | KeyType.Optional)]
public const string F = "/F";
/// <summary>
/// (Optional; PDF 1.2) A border style dictionary specifying the characteristics of
/// the annotation<6F>s border.
/// </summary>
[KeyInfo("1.2", KeyType.Dictionary | KeyType.Optional)]
public const string BS = "/BS";
/// <summary>
/// (Optional; PDF 1.2) An appearance dictionary specifying how the annotation
/// is presented visually on the page. Individual annotation handlers may ignore
/// this entry and provide their own appearances.
/// </summary>
[KeyInfo("1.2", KeyType.Dictionary | KeyType.Optional)]
public const string AP = "/AP";
/// <summary>
/// (Required if the appearance dictionary AP contains one or more subdictionaries; PDF 1.2)
/// The annotation<6F>s appearance state, which selects the applicable appearance stream from
/// an appearance subdictionary.
/// </summary>
[KeyInfo("1.2", KeyType.Dictionary | KeyType.Optional)]
public const string AS = "/AS";
/// <summary>
/// (Optional) An array specifying the characteristics of the annotation<6F>s border.
/// The border is specified as a rounded rectangle.
/// In PDF 1.0, the array consists of three numbers defining the horizontal corner
/// radius, vertical corner radius, and border width, all in default user space units.
/// If the corner radii are 0, the border has square (not rounded) corners; if the border
/// width is 0, no border is drawn.
/// In PDF 1.1, the array may have a fourth element, an optional dash array defining a
/// pattern of dashes and gaps to be used in drawing the border. The dash array is
/// specified in the same format as in the line dash pattern parameter of the graphics state.
/// For example, a Border value of [0 0 1 [3 2]] specifies a border 1 unit wide, with
/// square corners, drawn with 3-unit dashes alternating with 2-unit gaps. Note that no
/// dash phase is specified; the phase is assumed to be 0.
/// Note: In PDF 1.2 or later, this entry may be ignored in favor of the BS entry.
/// </summary>
[KeyInfo(KeyType.Array | KeyType.Optional)]
public const string Border = "/Border";
/// <summary>
/// (Optional; PDF 1.1) An array of three numbers in the range 0.0 to 1.0, representing
/// the components of a color in the DeviceRGB color space. This color is used for the
/// following purposes:
/// <20> The background of the annotation<6F>s icon when closed
/// <20> The title bar of the annotation<6F>s pop-up window
/// <20> The border of a link annotation
/// </summary>
[KeyInfo("1.1", KeyType.Array | KeyType.Optional)]
public const string C = "/C";
// @PDF/UA
/// <summary>
/// (Required if the annotation is a structural content item; PDF 1.3)
/// The integer key of the annotation<6F>s entry in the structural parent tree.
/// </summary>
[KeyInfo("1.3", KeyType.Integer | KeyType.Optional)]
public const string StructParent = "/StructParent";
/// <summary>
/// (Optional; PDF 1.1) An action to be performed when the annotation is activated.
/// Note: This entry is not permitted in link annotations if a Dest entry is present.
/// Also note that the A entry in movie annotations has a different meaning.
/// </summary>
[KeyInfo("1.1", KeyType.Dictionary | KeyType.Optional)]
public const string A = "/A";
// AA
// StructParent
// OC
// ----- Excerpt of entries specific to markup annotations ----------------------------------
/// <summary>
/// (Optional; PDF 1.1) The text label to be displayed in the title bar of the annotation<6F>s
/// pop-up window when open and active. By convention, this entry identifies
/// the user who added the annotation.
/// </summary>
[KeyInfo(KeyType.TextString | KeyType.Optional)]
public const string T = "/T";
/// <summary>
/// (Optional; PDF 1.3) An indirect reference to a pop-up annotation for entering or
/// editing the text associated with this annotation.
/// </summary>
[KeyInfo(KeyType.Dictionary | KeyType.Optional)]
public const string Popup = "/Popup";
/// <summary>
/// (Optional; PDF 1.4) The constant opacity value to be used in painting the annotation.
/// This value applies to all visible elements of the annotation in its closed state
/// (including its background and border) but not to the popup window that appears when
/// the annotation is opened.
/// The specified value is not used if the annotation has an appearance stream; in that
/// case, the appearance stream must specify any transparency. (However, if the viewer
/// regenerates the annotation<6F>s appearance stream, it may incorporate the CA value
/// into the stream<61>s content.)
/// The implicit blend mode is Normal.
/// Default value: 1.0.
/// </summary>
[KeyInfo(KeyType.Real | KeyType.Optional)]
public const string CA = "/CA";
//RC
//CreationDate
//IRT
/// <summary>
/// (Optional; PDF 1.5) Text representing a short description of the subject being
/// addressed by the annotation.
/// </summary>
[KeyInfo("1.5", KeyType.TextString | KeyType.Optional)]
public const string Subj = "/Subj";
//RT
//IT
// ReSharper restore InconsistentNaming
}
}
}

View File

@@ -0,0 +1,229 @@
#region PDFsharp - A .NET library for processing PDF
//
// Authors:
// Stefan Lange
//
// Copyright (c) 2005-2017 empira Software GmbH, Cologne Area (Germany)
//
// http://www.pdfsharp.com
// http://sourceforge.net/projects/pdfsharp
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
using System;
using System.Diagnostics;
using System.Collections;
using System.Text;
using System.IO;
using PdfSharp.Pdf.Advanced;
using PdfSharp.Pdf.IO;
using System.Collections.Generic;
namespace PdfSharp.Pdf.Annotations
{
/// <summary>
/// Represents the annotations array of a page.
/// </summary>
public sealed class PdfAnnotations : PdfArray
{
internal PdfAnnotations(PdfDocument document)
: base(document)
{ }
internal PdfAnnotations(PdfArray array)
: base(array)
{ }
/// <summary>
/// Adds the specified annotation.
/// </summary>
/// <param name="annotation">The annotation.</param>
public void Add(PdfAnnotation annotation)
{
annotation.Document = Owner;
Owner._irefTable.Add(annotation);
Elements.Add(annotation.Reference);
}
/// <summary>
/// Removes an annotation from the document.
/// </summary>
public void Remove(PdfAnnotation annotation)
{
if (annotation.Owner != Owner)
throw new InvalidOperationException("The annotation does not belong to this document.");
Owner.Internals.RemoveObject(annotation);
Elements.Remove(annotation.Reference);
}
/// <summary>
/// Removes all the annotations from the current page.
/// </summary>
public void Clear()
{
for (int idx = Count - 1; idx >= 0; idx--)
Page.Annotations.Remove(_page.Annotations[idx]);
}
//public void Insert(int index, PdfAnnotation annotation)
//{
// annotation.Document = Document;
// annotations.Insert(index, annotation);
//}
/// <summary>
/// Gets the number of annotations in this collection.
/// </summary>
public int Count
{
get { return Elements.Count; }
}
/// <summary>
/// Gets the <see cref="PdfSharp.Pdf.Annotations.PdfAnnotation"/> at the specified index.
/// </summary>
public PdfAnnotation this[int index]
{
get
{
PdfReference iref;
PdfDictionary dict;
PdfItem item = Elements[index];
if ((iref = item as PdfReference) != null)
{
Debug.Assert(iref.Value is PdfDictionary, "Reference to dictionary expected.");
dict = (PdfDictionary)iref.Value;
}
else
{
Debug.Assert(item is PdfDictionary, "Dictionary expected.");
dict = (PdfDictionary)item;
}
PdfAnnotation annotation = dict as PdfAnnotation;
if (annotation == null)
{
annotation = new PdfGenericAnnotation(dict);
if (iref == null)
Elements[index] = annotation;
}
return annotation;
}
}
//public PdfAnnotation this[int index]
//{
// get
// {
// //DMH 6/7/06
// //Broke this out to simplfy debugging
// //Use a generic annotation to access the Meta data
// //Assign this as the parent of the annotation
// PdfReference r = Elements[index] as PdfReference;
// PdfDictionary d = r.Value as PdfDictionary;
// PdfGenericAnnotation a = new PdfGenericAnnotation(d);
// a.Collection = this;
// return a;
// }
//}
/// <summary>
/// Gets the page the annotations belongs to.
/// </summary>
internal PdfPage Page
{
get { return _page; }
set { _page = value; }
}
PdfPage _page;
/// <summary>
/// Fixes the /P element in imported annotation.
/// </summary>
internal static void FixImportedAnnotation(PdfPage page)
{
PdfArray annots = page.Elements.GetArray(PdfPage.Keys.Annots);
if (annots != null)
{
int count = annots.Elements.Count;
for (int idx = 0; idx < count; idx++)
{
PdfDictionary annot = annots.Elements.GetDictionary(idx);
if (annot != null && annot.Elements.ContainsKey("/P"))
annot.Elements["/P"] = page.Reference;
}
}
}
/// <summary>
/// Returns an enumerator that iterates through a collection.
/// </summary>
public override IEnumerator<PdfItem> GetEnumerator()
{
return (IEnumerator<PdfItem>)new AnnotationsIterator(this);
}
// THHO4STLA: AnnotationsIterator: Implementation does not work http://forum.pdfsharp.net/viewtopic.php?p=3285#p3285
// Code using the enumerator like this will crash:
//foreach (var annotation in page.Annotations)
//{
// annotation.GetType();
//}
//!!!new 2015-10-15: use PdfItem instead of PdfAnnotation.
// TODO Should we change this to "public new IEnumerator<PdfAnnotation> GetEnumerator()"?
class AnnotationsIterator : IEnumerator<PdfItem/*PdfAnnotation*/>
{
public AnnotationsIterator(PdfAnnotations annotations)
{
_annotations = annotations;
_index = -1;
}
public PdfItem/*PdfAnnotation*/ Current
{
get { return _annotations[_index]; }
}
object IEnumerator.Current
{
get { return Current; }
}
public bool MoveNext()
{
return ++_index < _annotations.Count;
}
public void Reset()
{
_index = -1;
}
public void Dispose()
{
//throw new NotImplementedException();
}
readonly PdfAnnotations _annotations;
int _index;
}
}
}

View File

@@ -0,0 +1,64 @@
#region PDFsharp - A .NET library for processing PDF
//
// Authors:
// Stefan Lange
//
// Copyright (c) 2005-2017 empira Software GmbH, Cologne Area (Germany)
//
// http://www.pdfsharp.com
// http://sourceforge.net/projects/pdfsharp
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
namespace PdfSharp.Pdf.Annotations
{
/// <summary>
/// Represents a generic annotation. Used for annotation dictionaries unknown to PDFsharp.
/// </summary>
internal sealed class PdfGenericAnnotation : PdfAnnotation
{
//DMH 6/7/06
//Make this public so we can use it in PdfAnnotations to
//get the Meta data from existings annotations.
public PdfGenericAnnotation(PdfDictionary dict)
: base(dict)
{ }
/// <summary>
/// Predefined keys of this dictionary.
/// </summary>
internal new class Keys : PdfAnnotation.Keys
{
public static DictionaryMeta Meta
{
get { return _meta ?? (_meta = CreateMeta(typeof(Keys))); }
}
static DictionaryMeta _meta;
}
/// <summary>
/// Gets the KeysMeta of this dictionary type.
/// </summary>
internal override DictionaryMeta Meta
{
get { return Keys.Meta; }
}
}
}

View File

@@ -0,0 +1,224 @@
#region PDFsharp - A .NET library for processing PDF
//
// Authors:
// Stefan Lange
//
// Copyright (c) 2005-2017 empira Software GmbH, Cologne Area (Germany)
//
// http://www.pdfsharp.com
// http://sourceforge.net/projects/pdfsharp
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
using System;
using PdfSharp.Pdf.IO;
using PdfSharp.Pdf.Internal;
namespace PdfSharp.Pdf.Annotations
{
/// <summary>
/// Represents a link annotation.
/// </summary>
public sealed class PdfLinkAnnotation : PdfAnnotation
{
// Just a hack to make MigraDoc work with this code.
enum LinkType
{
None, Document, Web, File
}
/// <summary>
/// Initializes a new instance of the <see cref="PdfLinkAnnotation"/> class.
/// </summary>
public PdfLinkAnnotation()
{
_linkType = LinkType.None;
Elements.SetName(PdfAnnotation.Keys.Subtype, "/Link");
}
/// <summary>
/// Initializes a new instance of the <see cref="PdfLinkAnnotation"/> class.
/// </summary>
public PdfLinkAnnotation(PdfDocument document)
: base(document)
{
_linkType = LinkType.None;
Elements.SetName(PdfAnnotation.Keys.Subtype, "/Link");
}
/// <summary>
/// Creates a link within the current document.
/// </summary>
/// <param name="rect">The link area in default page coordinates.</param>
/// <param name="destinationPage">The one-based destination page number.</param>
public static PdfLinkAnnotation CreateDocumentLink(PdfRectangle rect, int destinationPage)
{
if (destinationPage < 1)
throw new ArgumentException("Invalid destination page in call to CreateDocumentLink: page number is one-based and must be 1 or higher.", "destinationPage");
PdfLinkAnnotation link = new PdfLinkAnnotation();
link._linkType = LinkType.Document;
link.Rectangle = rect;
link._destPage = destinationPage;
return link;
}
int _destPage;
LinkType _linkType;
string _url;
/// <summary>
/// Creates a link to the web.
/// </summary>
public static PdfLinkAnnotation CreateWebLink(PdfRectangle rect, string url)
{
PdfLinkAnnotation link = new PdfLinkAnnotation();
link._linkType = PdfLinkAnnotation.LinkType.Web;
link.Rectangle = rect;
link._url = url;
return link;
}
/// <summary>
/// Creates a link to a file.
/// </summary>
public static PdfLinkAnnotation CreateFileLink(PdfRectangle rect, string fileName)
{
PdfLinkAnnotation link = new PdfLinkAnnotation();
link._linkType = LinkType.File;
// TODO: Adjust bleed box here (if possible)
link.Rectangle = rect;
link._url = fileName;
return link;
}
internal override void WriteObject(PdfWriter writer)
{
PdfPage dest = null;
//pdf.AppendFormat(CultureInfo.InvariantCulture,
// "{0} 0 obj\n<<\n/Type/Annot\n/Subtype/Link\n" +
// "/Rect[{1} {2} {3} {4}]\n/BS<</Type/Border>>\n/Border[0 0 0]\n/C[0 0 0]\n",
// ObjectID.ObjectNumber, rect.X1, rect.Y1, rect.X2, rect.Y2);
// Older Adobe Reader versions uses a border width of 0 as default value if neither Border nor BS are present.
// But the PDF Reference specifies:
// "If neither the Border nor the BS entry is present, the border is drawn as a solid line with a width of 1 point."
// After this issue was fixed in newer Reader versions older PDFsharp created documents show an ugly solid border.
// The following hack fixes this by specifying a 0 width border.
if (Elements[PdfAnnotation.Keys.BS] == null)
Elements[PdfAnnotation.Keys.BS] = new PdfLiteral("<</Type/Border/W 0>>");
// May be superfluous. See comment above.
if (Elements[PdfAnnotation.Keys.Border] == null)
Elements[PdfAnnotation.Keys.Border] = new PdfLiteral("[0 0 0]");
switch (_linkType)
{
case LinkType.None:
break;
case LinkType.Document:
// destIndex > Owner.PageCount can happen when rendering pages using PDFsharp directly.
int destIndex = _destPage;
if (destIndex > Owner.PageCount)
destIndex = Owner.PageCount;
destIndex--;
dest = Owner.Pages[destIndex];
//pdf.AppendFormat("/Dest[{0} 0 R/XYZ null null 0]\n", dest.ObjectID);
Elements[Keys.Dest] = new PdfLiteral("[{0} 0 R/XYZ null null 0]", dest.ObjectNumber);
break;
case LinkType.Web:
//pdf.AppendFormat("/A<</S/URI/URI{0}>>\n", PdfEncoders.EncodeAsLiteral(url));
Elements[PdfAnnotation.Keys.A] = new PdfLiteral("<</S/URI/URI{0}>>", //PdfEncoders.EncodeAsLiteral(url));
PdfEncoders.ToStringLiteral(_url, PdfStringEncoding.WinAnsiEncoding, writer.SecurityHandler));
break;
case LinkType.File:
//pdf.AppendFormat("/A<</Type/Action/S/Launch/F<</Type/Filespec/F{0}>> >>\n",
// PdfEncoders.EncodeAsLiteral(url));
Elements[PdfAnnotation.Keys.A] = new PdfLiteral("<</Type/Action/S/Launch/F<</Type/Filespec/F{0}>> >>",
//PdfEncoders.EncodeAsLiteral(url));
PdfEncoders.ToStringLiteral(_url, PdfStringEncoding.WinAnsiEncoding, writer.SecurityHandler));
break;
}
base.WriteObject(writer);
}
/// <summary>
/// Predefined keys of this dictionary.
/// </summary>
internal new class Keys : PdfAnnotation.Keys
{
// /// <summary>
// /// (Required) The type of annotation that this dictionary describes;
// /// must be Link for a link annotation.
// /// </summary>
// inherited from base class
/// <summary>
/// (Optional; not permitted if an A entry is present) A destination to be displayed
/// when the annotation is activated.
/// </summary>
[KeyInfo(KeyType.ArrayOrNameOrString | KeyType.Optional)]
public const string Dest = "/Dest";
/// <summary>
/// (Optional; PDF 1.2) The annotation<6F>s highlighting mode, the visual effect to be
/// used when the mouse button is pressed or held down inside its active area:
/// N (None) No highlighting.
/// I (Invert) Invert the contents of the annotation rectangle.
/// O (Outline) Invert the annotation<6F>s border.
/// P (Push) Display the annotation as if it were being pushed below the surface of the page.
/// Default value: I.
/// Note: In PDF 1.1, highlighting is always done by inverting colors inside the annotation rectangle.
/// </summary>
[KeyInfo("1.2", KeyType.Name | KeyType.Optional)]
public const string H = "/H";
/// <summary>
/// (Optional; PDF 1.3) A URI action formerly associated with this annotation. When Web
/// Capture changes and annotation from a URI to a go-to action, it uses this entry to save
/// the data from the original URI action so that it can be changed back in case the target page for
/// the go-to action is subsequently deleted.
/// </summary>
[KeyInfo("1.3", KeyType.Dictionary | KeyType.Optional)]
public const string PA = "/PA";
// QuadPoints
/// <summary>
/// Gets the KeysMeta for these keys.
/// </summary>
public static DictionaryMeta Meta
{
get { return _meta ?? (_meta = CreateMeta(typeof(Keys))); }
}
static DictionaryMeta _meta;
}
/// <summary>
/// Gets the KeysMeta of this dictionary type.
/// </summary>
internal override DictionaryMeta Meta
{
get { return Keys.Meta; }
}
}
}

View File

@@ -0,0 +1,133 @@
#region PDFsharp - A .NET library for processing PDF
//
// Authors:
// Stefan Lange
//
// Copyright (c) 2005-2017 empira Software GmbH, Cologne Area (Germany)
//
// http://www.pdfsharp.com
// http://sourceforge.net/projects/pdfsharp
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
using System;
using PdfSharp.Drawing;
namespace PdfSharp.Pdf.Annotations
{
/// <summary>
/// Represents a rubber stamp annotation.
/// </summary>
public sealed class PdfRubberStampAnnotation : PdfAnnotation
{
/// <summary>
/// Initializes a new instance of the <see cref="PdfRubberStampAnnotation"/> class.
/// </summary>
public PdfRubberStampAnnotation()
{
Initialize();
}
/// <summary>
/// Initializes a new instance of the <see cref="PdfRubberStampAnnotation"/> class.
/// </summary>
/// <param name="document">The document.</param>
public PdfRubberStampAnnotation(PdfDocument document)
: base(document)
{
Initialize();
}
void Initialize()
{
Elements.SetName(Keys.Subtype, "/Stamp");
Color = XColors.Yellow;
}
/// <summary>
/// Gets or sets an icon to be used in displaying the annotation.
/// </summary>
public PdfRubberStampAnnotationIcon Icon
{
get
{
string value = Elements.GetName(Keys.Name);
if (value == "")
return PdfRubberStampAnnotationIcon.NoIcon;
value = value.Substring(1);
if (!Enum.IsDefined(typeof(PdfRubberStampAnnotationIcon), value))
return PdfRubberStampAnnotationIcon.NoIcon;
return (PdfRubberStampAnnotationIcon)Enum.Parse(typeof(PdfRubberStampAnnotationIcon), value, false);
}
set
{
if (Enum.IsDefined(typeof(PdfRubberStampAnnotationIcon), value) &&
PdfRubberStampAnnotationIcon.NoIcon != value)
{
Elements.SetName(Keys.Name, "/" + value.ToString());
}
else
Elements.Remove(Keys.Name);
}
}
/// <summary>
/// Predefined keys of this dictionary.
/// </summary>
internal new class Keys : PdfAnnotation.Keys
{
/// <summary>
/// (Optional) The name of an icon to be used in displaying the annotation. Viewer
/// applications should provide predefined icon appearances for at least the following
/// standard names:
/// Approved
/// AsIs
/// Confidential
/// Departmental
/// Draft
/// Experimental
/// Expired
/// Final
/// ForComment
/// ForPublicRelease
/// NotApproved
/// NotForPublicRelease
/// Sold
/// TopSecret
/// </summary>
[KeyInfo(KeyType.Name | KeyType.Optional)]
public const string Name = "/Name";
public static DictionaryMeta Meta
{
get { return _meta ?? (_meta = CreateMeta(typeof(Keys))); }
}
static DictionaryMeta _meta;
}
/// <summary>
/// Gets the KeysMeta of this dictionary type.
/// </summary>
internal override DictionaryMeta Meta
{
get { return Keys.Meta; }
}
}
}

View File

@@ -0,0 +1,154 @@
#region PDFsharp - A .NET library for processing PDF
//
// Authors:
// Stefan Lange
//
// Copyright (c) 2005-2017 empira Software GmbH, Cologne Area (Germany)
//
// http://www.pdfsharp.com
// http://sourceforge.net/projects/pdfsharp
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
using System;
namespace PdfSharp.Pdf.Annotations
{
/// <summary>
/// Represents a text annotation.
/// </summary>
public sealed class PdfTextAnnotation : PdfAnnotation
{
/// <summary>
/// Initializes a new instance of the <see cref="PdfTextAnnotation"/> class.
/// </summary>
public PdfTextAnnotation()
{
Initialize();
}
/// <summary>
/// Initializes a new instance of the <see cref="PdfTextAnnotation"/> class.
/// </summary>
public PdfTextAnnotation(PdfDocument document)
: base(document)
{
Initialize();
}
void Initialize()
{
Elements.SetName(Keys.Subtype, "/Text");
// By default make a yellow comment.
Icon = PdfTextAnnotationIcon.Comment;
//Color = XColors.Yellow;
}
// public static PdfTextAnnotation CreateDocumentLink(PdfRectangle rect, int destinatinPage)
// {
// PdfTextAnnotation link = new PdfTextAnnotation();
// //link.linkType = PdfTextAnnotation.LinkType.Document;
// //link.Rectangle = rect;
// //link.destPage = destinatinPage;
// return link;
// }
/// <summary>
/// Gets or sets a flag indicating whether the annotation should initially be displayed open.
/// </summary>
public bool Open
{
get { return Elements.GetBoolean(Keys.Open); }
set { Elements.SetBoolean(Keys.Open, value); }
}
/// <summary>
/// Gets or sets an icon to be used in displaying the annotation.
/// </summary>
public PdfTextAnnotationIcon Icon
{
get
{
string value = Elements.GetName(Keys.Name);
if (value == "")
return PdfTextAnnotationIcon.NoIcon;
value = value.Substring(1);
if (!Enum.IsDefined(typeof(PdfTextAnnotationIcon), value))
return PdfTextAnnotationIcon.NoIcon;
return (PdfTextAnnotationIcon)Enum.Parse(typeof(PdfTextAnnotationIcon), value, false);
}
set
{
if (Enum.IsDefined(typeof(PdfTextAnnotationIcon), value) &&
PdfTextAnnotationIcon.NoIcon != value)
{
Elements.SetName(Keys.Name, "/" + value.ToString());
}
else
Elements.Remove(Keys.Name);
}
}
/// <summary>
/// Predefined keys of this dictionary.
/// </summary>
internal new class Keys : PdfAnnotation.Keys
{
/// <summary>
/// (Optional) A flag specifying whether the annotation should initially be displayed open.
/// Default value: false (closed).
/// </summary>
[KeyInfo(KeyType.Boolean | KeyType.Optional)]
public const string Open = "/Open";
/// <summary>
/// (Optional) The name of an icon to be used in displaying the annotation. Viewer
/// applications should provide predefined icon appearances for at least the following
/// standard names:
/// Comment
/// Help
/// Insert
/// Key
/// NewParagraph
/// Note
/// Paragraph
/// </summary>
[KeyInfo(KeyType.Name | KeyType.Optional)]
public const string Name = "/Name";
//State
//StateModel
public static DictionaryMeta Meta
{
get { return _meta ?? (_meta = CreateMeta(typeof(Keys))); }
}
static DictionaryMeta _meta;
}
/// <summary>
/// Gets the KeysMeta of this dictionary type.
/// </summary>
internal override DictionaryMeta Meta
{
get { return Keys.Meta; }
}
}
}

View File

@@ -0,0 +1,97 @@
#region PDFsharp - A .NET library for processing PDF
//
// Authors:
// Stefan Lange
//
// Copyright (c) 2005-2017 empira Software GmbH, Cologne Area (Germany)
//
// http://www.pdfsharp.com
// http://sourceforge.net/projects/pdfsharp
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
namespace PdfSharp.Pdf.Annotations
{
/// <summary>
/// Represents a text annotation.
/// </summary>
internal sealed class PdfWidgetAnnotation : PdfAnnotation
{
public PdfWidgetAnnotation()
{
Initialize();
}
public PdfWidgetAnnotation(PdfDocument document)
: base(document)
{
Initialize();
}
void Initialize()
{
Elements.SetName(Keys.Subtype, "/Widget");
}
/// <summary>
/// Predefined keys of this dictionary.
/// </summary>
internal new class Keys : PdfAnnotation.Keys
{
/// <summary>
/// (Optional) The annotation<6F>s highlighting mode, the visual effect to be used when
/// the mouse button is pressed or held down inside its active area:
/// N (None) No highlighting.
/// I (Invert) Invert the contents of the annotation rectangle.
/// O (Outline) Invert the annotation<6F>s border.
/// P (Push) Display the annotation<6F>s down appearance, if any. If no down appearance is defined,
/// offset the contents of the annotation rectangle to appear as if it were being pushed below
/// the surface of the page.
/// T (Toggle) Same as P (which is preferred).
/// A highlighting mode other than P overrides any down appearance defined for the annotation.
/// Default value: I.
/// </summary>
[KeyInfo(KeyType.Name | KeyType.Optional)]
public const string H = "/H";
/// <summary>
/// (Optional) An appearance characteristics dictionary to be used in constructing a dynamic
/// appearance stream specifying the annotation<6F>s visual presentation on the page.
/// The name MK for this entry is of historical significance only and has no direct meaning.
/// </summary>
[KeyInfo(KeyType.Dictionary | KeyType.Optional)]
public const string MK = "/MK";
public static DictionaryMeta Meta
{
get { return _meta ?? (_meta = CreateMeta(typeof(Keys))); }
}
static DictionaryMeta _meta;
}
/// <summary>
/// Gets the KeysMeta of this dictionary type.
/// </summary>
internal override DictionaryMeta Meta
{
get { return Keys.Meta; }
}
}
}

View File

@@ -0,0 +1,112 @@
#region PDFsharp - A .NET library for processing PDF
//
// Authors:
// Stefan Lange
//
// Copyright (c) 2005-2017 empira Software GmbH, Cologne Area (Germany)
//
// http://www.pdfsharp.com
// http://sourceforge.net/projects/pdfsharp
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
namespace PdfSharp.Pdf.Annotations
{
/// <summary>
/// Specifies the annotation flags.
/// </summary>
[System.Flags]
public enum PdfAnnotationFlags
{
/// <summary>
/// If set, do not display the annotation if it does not belong to one of the standard
/// annotation types and no annotation handler is available. If clear, display such an
/// unknown annotation using an appearance stream specified by its appearancedictionary,
/// if any.
/// </summary>
Invisible = 1 << (1 - 1),
/// <summary>
/// (PDF 1.2) If set, do not display or print the annotation or allow it to interact
/// with the user, regardless of its annotation type or whether an annotation
/// handler is available. In cases where screen space is limited, the ability to hide
/// and show annotations selectively can be used in combination with appearance
/// streams to display auxiliary pop-up information similar in function to online
/// help systems.
/// </summary>
Hidden = 1 << (2 - 1),
/// <summary>
/// (PDF 1.2) If set, print the annotation when the page is printed. If clear, never
/// print the annotation, regardless of whether it is displayed on the screen. This
/// can be useful, for example, for annotations representing interactive pushbuttons,
/// which would serve no meaningful purpose on the printed page.
/// </summary>
Print = 1 << (3 - 1),
/// <summary>
/// (PDF 1.3) If set, do not scale the annotation<6F>s appearance to match the magnification
/// of the page. The location of the annotation on the page (defined by the
/// upper-left corner of its annotation rectangle) remains fixed, regardless of the
/// page magnification. See below for further discussion.
/// </summary>
NoZoom = 1 << (4 - 1),
/// <summary>
/// (PDF 1.3) If set, do not rotate the annotation<6F>s appearance to match the rotation
/// of the page. The upper-left corner of the annotation rectangle remains in a fixed
/// location on the page, regardless of the page rotation. See below for further discussion.
/// </summary>
NoRotate = 1 << (5 - 1),
/// <summary>
/// (PDF 1.3) If set, do not display the annotation on the screen or allow it to
/// interact with the user. The annotation may be printed (depending on the setting
/// of the Print flag) but should be considered hidden for purposes of on-screen
/// display and user interaction.
/// </summary>
NoView = 1 << (6 - 1),
/// <summary>
/// (PDF 1.3) If set, do not allow the annotation to interact with the user. The
/// annotation may be displayed or printed (depending on the settings of the
/// NoView and Print flags) but should not respond to mouse clicks or change its
/// appearance in response to mouse motions.
/// Note: This flag is ignored for widget annotations; its function is subsumed by
/// the ReadOnly flag of the associated form field.
/// </summary>
ReadOnly = 1 << (7 - 1),
/// <summary>
/// (PDF 1.4) If set, do not allow the annotation to be deleted or its properties
/// (including position and size) to be modified by the user. However, this flag does
/// not restrict changes to the annotation<6F>s contents, such as the value of a form
/// field.
/// </summary>
Locked = 1 << (8 - 1),
/// <summary>
/// (PDF 1.5) If set, invert the interpretation of the NoView flag for certain events.
/// A typical use is to have an annotation that appears only when a mouse cursor is
/// held over it.
/// </summary>
ToggleNoView = 1 << (9 - 1),
}
}

View File

@@ -0,0 +1,112 @@
#region PDFsharp - A .NET library for processing PDF
//
// Authors:
// Stefan Lange
//
// Copyright (c) 2005-2017 empira Software GmbH, Cologne Area (Germany)
//
// http://www.pdfsharp.com
// http://sourceforge.net/projects/pdfsharp
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
namespace PdfSharp.Pdf.Annotations
{
/// <summary>
/// Specifies the predefined icon names of rubber stamp annotations.
/// </summary>
public enum PdfRubberStampAnnotationIcon
{
/// <summary>
/// A pre-defined rubber stamp annotation icon.
/// </summary>
NoIcon,
/// <summary>
/// A pre-defined rubber stamp annotation icon.
/// </summary>
Approved,
/// <summary>
/// A pre-defined rubber stamp annotation icon.
/// </summary>
AsIs,
/// <summary>
/// A pre-defined rubber stamp annotation icon.
/// </summary>
Confidential,
/// <summary>
/// A pre-defined rubber stamp annotation icon.
/// </summary>
Departmental,
/// <summary>
/// A pre-defined rubber stamp annotation icon.
/// </summary>
Draft,
/// <summary>
/// A pre-defined rubber stamp annotation icon.
/// </summary>
Experimental,
/// <summary>
/// A pre-defined rubber stamp annotation icon.
/// </summary>
Expired,
/// <summary>
/// A pre-defined rubber stamp annotation icon.
/// </summary>
Final,
/// <summary>
/// A pre-defined rubber stamp annotation icon.
/// </summary>
ForComment,
/// <summary>
/// A pre-defined rubber stamp annotation icon.
/// </summary>
ForPublicRelease,
/// <summary>
/// A pre-defined rubber stamp annotation icon.
/// </summary>
NotApproved,
/// <summary>
/// A pre-defined rubber stamp annotation icon.
/// </summary>
NotForPublicRelease,
/// <summary>
/// A pre-defined rubber stamp annotation icon.
/// </summary>
Sold,
/// <summary>
/// A pre-defined rubber stamp annotation icon.
/// </summary>
TopSecret,
}
}

View File

@@ -0,0 +1,77 @@
#region PDFsharp - A .NET library for processing PDF
//
// Authors:
// Stefan Lange
//
// Copyright (c) 2005-2017 empira Software GmbH, Cologne Area (Germany)
//
// http://www.pdfsharp.com
// http://sourceforge.net/projects/pdfsharp
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion
namespace PdfSharp.Pdf.Annotations
{
/// <summary>
/// Specifies the pre-defined icon names of text annotations.
/// </summary>
public enum PdfTextAnnotationIcon
{
/// <summary>
/// A pre-defined annotation icon.
/// </summary>
NoIcon,
/// <summary>
/// A pre-defined annotation icon.
/// </summary>
Comment,
/// <summary>
/// A pre-defined annotation icon.
/// </summary>
Help,
/// <summary>
/// A pre-defined annotation icon.
/// </summary>
Insert,
/// <summary>
/// A pre-defined annotation icon.
/// </summary>
Key,
/// <summary>
/// A pre-defined annotation icon.
/// </summary>
NewParagraph,
/// <summary>
/// A pre-defined annotation icon.
/// </summary>
Note,
/// <summary>
/// A pre-defined annotation icon.
/// </summary>
Paragraph,
}
}