diff --git a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.IO/DdlParser.cs b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.IO/DdlParser.cs index b19f0564..64e2593a 100644 --- a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.IO/DdlParser.cs +++ b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.IO/DdlParser.cs @@ -74,7 +74,7 @@ internal DdlParser(string fileName, string ddl, DdlReaderErrors errors) } /// - /// Parses the keyword «\document». + /// Parses the keyword �\document�. /// internal Document ParseDocument(Document document) { @@ -106,8 +106,8 @@ internal Document ParseDocument(Document document) } /// - /// Parses one of the keywords «\document», «\styles», «\section», «\table», «\textframe», «\chart» - /// and «\paragraph» and returns the corresponding DocumentObject or DocumentObjectCollection. + /// Parses one of the keywords �\document�, �\styles�, �\section�, �\table�, �\textframe�, �\chart� + /// and �\paragraph� and returns the corresponding DocumentObject or DocumentObjectCollection. /// internal DocumentObject ParseDocumentObject() { @@ -158,7 +158,7 @@ internal DocumentObject ParseDocumentObject() } /// - /// Parses the keyword «\styles». + /// Parses the keyword �\styles�. /// private Styles ParseStyles(Styles styles) { @@ -180,7 +180,7 @@ private Styles ParseStyles(Styles styles) } /// - /// Parses a style definition block within the keyword «\styles». + /// Parses a style definition block within the keyword �\styles�. /// private Style ParseStyleDefinition(Styles styles) { @@ -264,7 +264,7 @@ private bool IsHeaderFooter() } /// - /// Parses the keyword «\section». + /// Parses the keyword �\section�. /// private Section ParseSection(Sections sections) { @@ -284,7 +284,7 @@ private Section ParseSection(Sections sections) AssertSymbol(Symbol.BraceLeft); - // Consider the case that the keyword «\paragraph» can be omitted. + // Consider the case that the keyword �\paragraph� can be omitted. if (IsParagraphContent()) { Paragraph paragraph = section.Elements.AddParagraph(); @@ -313,7 +313,7 @@ private Section ParseSection(Sections sections) } /// - /// Parses the keywords «\header». + /// Parses the keywords �\header�. /// private void ParseHeaderFooter(Section section) { @@ -423,7 +423,7 @@ private bool IsParagraphContent() } /// - /// Parses the document elements of a «\paragraph», «\cell» or comparable. + /// Parses the document elements of a �\paragraph�, �\cell� or comparable. /// private DocumentElements ParseDocumentElements(DocumentElements elements, Symbol context) { @@ -482,7 +482,7 @@ private DocumentElements ParseDocumentElements(DocumentElements elements, Symbol } /// - /// Parses the keyword «\paragraph». + /// Parses the keyword �\paragraph�. /// private void ParseParagraph(DocumentElements elements) { @@ -675,7 +675,7 @@ private void ParseFormattedText(ParagraphElements elements, int nestingLevel) } /// - /// Parses the keywords «\bold», «\italic», and «\underline». + /// Parses the keywords �\bold�, �\italic�, and �\underline�. /// private void ParseBoldItalicEtc(FormattedText formattedText, int nestingLevel) { @@ -686,7 +686,7 @@ private void ParseBoldItalicEtc(FormattedText formattedText, int nestingLevel) } /// - /// Parses the keyword «\font». + /// Parses the keyword �\font�. /// private void ParseFont(FormattedText formattedText, int nestingLevel) { @@ -708,7 +708,7 @@ private void ParseFont(FormattedText formattedText, int nestingLevel) } /// - /// Parses code like «("name")». + /// Parses code like �("name")�. /// private string ParseElementName() { @@ -725,7 +725,7 @@ private string ParseElementName() } /// - /// Parses the keyword «\fontsize». + /// Parses the keyword �\fontsize�. /// private void ParseFontSize(FormattedText formattedText, int nestingLevel) { @@ -746,7 +746,7 @@ private void ParseFontSize(FormattedText formattedText, int nestingLevel) } /// - /// Parses the keyword «\fontcolor». + /// Parses the keyword �\fontcolor�. /// private void ParseFontColor(FormattedText formattedText, int nestingLevel) { @@ -765,7 +765,7 @@ private void ParseFontColor(FormattedText formattedText, int nestingLevel) } /// - /// Parses the keyword «\symbol» resp. «\(». + /// Parses the keyword �\symbol� resp. �\(�. /// private void ParseSymbol(ParagraphElements elements) { @@ -818,7 +818,7 @@ private void ParseSymbol(ParagraphElements elements) } /// - /// Parses the keyword «\chr». + /// Parses the keyword �\chr�. /// private void ParseChr(ParagraphElements elements) { @@ -864,7 +864,7 @@ private void ParseChr(ParagraphElements elements) } /// - /// Parses the keyword «\field». + /// Parses the keyword �\field�. /// private void ParseField(ParagraphElements elements, int nestingLevel) { @@ -925,7 +925,7 @@ private void ParseField(ParagraphElements elements, int nestingLevel) } /// - /// Parses the keyword «\footnote». + /// Parses the keyword �\footnote�. /// private void ParseFootnote(ParagraphElements elements, int nestingLevel) { @@ -938,7 +938,7 @@ private void ParseFootnote(ParagraphElements elements, int nestingLevel) AssertSymbol(Symbol.BraceLeft); - // The keyword «\paragraph» is typically ommitted. + // The keyword �\paragraph� is typically ommitted. if (IsParagraphContent()) { Paragraph paragraph = footnote.Elements.AddParagraph(); @@ -953,7 +953,7 @@ private void ParseFootnote(ParagraphElements elements, int nestingLevel) } /// - /// Parses the keyword «\hyperlink». + /// Parses the keyword �\hyperlink�. /// private void ParseHyperlink(ParagraphElements elements, int nestingLevel) { @@ -971,7 +971,7 @@ private void ParseHyperlink(ParagraphElements elements, int nestingLevel) } /// - /// Parses the keyword «\space». + /// Parses the keyword �\space�. /// private void ParseSpace(ParagraphElements elements, int nestingLevel) { @@ -984,7 +984,7 @@ private void ParseSpace(ParagraphElements elements, int nestingLevel) Character space = elements.AddSpace(1); - // «\space» can stand alone + // �\space� can stand alone if (scanner.PeekSymbol() == Symbol.ParenLeft) { ReadCode(); // read '(' @@ -1028,7 +1028,7 @@ private void ParsePageBreak(DocumentElements elements) } /// - /// Parses the keyword «\table». + /// Parses the keyword �\table�. /// private void ParseTable(DocumentElements elements, Table table) { @@ -1048,11 +1048,11 @@ private void ParseTable(DocumentElements elements, Table table) AssertSymbol(Symbol.BraceLeft); ReadCode(); - // Table must start with «\columns»... + // Table must start with �\columns�... AssertSymbol(Symbol.Columns); ParseColumns(tbl); - // ...followed by «\rows». + // ...followed by �\rows�. AssertSymbol(Symbol.Rows); ParseRows(tbl); @@ -1067,7 +1067,7 @@ private void ParseTable(DocumentElements elements, Table table) } /// - /// Parses the keyword «\columns». + /// Parses the keyword �\columns�. /// private void ParseColumns(Table table) { @@ -1107,7 +1107,7 @@ private void ParseColumns(Table table) } /// - /// Parses the keyword «\column». + /// Parses the keyword �\column�. /// private void ParseColumn(Column column) { @@ -1128,7 +1128,7 @@ private void ParseColumn(Column column) } /// - /// Parses the keyword «\rows». + /// Parses the keyword �\rows�. /// private void ParseRows(Table table) { @@ -1168,7 +1168,7 @@ private void ParseRows(Table table) } /// - /// Parses the keyword «\row». + /// Parses the keyword �\row�. /// private void ParseRow(Row row) { @@ -1213,7 +1213,7 @@ private void ParseRow(Row row) } /// - /// Parses the keyword «\cell». + /// Parses the keyword �\cell�. /// private void ParseCell(Cell cell) { @@ -1243,7 +1243,7 @@ private void ParseCell(Cell cell) } /// - /// Parses the keyword «\image». + /// Parses the keyword �\image�. /// private void ParseImage(Image image, bool paragraphContent) { @@ -1279,7 +1279,7 @@ private void ParseImage(Image image, bool paragraphContent) } /// - /// Parses the keyword «\textframe». + /// Parses the keyword �\textframe�. /// private void ParseTextFrame(DocumentElements elements) { @@ -1353,7 +1353,7 @@ private void ParseBarcode(DocumentElements elements) } /// - /// Parses the keyword «\chart». + /// Parses the keyword �\chart�. /// private void ParseChart(DocumentElements elements) { @@ -1472,7 +1472,7 @@ private void ParseChart(DocumentElements elements) } /// - /// Parses the keyword «\plotarea» inside a chart. + /// Parses the keyword �\plotarea� inside a chart. /// private void ParseArea(PlotArea area) { @@ -1518,8 +1518,8 @@ private void ParseArea(PlotArea area) } /// - /// Parses the keywords «\headerarea», «\toparea», «\bottomarea», «\footerarea», - /// «\leftarea» or «\rightarea» inside a chart. + /// Parses the keywords �\headerarea�, �\toparea�, �\bottomarea�, �\footerarea�, + /// �\leftarea� or �\rightarea� inside a chart. /// private void ParseArea(TextArea area) { @@ -1594,7 +1594,7 @@ private void ParseArea(TextArea area) } /// - /// Parses the keywords «\xaxis», «\yaxis» or «\zaxis» inside a chart. + /// Parses the keywords �\xaxis�, �\yaxis� or �\zaxis� inside a chart. /// private void ParseAxes(Axis axis, Symbol symbolAxis) { @@ -1630,7 +1630,7 @@ private void ParseAxes(Axis axis, Symbol symbolAxis) } /// - /// Parses the keyword «\series» inside a chart. + /// Parses the keyword �\series� inside a chart. /// private void ParseSeries(Series series) { @@ -1698,7 +1698,7 @@ private void ParseSeries(Series series) } /// - /// Parses the keyword «\xvalues» inside a chart. + /// Parses the keyword �\xvalues� inside a chart. /// private void ParseSeries(XSeries series) { @@ -1760,7 +1760,7 @@ private void ParseSeries(XSeries series) } /// - /// Parses the keyword «\point» inside a series. + /// Parses the keyword �\point� inside a series. /// private void ParsePoint(Point point) { @@ -1790,7 +1790,7 @@ private void ParsePoint(Point point) } /// - /// Parses the keyword «\legend» inside a textarea. + /// Parses the keyword �\legend� inside a textarea. /// private void ParseLegend(Legend legend) { @@ -1822,7 +1822,7 @@ private void ParseLegend(Legend legend) } /// - /// Parses an attribute declaration block enclosed in brackets «[…]». If readNextSymbol is + /// Parses an attribute declaration block enclosed in brackets �[�]�. If readNextSymbol is /// set to true, the closing bracket will be read. /// private void ParseAttributes(DocumentObject element, bool readNextSymbol) @@ -1841,7 +1841,7 @@ private void ParseAttributes(DocumentObject element, bool readNextSymbol) } /// - /// Parses an attribute declaration block enclosed in brackets «[…]». + /// Parses an attribute declaration block enclosed in brackets �[�]�. /// private void ParseAttributes(DocumentObject element) { @@ -1858,7 +1858,7 @@ private void ParseAttributeStatement(DocumentObject dom) // or // sequence of identifiers: xxx.yyy.zzz // - // followed by: «=», «+=», «-=», or «{» + // followed by: �=�, �+=�, �-=�, or �{� // // Parser of rhs depends on the type of the l-value. @@ -1979,7 +1979,7 @@ private void ParseAttributeStatement(DocumentObject dom) } /// - /// Parses an attribute declaration block enclosed in braces «{…}». + /// Parses an attribute declaration block enclosed in braces �{�}�. /// private void ParseAttributeBlock(DocumentObject element) { @@ -2221,8 +2221,8 @@ private void ParseColorAssignment(DocumentObject dom, ValueDescriptor vd) } /// - /// Parses a color. It can be «green», «123456», «0xFFABCDEF», - /// «RGB(r, g, b)», «CMYK(c, m, y, k)», «CMYK(a, c, m, y, k)», «GRAY(g)», or «"MyColor"». + /// Parses a color. It can be �green�, �123456�, �0xFFABCDEF�, + /// �RGB(r, g, b)�, �CMYK(c, m, y, k)�, �CMYK(a, c, m, y, k)�, �GRAY(g)�, or �"MyColor"�. /// private Color ParseColor() { @@ -2278,7 +2278,7 @@ private Color ParseColor() } /// - /// Parses «RGB(r, g, b)». + /// Parses �RGB(r, g, b)�. /// private Color ParseRGB() { @@ -2319,7 +2319,7 @@ private Color ParseRGB() } /// - /// Parses «CMYK(c, m, y, k)» or «CMYK(a, c, m, y, k)». + /// Parses �CMYK(c, m, y, k)� or �CMYK(a, c, m, y, k)�. /// private Color ParseCMYK() { @@ -2390,7 +2390,7 @@ private Color ParseCMYK() } /// - /// Parses «GRAY(g)». + /// Parses �GRAY(g)�. /// private Color ParseGray() { @@ -2720,4 +2720,4 @@ private TokenType TokenType private DdlScanner scanner; private DdlReaderErrors errors; } -} \ No newline at end of file +} diff --git a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.IO/DdlScanner.cs b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.IO/DdlScanner.cs index 720f54c5..ab565ece 100644 --- a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.IO/DdlScanner.cs +++ b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.IO/DdlScanner.cs @@ -41,10 +41,10 @@ ddl = | table-element: - \table «attributes»opt { «columns-element» «rows-element» } + \table �attributes�opt { �columns-element� �rows-element� } table-element: - \table «attributes»opt { «columns-element» «rows-element» } + \table �attributes�opt { �columns-element� �rows-element� } */ namespace MigraDocCore.DocumentObjectModel.IO @@ -294,7 +294,7 @@ protected Symbol PeekPunctuator(int index) // sym = Symbol.Question; // break; - case '¤': + case '�': sym = Symbol.Currency; //??? used in DDL? break; @@ -1314,7 +1314,7 @@ protected Symbol ScanPunctuator() // sym = Symbol.Question; // break; - case '¤': + case '�': sym = Symbol.Currency; //??? used in DDL? break; @@ -1409,7 +1409,7 @@ protected Symbol ScanPunctuator() /// - /// Scans verbatim strings like «@"String with ""quoted"" text"». + /// Scans verbatim strings like �@"String with ""quoted"" text"�. /// protected string ScanVerbatimStringLiteral() { @@ -1434,7 +1434,7 @@ protected string ScanVerbatimStringLiteral() } /// - /// Scans regular string literals like «"String with \"escaped\" text"». + /// Scans regular string literals like �"String with \"escaped\" text"�. /// protected string ScanStringLiteral() { diff --git a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.IO/enums/Symbol.cs b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.IO/enums/Symbol.cs index 075d10ec..6d1e4264 100644 --- a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.IO/enums/Symbol.cs +++ b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.IO/enums/Symbol.cs @@ -83,7 +83,7 @@ enum Symbol Percent, // % Dollar, // $ Hash, // # - Currency, // ¤ + Currency, // � //Questionmark, // ? Quotationmark, // " At, // @ diff --git a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.IO/enums/TokenType.cs b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.IO/enums/TokenType.cs index 28996f22..9651f6ea 100644 --- a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.IO/enums/TokenType.cs +++ b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.IO/enums/TokenType.cs @@ -50,17 +50,17 @@ enum TokenType Identifier, /// - /// Both «true» and «\bold» are keywords, case sensitive. + /// Both �true� and �\bold� are keywords, case sensitive. /// KeyWord, /// - /// Sample: «42» + /// Sample: �42� /// IntegerLiteral, /// - /// Samples: «42.0», «42.», «.42»,... + /// Samples: �42.0�, �42.�, �.42�,... /// RealLiteral, @@ -70,12 +70,12 @@ enum TokenType CharacterLiteral, /// - /// Both «"text"» and «@"text with ""quotes"""». + /// Both �"text"� and �@"text with ""quotes"""�. /// StringLiteral, /// - /// Samples: «.», «{», «+=»,... + /// Samples: �.�, �{�, �+=�,... /// OperatorOrPunctuator, diff --git a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Internals/Meta.cs b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Internals/Meta.cs index cbae8587..4acd132a 100644 --- a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Internals/Meta.cs +++ b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Internals/Meta.cs @@ -277,4 +277,4 @@ static void AddValueDescriptors(Meta meta, Type type) } } } -} \ No newline at end of file +} diff --git a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Internals/NEnum.cs b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Internals/NEnum.cs index 6cb328a3..fa29a20d 100644 --- a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Internals/NEnum.cs +++ b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Internals/NEnum.cs @@ -72,8 +72,8 @@ public int Value get { return this.val != int.MinValue ? this.val : 0; } set { - //TODO: Klasse Character So ändern, dass symbolName und char in unterschiedlichen Feldern gespeichert wird - //Diese Spezialbehandlung entfällt dann. + //TODO: Klasse Character So �ndern, dass symbolName und char in unterschiedlichen Feldern gespeichert wird + //Diese Spezialbehandlung entf�llt dann. if (this.type == typeof(SymbolName)) { // if (Enum.IsDefined(this.type, (uint)value)) diff --git a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Internals/NString.cs b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Internals/NString.cs index fbb6a206..2ac94385 100644 --- a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Internals/NString.cs +++ b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Internals/NString.cs @@ -115,4 +115,4 @@ public override int GetHashCode() string val; } -} \ No newline at end of file +} diff --git a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Resources/AppResources.Designer.cs b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Resources/AppResources.Designer.cs index c6628cae..1d3cc46a 100644 --- a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Resources/AppResources.Designer.cs +++ b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Resources/AppResources.Designer.cs @@ -1,4 +1,4 @@ -//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.42000 diff --git a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Resources/DomSR.cs b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Resources/DomSR.cs index f1a3946a..3ff049b2 100644 --- a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Resources/DomSR.cs +++ b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Resources/DomSR.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Reflection; diff --git a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Shapes/TextFrame.cs b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Shapes/TextFrame.cs index 8231f0fa..74ad8674 100644 --- a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Shapes/TextFrame.cs +++ b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Shapes/TextFrame.cs @@ -294,4 +294,4 @@ internal override Meta Meta static Meta meta; #endregion } -} \ No newline at end of file +} diff --git a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Shapes/WrapFormat.cs b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Shapes/WrapFormat.cs index 99a98440..7499634b 100644 --- a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Shapes/WrapFormat.cs +++ b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Shapes/WrapFormat.cs @@ -154,4 +154,4 @@ internal override Meta Meta static Meta meta; #endregion } -} \ No newline at end of file +} diff --git a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Tables/Cell.cs b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Tables/Cell.cs index 271b6c89..fc5f5969 100644 --- a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Tables/Cell.cs +++ b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Tables/Cell.cs @@ -467,4 +467,4 @@ internal override Meta Meta static Meta meta; #endregion } -} \ No newline at end of file +} diff --git a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Visitors/VisitorBase.cs b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Visitors/VisitorBase.cs index 66548873..cb4d672f 100644 --- a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Visitors/VisitorBase.cs +++ b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel.Visitors/VisitorBase.cs @@ -262,7 +262,7 @@ protected void FlattenTabStops(TabStops tabStops, TabStops refTabStops) if (!tabStop.AddTab) tabStops.RemoveObjectAt(i); } - //Die TabStopCollection ist so wie sie jetzt ist vollständig. + //Die TabStopCollection ist so wie sie jetzt ist vollst�ndig. //Sie darf daher nichts erben, d.h. : tabStops.fClearAll = true; } diff --git a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/Character.cs b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/Character.cs index 2603c795..1da1ef3c 100644 --- a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/Character.cs +++ b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/Character.cs @@ -40,7 +40,7 @@ namespace MigraDocCore.DocumentObjectModel /// /// Represents a special character in paragraph text. /// - // TODO: So ändern, dass symbolName und char in unterschiedlichen Feldern gespeichert wird + // TODO: So �ndern, dass symbolName und char in unterschiedlichen Feldern gespeichert wird public class Character : DocumentObject { // \space diff --git a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/Chars.cs b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/Chars.cs index 9bd963a1..9b7be342 100644 --- a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/Chars.cs +++ b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/Chars.cs @@ -78,7 +78,7 @@ public sealed class Chars public const char Question = '?'; public const char Hyphen = '-'; // char(45) public const char SoftHyphen = '\u00ad'; // char(173) - public const char Currency = '¤'; + public const char Currency = '�'; public const char ZeroWidthSpace = '\u200b'; } } diff --git a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/Color.cs b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/Color.cs index 09e308c2..daed1c21 100644 --- a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/Color.cs +++ b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/Color.cs @@ -515,4 +515,4 @@ public static Color FromCmykColor(double alpha, Color color) /// public static readonly Color Empty = new Color(0); } -} \ No newline at end of file +} diff --git a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/ImageHelper.cs b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/ImageHelper.cs index 894d4b5d..184b3307 100644 --- a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/ImageHelper.cs +++ b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/ImageHelper.cs @@ -1,4 +1,4 @@ -#region MigraDoc - Creating Documents on the Fly +#region MigraDoc - Creating Documents on the Fly // // Authors: // Stefan Lange (mailto:Stefan.Lange@PdfSharpCore.com) diff --git a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/Serializer.cs b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/Serializer.cs index 5b7c0142..5a57e27f 100644 --- a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/Serializer.cs +++ b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/Serializer.cs @@ -284,7 +284,7 @@ void WriteToStream(string text, bool fLineBreak, bool fAutoIndent) { // does not work // if (IsBlankRequired(this.lastChar, _text[0])) - // _text = "·" + _text; + // _text = "�" + _text; } else { @@ -300,7 +300,7 @@ void WriteToStream(string text, bool fLineBreak, bool fAutoIndent) if (this.linePos > this.lineBreakBeyond) { fLineBreak = true; - //this.textWriter.Write("//¶"); // for debugging only + //this.textWriter.Write("//�"); // for debugging only } else this.lastChar = text[len - 1]; diff --git a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/Style.cs b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/Style.cs index a27be459..b4b8ebbf 100644 --- a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/Style.cs +++ b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/Style.cs @@ -292,7 +292,7 @@ public Style GetBaseStyle() if (this.baseStyle.Value == "") throw new ArgumentException("User defined Style defined without a BaseStyle"); - //REVIEW KlPo4StLa Spezialbehandlung für den DefaultParagraphFont krüppelig(DefaultParagraphFont wird bei zugrif über styles["name"] nicht zurückgeliefert). + //REVIEW KlPo4StLa Spezialbehandlung f�r den DefaultParagraphFont kr�ppelig(DefaultParagraphFont wird bei zugrif �ber styles["name"] nicht zur�ckgeliefert). //Da hast Du Recht -> siehe IsReadOnly if (this.baseStyle.Value == DefaultParagraphFontName) return styles[0]; @@ -309,7 +309,7 @@ public bool BuildIn } [DV] internal NBool buildIn = NBool.NullValue; - // THHO: muss dass nicht builtIn heißen?!?!?!? + // THHO: muss dass nicht builtIn hei�en?!?!?!? /// /// Gets or sets a comment associated with this object. diff --git a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/Styles.cs b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/Styles.cs index e4f58398..fb99ceb7 100644 --- a/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/Styles.cs +++ b/MigraDocCore.DocumentObjectModel/MigraDoc.DocumentObjectModel/Styles.cs @@ -244,55 +244,55 @@ internal void SetupStyles() style.ParagraphFormat.WidowControl = true; this.Add(style); - // Heading1 'Überschrift 1' (Paragraph Style) + // Heading1 '�berschrift 1' (Paragraph Style) style = new Style("Heading1", "Normal"); style.buildIn.Value = true; style.ParagraphFormat.OutlineLevel = OutlineLevel.Level1; this.Add(style); - // Heading2 'Überschrift 2' (Paragraph Style) + // Heading2 '�berschrift 2' (Paragraph Style) style = new Style("Heading2", "Heading1"); style.buildIn.Value = true; style.ParagraphFormat.OutlineLevel = OutlineLevel.Level2; this.Add(style); - // Heading3 'Überschrift 3' (Paragraph Style) + // Heading3 '�berschrift 3' (Paragraph Style) style = new Style("Heading3", "Heading2"); style.buildIn.Value = true; style.ParagraphFormat.OutlineLevel = OutlineLevel.Level3; this.Add(style); - // Heading4 'Überschrift 4' (Paragraph Style) + // Heading4 '�berschrift 4' (Paragraph Style) style = new Style("Heading4", "Heading3"); style.buildIn.Value = true; style.ParagraphFormat.OutlineLevel = OutlineLevel.Level4; this.Add(style); - // Heading5 'Überschrift 5' (Paragraph Style) + // Heading5 '�berschrift 5' (Paragraph Style) style = new Style("Heading5", "Heading4"); style.buildIn.Value = true; style.ParagraphFormat.OutlineLevel = OutlineLevel.Level5; this.Add(style); - // Heading6 'Überschrift 6' (Paragraph Style) + // Heading6 '�berschrift 6' (Paragraph Style) style = new Style("Heading6", "Heading5"); style.buildIn.Value = true; style.ParagraphFormat.OutlineLevel = OutlineLevel.Level6; this.Add(style); - // Heading7 'Überschrift 7' (Paragraph Style) + // Heading7 '�berschrift 7' (Paragraph Style) style = new Style("Heading7", "Heading6"); style.buildIn.Value = true; style.ParagraphFormat.OutlineLevel = OutlineLevel.Level7; this.Add(style); - // Heading8 'Überschrift 8' (Paragraph Style) + // Heading8 '�berschrift 8' (Paragraph Style) style = new Style("Heading8", "Heading7"); style.buildIn.Value = true; style.ParagraphFormat.OutlineLevel = OutlineLevel.Level8; this.Add(style); - // Heading9 'Überschrift 9' (Paragraph Style) + // Heading9 '�berschrift 9' (Paragraph Style) style = new Style("Heading9", "Heading8"); style.buildIn.Value = true; style.ParagraphFormat.OutlineLevel = OutlineLevel.Level9; @@ -303,7 +303,7 @@ internal void SetupStyles() style.buildIn.Value = true; this.Add(style); - // Footnote 'Fußnote' (Paragraph Style) + // Footnote 'Fu�note' (Paragraph Style) style = new Style("Footnote", "Normal"); style.buildIn.Value = true; this.Add(style); @@ -313,7 +313,7 @@ internal void SetupStyles() style.buildIn.Value = true; this.Add(style); - // -33: Footer 'Fußzeile' (Paragraph Style) + // -33: Footer 'Fu�zeile' (Paragraph Style) style = new Style("Footer", "Normal"); style.buildIn.Value = true; this.Add(style); @@ -323,7 +323,7 @@ internal void SetupStyles() style.buildIn.Value = true; this.Add(style); - // InvalidStyleName 'Ungültiger Formatvorlagenname' (Paragraph Style) + // InvalidStyleName 'Ung�ltiger Formatvorlagenname' (Paragraph Style) style = new Style("InvalidStyleName", "Normal"); style.buildIn.Value = true; style.Font.Bold = true; diff --git a/MigraDocCore.DocumentObjectModel/ProductVersionInfo.cs b/MigraDocCore.DocumentObjectModel/ProductVersionInfo.cs index 377522fd..1b401b0b 100644 --- a/MigraDocCore.DocumentObjectModel/ProductVersionInfo.cs +++ b/MigraDocCore.DocumentObjectModel/ProductVersionInfo.cs @@ -81,7 +81,7 @@ public static class ProductVersionInfo /// /// The copyright information. Also used as NuGet Copyright. /// - public const string Copyright = "Copyright © 2001-2012 empira Software GmbH."; // Also used as NuGet Copyright. + public const string Copyright = "Copyright � 2001-2012 empira Software GmbH."; // Also used as NuGet Copyright. /// /// The trademark the product. diff --git a/MigraDocCore.Rendering/MigraDoc.Rendering.Resources/AppResources.Designer.cs b/MigraDocCore.Rendering/MigraDoc.Rendering.Resources/AppResources.Designer.cs index 549f9511..d168ecfa 100644 --- a/MigraDocCore.Rendering/MigraDoc.Rendering.Resources/AppResources.Designer.cs +++ b/MigraDocCore.Rendering/MigraDoc.Rendering.Resources/AppResources.Designer.cs @@ -1,4 +1,4 @@ -//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.42000 diff --git a/MigraDocCore.Rendering/MigraDoc.Rendering.UnitTest/TestParagraphRenderer.cs b/MigraDocCore.Rendering/MigraDoc.Rendering.UnitTest/TestParagraphRenderer.cs index 101379f8..52c73d18 100644 --- a/MigraDocCore.Rendering/MigraDoc.Rendering.UnitTest/TestParagraphRenderer.cs +++ b/MigraDocCore.Rendering/MigraDoc.Rendering.UnitTest/TestParagraphRenderer.cs @@ -235,4 +235,4 @@ public static void Fields(string outputFile) printer.PdfDocument.Save(outputFile); } } -} \ No newline at end of file +} diff --git a/MigraDocCore.Rendering/MigraDoc.Rendering/ColorHelper.cs b/MigraDocCore.Rendering/MigraDoc.Rendering/ColorHelper.cs index 41dfc4b1..bba853c1 100644 --- a/MigraDocCore.Rendering/MigraDoc.Rendering/ColorHelper.cs +++ b/MigraDocCore.Rendering/MigraDoc.Rendering/ColorHelper.cs @@ -55,4 +55,4 @@ public static XColor ToXColor(Color color, bool cmyk) return XColor.FromArgb((int)color.Argb); } } -} \ No newline at end of file +} diff --git a/MigraDocCore.Rendering/MigraDoc.Rendering/FormattedDocument.cs b/MigraDocCore.Rendering/MigraDoc.Rendering/FormattedDocument.cs index b7d1b411..77cf9425 100644 --- a/MigraDocCore.Rendering/MigraDoc.Rendering/FormattedDocument.cs +++ b/MigraDocCore.Rendering/MigraDoc.Rendering/FormattedDocument.cs @@ -754,4 +754,4 @@ internal bool IsEmptyPage(int page) Dictionary emptyPages = new Dictionary(); Document document; } -} \ No newline at end of file +} diff --git a/MigraDocCore.Rendering/MigraDoc.Rendering/ParagraphRenderer.cs b/MigraDocCore.Rendering/MigraDoc.Rendering/ParagraphRenderer.cs index 2a3b7dd9..b6bd8405 100644 --- a/MigraDocCore.Rendering/MigraDoc.Rendering/ParagraphRenderer.cs +++ b/MigraDocCore.Rendering/MigraDoc.Rendering/ParagraphRenderer.cs @@ -1,4 +1,4 @@ -#region MigraDoc - Creating Documents on the Fly +#region MigraDoc - Creating Documents on the Fly // // Authors: // Klaus Potzesny (mailto:Klaus.Potzesny@PdfSharpCore.com) diff --git a/MigraDocCore.Rendering/MigraDoc.Rendering/TopDownFormatter.cs b/MigraDocCore.Rendering/MigraDoc.Rendering/TopDownFormatter.cs index 49ed134c..33f2fa89 100644 --- a/MigraDocCore.Rendering/MigraDoc.Rendering/TopDownFormatter.cs +++ b/MigraDocCore.Rendering/MigraDoc.Rendering/TopDownFormatter.cs @@ -201,7 +201,7 @@ public void FormatOnAreas(XGraphics gfx, bool topLevel) #if false area = this.areaProvider.GetNextArea(); #else - if (!ready) //!!!newTHHO 19.01.2007: korrekt? oder GetNextArea immer ausführen??? + if (!ready) //!!!newTHHO 19.01.2007: korrekt? oder GetNextArea immer ausf�hren??? { area = this.areaProvider.GetNextArea(); maxHeight = area.Height; diff --git a/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/BarChartRenderer.cs b/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/BarChartRenderer.cs index 51a5bf27..0b4d23a8 100644 --- a/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/BarChartRenderer.cs +++ b/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/BarChartRenderer.cs @@ -255,4 +255,4 @@ internal void InitSeries() } } } -} \ No newline at end of file +} diff --git a/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/BarDataLabelRenderer.cs b/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/BarDataLabelRenderer.cs index 0533555f..4f74a3b1 100644 --- a/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/BarDataLabelRenderer.cs +++ b/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/BarDataLabelRenderer.cs @@ -159,4 +159,4 @@ internal override void CalcPositions() } } } -} \ No newline at end of file +} diff --git a/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/ColumnChartRenderer.cs b/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/ColumnChartRenderer.cs index cce6e462..5a20ad5f 100644 --- a/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/ColumnChartRenderer.cs +++ b/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/ColumnChartRenderer.cs @@ -227,4 +227,4 @@ internal void InitSeries() } } } -} \ No newline at end of file +} diff --git a/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/ColumnDataLabelRenderer.cs b/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/ColumnDataLabelRenderer.cs index f7297b6f..3cb1f7da 100644 --- a/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/ColumnDataLabelRenderer.cs +++ b/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/ColumnDataLabelRenderer.cs @@ -157,4 +157,4 @@ internal override void CalcPositions() } } } -} \ No newline at end of file +} diff --git a/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/DataLabelRenderer.cs b/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/DataLabelRenderer.cs index d8a4977b..0e245f8d 100644 --- a/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/DataLabelRenderer.cs +++ b/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/DataLabelRenderer.cs @@ -105,4 +105,4 @@ internal override RendererInfo Init() /// internal abstract void CalcPositions(); } -} \ No newline at end of file +} diff --git a/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/LinePlotAreaRenderer.cs b/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/LinePlotAreaRenderer.cs index f658192a..ecc36d0a 100644 --- a/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/LinePlotAreaRenderer.cs +++ b/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/LinePlotAreaRenderer.cs @@ -62,8 +62,8 @@ internal override void Draw() //gfx.SetClip(plotAreaRect, XCombineMode.Intersect); gfx.IntersectClip(plotAreaRect); - //TODO null-Values müssen berücksichtigt werden. - // Verbindungspunkte können fehlen, je nachdem wie null-Values behandelt werden sollen. + //TODO null-Values m�ssen ber�cksichtigt werden. + // Verbindungspunkte k�nnen fehlen, je nachdem wie null-Values behandelt werden sollen. // (NotPlotted, Interpolate etc.) // Draw lines and markers for each data series. diff --git a/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/MarkerRenderer.cs b/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/MarkerRenderer.cs index 7d44b11d..0efd3e62 100644 --- a/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/MarkerRenderer.cs +++ b/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/MarkerRenderer.cs @@ -141,7 +141,7 @@ internal static void Draw(XGraphics graphics, XPoint pos, MarkerRendererInfo ren double outerCircle = size / 2; double innerCircle = size / 5; // outer circle - double rad = -(Math.PI / 2); // 90° + double rad = -(Math.PI / 2); // 90� for (int idx = 0; idx < 10; idx += 2) { points[idx].X = pos.X + outerCircle * Math.Cos(rad); @@ -150,7 +150,7 @@ internal static void Draw(XGraphics graphics, XPoint pos, MarkerRendererInfo ren } // inner circle - rad = -(Math.PI / 4); // 45° + rad = -(Math.PI / 4); // 45� double x = innerCircle * Math.Cos(rad); double y = innerCircle * Math.Sin(rad); points[1].X = pos.X + x; diff --git a/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/PieDataLabelRenderer.cs b/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/PieDataLabelRenderer.cs index 36330cd2..f7016c5c 100644 --- a/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/PieDataLabelRenderer.cs +++ b/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/PieDataLabelRenderer.cs @@ -182,4 +182,4 @@ internal override void CalcPositions() } } } -} \ No newline at end of file +} diff --git a/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/RendererParameters.cs b/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/RendererParameters.cs index 9997a3b2..9eac34e6 100644 --- a/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/RendererParameters.cs +++ b/PdfSharpCore.Charting/PdfSharp.Charting.Renderers/RendererParameters.cs @@ -105,4 +105,4 @@ public RendererInfo RendererInfo } RendererInfo rendererInfo; } -} \ No newline at end of file +} diff --git a/PdfSharpCore.Charting/PdfSharp.Charting/DataLabel.cs b/PdfSharpCore.Charting/PdfSharp.Charting/DataLabel.cs index 4e3d51b1..d907634c 100644 --- a/PdfSharpCore.Charting/PdfSharp.Charting/DataLabel.cs +++ b/PdfSharpCore.Charting/PdfSharp.Charting/DataLabel.cs @@ -137,4 +137,4 @@ public DataLabelType Type internal bool typeInitialized; #endregion } -} \ No newline at end of file +} diff --git a/PdfSharpCore.Charting/PdfSharp.Charting/DocumentObjectCollection.cs b/PdfSharpCore.Charting/PdfSharp.Charting/DocumentObjectCollection.cs index 90636fa5..e5ca358a 100644 --- a/PdfSharpCore.Charting/PdfSharp.Charting/DocumentObjectCollection.cs +++ b/PdfSharpCore.Charting/PdfSharp.Charting/DocumentObjectCollection.cs @@ -62,7 +62,7 @@ internal DocumentObjectCollection(DocumentObject parent) : base(parent) public virtual DocumentObject this[int index] { get {return this.elements[index] as DocumentObject;} - // TODO: überprüfen ob das erlaubt sein soll + // TODO: �berpr�fen ob das erlaubt sein soll set {this.elements[index] = value;} } diff --git a/PdfSharpCore.Charting/PdfSharp.Charting/LineFormat.cs b/PdfSharpCore.Charting/PdfSharp.Charting/LineFormat.cs index 0eb181b0..0449abb5 100644 --- a/PdfSharpCore.Charting/PdfSharp.Charting/LineFormat.cs +++ b/PdfSharpCore.Charting/PdfSharp.Charting/LineFormat.cs @@ -112,4 +112,4 @@ public LineStyle Style internal LineStyle style; #endregion } -} \ No newline at end of file +} diff --git a/PdfSharpCore.Charting/PdfSharp.Charting/SeriesElements.cs b/PdfSharpCore.Charting/PdfSharp.Charting/SeriesElements.cs index ae1a82f0..dfddbc03 100644 --- a/PdfSharpCore.Charting/PdfSharp.Charting/SeriesElements.cs +++ b/PdfSharpCore.Charting/PdfSharp.Charting/SeriesElements.cs @@ -95,4 +95,4 @@ public void Add(params double[] values) } #endregion } -} \ No newline at end of file +} diff --git a/PdfSharpCore.Test/CreateSimplePDF.cs b/PdfSharpCore.Test/CreateSimplePDF.cs index ce9a4d49..5dda3daa 100644 --- a/PdfSharpCore.Test/CreateSimplePDF.cs +++ b/PdfSharpCore.Test/CreateSimplePDF.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Text; using FluentAssertions; @@ -151,4 +151,4 @@ private string GetOutFilePath(string name) return Path.Combine(_rootPath, OutputDirName, name); } } -} \ No newline at end of file +} diff --git a/PdfSharpCore.Test/Helpers/TestData.cs b/PdfSharpCore.Test/Helpers/TestData.cs index c703e31c..23ad1922 100644 --- a/PdfSharpCore.Test/Helpers/TestData.cs +++ b/PdfSharpCore.Test/Helpers/TestData.cs @@ -1,4 +1,4 @@ -namespace PdfSharpCore.Test.Helpers +namespace PdfSharpCore.Test.Helpers { public static class TestData { @@ -19,4 +19,4 @@ public static class TestData Maecenas mollis sollicitudin felis at imperdiet. Duis dignissim purus quis interdum mattis. Nam sit amet quam quis enim hendrerit tincidunt. Aliquam euismod metus justo, non lobortis risus vehicula in. Pellentesque tempus, leo at placerat interdum, diam lectus gravida purus, id placerat justo quam nec mauris. Ut ullamcorper commodo dui in pretium. Suspendisse luctus mauris lacinia neque faucibus sollicitudin. Pellentesque ut ipsum metus. Quisque rutrum, risus eget feugiat vestibulum, enim nisl ornare risus, sit amet interdum arcu lacus at turpis. Mauris nec tristique massa. Curabitur diam urna, dapibus eget lorem porta, venenatis mattis justo. Sed eleifend accumsan lectus, id tempor metus semper in."; } -} \ No newline at end of file +} diff --git a/PdfSharpCore.Test/IO/IoBaseTest.cs b/PdfSharpCore.Test/IO/IoBaseTest.cs index 26742746..a64af56a 100644 --- a/PdfSharpCore.Test/IO/IoBaseTest.cs +++ b/PdfSharpCore.Test/IO/IoBaseTest.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Text; using FluentAssertions; using PdfSharpCore.Pdf; @@ -70,4 +70,4 @@ protected string GetOutFilePath(string name) return Path.Combine(_rootPath, _outputDirName, name); } } -} \ No newline at end of file +} diff --git a/PdfSharpCore.Test/IO/LargePDFReadWrite.cs b/PdfSharpCore.Test/IO/LargePDFReadWrite.cs index a83d8c43..d508bcca 100644 --- a/PdfSharpCore.Test/IO/LargePDFReadWrite.cs +++ b/PdfSharpCore.Test/IO/LargePDFReadWrite.cs @@ -1,4 +1,4 @@ -using PdfSharpCore.Drawing; +using PdfSharpCore.Drawing; using PdfSharpCore.Drawing.Layout; using PdfSharpCore.Pdf; using PdfSharpCore.Test.Helpers; @@ -56,4 +56,4 @@ private void AddAPage(PdfDocument document, XFont font) tf.DrawString(TestData.LoremIpsumText, font, XBrushes.Black, rect, XStringFormats.TopLeft); } } -} \ No newline at end of file +} diff --git a/PdfSharpCore.Test/IO/PdfReader.cs b/PdfSharpCore.Test/IO/PdfReader.cs index a8883625..2dcadc02 100644 --- a/PdfSharpCore.Test/IO/PdfReader.cs +++ b/PdfSharpCore.Test/IO/PdfReader.cs @@ -1,4 +1,4 @@ -using FluentAssertions; +using FluentAssertions; using PdfSharpCore.Pdf; using PdfSharpCore.Pdf.IO; using PdfSharpCore.Test.Helpers; @@ -34,4 +34,4 @@ internal static void AssertIsAValidPdfDocumentWithProperties(PdfDocument inputDo inputDocument.PageCount.Should().BeGreaterThan(0); } } -} \ No newline at end of file +} diff --git a/PdfSharpCore.Test/Merge.cs b/PdfSharpCore.Test/Merge.cs index e3bab0d7..0e82f35d 100644 --- a/PdfSharpCore.Test/Merge.cs +++ b/PdfSharpCore.Test/Merge.cs @@ -107,4 +107,4 @@ private static PdfDocument CreateTestDocumentWithImage(string imageFilename) return document; } } -} \ No newline at end of file +} diff --git a/PdfSharpCore.Test/Outlines/OutlineTests.cs b/PdfSharpCore.Test/Outlines/OutlineTests.cs index 0d39eba4..81601f45 100644 --- a/PdfSharpCore.Test/Outlines/OutlineTests.cs +++ b/PdfSharpCore.Test/Outlines/OutlineTests.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using FluentAssertions; using PdfSharpCore.Drawing; using PdfSharpCore.Pdf; @@ -41,4 +41,4 @@ public void CanCreateDocumentWithOutlines() ms.ToArray().Length.Should().BeGreaterThan(1); } } -} \ No newline at end of file +} diff --git a/PdfSharpCore.Test/PdfReader.cs b/PdfSharpCore.Test/PdfReader.cs index 0270c52f..6c9a6d84 100644 --- a/PdfSharpCore.Test/PdfReader.cs +++ b/PdfSharpCore.Test/PdfReader.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Reflection; using PdfSharpCore.Pdf; using PdfSharpCore.Pdf.IO; diff --git a/PdfSharpCore.Test/Pdfs/Content/Objects/CNameTests.cs b/PdfSharpCore.Test/Pdfs/Content/Objects/CNameTests.cs index 455b6978..1791e95d 100644 --- a/PdfSharpCore.Test/Pdfs/Content/Objects/CNameTests.cs +++ b/PdfSharpCore.Test/Pdfs/Content/Objects/CNameTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using FluentAssertions; using PdfSharpCore.Pdf.Content.Objects; using Xunit; @@ -41,4 +41,4 @@ public void SetNameWithoutPrefixThrowsException(string name) act.Should().Throw(); } } -} \ No newline at end of file +} diff --git a/PdfSharpCore.Test/Pdfs/PdfDateTests.cs b/PdfSharpCore.Test/Pdfs/PdfDateTests.cs index 5ed240d4..f4d348f6 100644 --- a/PdfSharpCore.Test/Pdfs/PdfDateTests.cs +++ b/PdfSharpCore.Test/Pdfs/PdfDateTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using FluentAssertions; using PdfSharpCore.Pdf; using Xunit; @@ -25,4 +25,4 @@ public void ParseDateString_WithNoOffset() pdfDate.Value.ToUniversalTime().Should().Be(expectedDateWithOffset.UtcDateTime); } } -} \ No newline at end of file +} diff --git a/PdfSharpCore.Test/Security/PdfSecurity.cs b/PdfSharpCore.Test/Security/PdfSecurity.cs index 328ba6cd..f7297005 100644 --- a/PdfSharpCore.Test/Security/PdfSecurity.cs +++ b/PdfSharpCore.Test/Security/PdfSecurity.cs @@ -1,4 +1,4 @@ -using FluentAssertions; +using FluentAssertions; using PdfSharpCore.Drawing; using PdfSharpCore.Pdf; using PdfSharpCore.Pdf.IO; @@ -123,4 +123,4 @@ public void CanReadPdfEncryptedWithSupportedAlgorithms(string fileName, string p output.WriteLine("Producer: {0}", doc.Info.Producer); } } -} \ No newline at end of file +} diff --git a/PdfSharpCore.sln b/PdfSharpCore.sln index 4a722d34..187e284e 100644 --- a/PdfSharpCore.sln +++ b/PdfSharpCore.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29911.84 +# Visual Studio Version 17 +VisualStudioVersion = 17.2.32519.379 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PdfSharpCore", "PdfSharpCore\PdfSharpCore.csproj", "{4005DEBC-75F8-48DA-BBCC-353E17872B3E}" EndProject @@ -20,6 +20,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PdfSharpCore.Test", "PdfSha EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleApp", "SampleApp\SampleApp.csproj", "{E2F17280-6C54-4711-AF1C-3286D2C45526}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SignatureTestConsole", "SignatureTestConsole\SignatureTestConsole.csproj", "{272E99C1-3210-497B-8CCE-D561E353FC13}" + ProjectSection(ProjectDependencies) = postProject + {4005DEBC-75F8-48DA-BBCC-353E17872B3E} = {4005DEBC-75F8-48DA-BBCC-353E17872B3E} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -46,6 +51,10 @@ Global {A862C0CE-C095-459C-A32B-8FCDD15A93BF}.Debug|Any CPU.Build.0 = Debug|Any CPU {A862C0CE-C095-459C-A32B-8FCDD15A93BF}.Release|Any CPU.ActiveCfg = Release|Any CPU {A862C0CE-C095-459C-A32B-8FCDD15A93BF}.Release|Any CPU.Build.0 = Release|Any CPU + {272E99C1-3210-497B-8CCE-D561E353FC13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {272E99C1-3210-497B-8CCE-D561E353FC13}.Debug|Any CPU.Build.0 = Debug|Any CPU + {272E99C1-3210-497B-8CCE-D561E353FC13}.Release|Any CPU.ActiveCfg = Release|Any CPU + {272E99C1-3210-497B-8CCE-D561E353FC13}.Release|Any CPU.Build.0 = Release|Any CPU {E2F17280-6C54-4711-AF1C-3286D2C45526}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E2F17280-6C54-4711-AF1C-3286D2C45526}.Debug|Any CPU.Build.0 = Debug|Any CPU {E2F17280-6C54-4711-AF1C-3286D2C45526}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/PdfSharpCore/!internal/Configuration.cs b/PdfSharpCore/!internal/Configuration.cs index fa4b1cf9..630d99e8 100644 --- a/PdfSharpCore/!internal/Configuration.cs +++ b/PdfSharpCore/!internal/Configuration.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange diff --git a/PdfSharpCore/!internal/DynamicallyAccessedMemberTypes.cs b/PdfSharpCore/!internal/DynamicallyAccessedMemberTypes.cs index 9c1369fb..8232cde4 100644 --- a/PdfSharpCore/!internal/DynamicallyAccessedMemberTypes.cs +++ b/PdfSharpCore/!internal/DynamicallyAccessedMemberTypes.cs @@ -1,4 +1,4 @@ -// Included in .net 5 and later +// Included in .net 5 and later #if !NET5_0_OR_GREATER // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. @@ -100,4 +100,4 @@ enum DynamicallyAccessedMemberTypes All = ~None } } -#endif \ No newline at end of file +#endif diff --git a/PdfSharpCore/!internal/DynamicallyAccessedMembersAttribute.cs b/PdfSharpCore/!internal/DynamicallyAccessedMembersAttribute.cs index b20b1015..f6b9756f 100644 --- a/PdfSharpCore/!internal/DynamicallyAccessedMembersAttribute.cs +++ b/PdfSharpCore/!internal/DynamicallyAccessedMembersAttribute.cs @@ -1,4 +1,4 @@ -// Included in .net 5 and later +// Included in .net 5 and later #if !NET5_0_OR_GREATER // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. @@ -56,4 +56,4 @@ public DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes member public DynamicallyAccessedMemberTypes MemberTypes { get; } } } -#endif \ No newline at end of file +#endif diff --git a/PdfSharpCore/Drawing.BarCodes/CodeBase.cs b/PdfSharpCore/Drawing.BarCodes/CodeBase.cs index 1989ea5c..dd01dabe 100644 --- a/PdfSharpCore/Drawing.BarCodes/CodeBase.cs +++ b/PdfSharpCore/Drawing.BarCodes/CodeBase.cs @@ -166,4 +166,4 @@ public Delta(int x, int y) { new Delta(-2, -2), new Delta(-1, -2), new Delta(0, -2), new Delta(-2, -1), new Delta(-1, -1), new Delta(0, -1), new Delta(-2, 0), new Delta(-1, 0), new Delta(0, 0) }, }; } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Drawing.BarCodes/enums/CodeDirection.cs b/PdfSharpCore/Drawing.BarCodes/enums/CodeDirection.cs index b6eadf47..d1949b30 100644 --- a/PdfSharpCore/Drawing.BarCodes/enums/CodeDirection.cs +++ b/PdfSharpCore/Drawing.BarCodes/enums/CodeDirection.cs @@ -40,17 +40,17 @@ public enum CodeDirection LeftToRight, /// - /// Rotates the code 180° at the anchor position. + /// Rotates the code 180� at the anchor position. /// BottomToTop, /// - /// Rotates the code 180° at the anchor position. + /// Rotates the code 180� at the anchor position. /// RightToLeft, /// - /// Rotates the code 180° at the anchor position. + /// Rotates the code 180� at the anchor position. /// TopToBottom, } diff --git a/PdfSharpCore/Drawing.BarCodes/enums/MarkDistance.cs b/PdfSharpCore/Drawing.BarCodes/enums/MarkDistance.cs index 5027aafd..0b417c6e 100644 --- a/PdfSharpCore/Drawing.BarCodes/enums/MarkDistance.cs +++ b/PdfSharpCore/Drawing.BarCodes/enums/MarkDistance.cs @@ -47,4 +47,4 @@ namespace PdfSharpCore.Drawing.BarCodes // /// // Inch2_8 //} -} \ No newline at end of file +} diff --git a/PdfSharpCore/Drawing.Internal/IImageImporter.cs b/PdfSharpCore/Drawing.Internal/IImageImporter.cs index ec39b82e..23a7eb01 100644 --- a/PdfSharpCore/Drawing.Internal/IImageImporter.cs +++ b/PdfSharpCore/Drawing.Internal/IImageImporter.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Thomas Hövel diff --git a/PdfSharpCore/Drawing.Internal/ImageImporter.cs b/PdfSharpCore/Drawing.Internal/ImageImporter.cs index 24b21d16..bbe3fab5 100644 --- a/PdfSharpCore/Drawing.Internal/ImageImporter.cs +++ b/PdfSharpCore/Drawing.Internal/ImageImporter.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Thomas Hövel diff --git a/PdfSharpCore/Drawing.Internal/ImageImporterBmp.cs b/PdfSharpCore/Drawing.Internal/ImageImporterBmp.cs index 05dedb84..0b1c8c92 100644 --- a/PdfSharpCore/Drawing.Internal/ImageImporterBmp.cs +++ b/PdfSharpCore/Drawing.Internal/ImageImporterBmp.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Thomas Hövel diff --git a/PdfSharpCore/Drawing.Internal/ImageImporterJpeg.cs b/PdfSharpCore/Drawing.Internal/ImageImporterJpeg.cs index 884c2374..5129727d 100644 --- a/PdfSharpCore/Drawing.Internal/ImageImporterJpeg.cs +++ b/PdfSharpCore/Drawing.Internal/ImageImporterJpeg.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Thomas Hövel diff --git a/PdfSharpCore/Drawing.Internal/ImageImporterRoot.cs b/PdfSharpCore/Drawing.Internal/ImageImporterRoot.cs index 23748298..ce2a2cb6 100644 --- a/PdfSharpCore/Drawing.Internal/ImageImporterRoot.cs +++ b/PdfSharpCore/Drawing.Internal/ImageImporterRoot.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Thomas Hövel diff --git a/PdfSharpCore/Drawing.Layout/Block.cs b/PdfSharpCore/Drawing.Layout/Block.cs index f2507ec1..a2c02a39 100644 --- a/PdfSharpCore/Drawing.Layout/Block.cs +++ b/PdfSharpCore/Drawing.Layout/Block.cs @@ -1,4 +1,4 @@ -using PdfSharpCore.Drawing.Layout.enums; +using PdfSharpCore.Drawing.Layout.enums; namespace PdfSharpCore.Drawing.Layout { @@ -79,4 +79,4 @@ public Block(BlockType type) /// public bool NextBlockBelongsToMe { get; set; } } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Drawing.Layout/FormatterEnvironment.cs b/PdfSharpCore/Drawing.Layout/FormatterEnvironment.cs index c79fd433..d3e5569f 100644 --- a/PdfSharpCore/Drawing.Layout/FormatterEnvironment.cs +++ b/PdfSharpCore/Drawing.Layout/FormatterEnvironment.cs @@ -1,4 +1,4 @@ -namespace PdfSharpCore.Drawing.Layout +namespace PdfSharpCore.Drawing.Layout { internal class FormatterEnvironment { @@ -10,4 +10,4 @@ internal class FormatterEnvironment public double CyDescent { get; set; } public double SpaceWidth { get; set; } } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Drawing.Layout/TextSegment.cs b/PdfSharpCore/Drawing.Layout/TextSegment.cs index 364bffab..2a9928c7 100644 --- a/PdfSharpCore/Drawing.Layout/TextSegment.cs +++ b/PdfSharpCore/Drawing.Layout/TextSegment.cs @@ -1,4 +1,4 @@ -namespace PdfSharpCore.Drawing.Layout +namespace PdfSharpCore.Drawing.Layout { public class TextSegment { @@ -13,4 +13,4 @@ public class TextSegment public double CyDescent { get; set; } public double SpaceWidth { get; set; } } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Drawing.Layout/XTextSegmentFormatter.cs b/PdfSharpCore/Drawing.Layout/XTextSegmentFormatter.cs index 87f045a7..ca461e51 100644 --- a/PdfSharpCore/Drawing.Layout/XTextSegmentFormatter.cs +++ b/PdfSharpCore/Drawing.Layout/XTextSegmentFormatter.cs @@ -1,4 +1,4 @@ -using PdfSharpCore.Drawing.Layout.enums; +using PdfSharpCore.Drawing.Layout.enums; using PdfSharpCore.Pdf.IO; using System; using System.Collections.Generic; @@ -638,4 +638,4 @@ private void SetFontSpacings(TextSegment segment) // - super- and sub-script // - ... } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Drawing.Layout/enums/BlockType.cs b/PdfSharpCore/Drawing.Layout/enums/BlockType.cs index 97ce875f..edcbdeaf 100644 --- a/PdfSharpCore/Drawing.Layout/enums/BlockType.cs +++ b/PdfSharpCore/Drawing.Layout/enums/BlockType.cs @@ -1,7 +1,7 @@ -namespace PdfSharpCore.Drawing.Layout.enums +namespace PdfSharpCore.Drawing.Layout.enums { internal enum BlockType { Text, Space, Hyphen, LineBreak, } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Drawing.Pdf/XGraphicsPdfRenderer.cs b/PdfSharpCore/Drawing.Pdf/XGraphicsPdfRenderer.cs index 62e53fcf..f7a4b1be 100644 --- a/PdfSharpCore/Drawing.Pdf/XGraphicsPdfRenderer.cs +++ b/PdfSharpCore/Drawing.Pdf/XGraphicsPdfRenderer.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange @@ -1788,4 +1788,4 @@ PdfGraphicsState RestoreState(InternalGraphicsState state) /// public XMatrix DefaultViewMatrix; } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Drawing.Pdf/enums/DirtyFlags.cs b/PdfSharpCore/Drawing.Pdf/enums/DirtyFlags.cs index c3669073..964a2bc5 100644 --- a/PdfSharpCore/Drawing.Pdf/enums/DirtyFlags.cs +++ b/PdfSharpCore/Drawing.Pdf/enums/DirtyFlags.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange diff --git a/PdfSharpCore/Drawing.Pdf/enums/StreamMode.cs b/PdfSharpCore/Drawing.Pdf/enums/StreamMode.cs index 73dce95e..d89d096c 100644 --- a/PdfSharpCore/Drawing.Pdf/enums/StreamMode.cs +++ b/PdfSharpCore/Drawing.Pdf/enums/StreamMode.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange diff --git a/PdfSharpCore/Drawing/CoreGraphicsPath.cs b/PdfSharpCore/Drawing/CoreGraphicsPath.cs index 8e94e0b1..ca9578b1 100644 --- a/PdfSharpCore/Drawing/CoreGraphicsPath.cs +++ b/PdfSharpCore/Drawing/CoreGraphicsPath.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange diff --git a/PdfSharpCore/Drawing/GeometryHelper.cs b/PdfSharpCore/Drawing/GeometryHelper.cs index 4f8e30f7..9f5e8c7d 100644 --- a/PdfSharpCore/Drawing/GeometryHelper.cs +++ b/PdfSharpCore/Drawing/GeometryHelper.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange @@ -314,4 +314,4 @@ public static List BezierCurveFromArc(XPoint point1, XPoint point2, XSiz α / Calc.Deg2Rad, sweepAngle / Calc.Deg2Rad, pathStart, ref matrix); } } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Drawing/GraphicsStateStack.cs b/PdfSharpCore/Drawing/GraphicsStateStack.cs index 676b9c5b..1c88cd46 100644 --- a/PdfSharpCore/Drawing/GraphicsStateStack.cs +++ b/PdfSharpCore/Drawing/GraphicsStateStack.cs @@ -88,4 +88,4 @@ public InternalGraphicsState Current readonly Stack _stack = new Stack(); } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Drawing/IXGraphicsRenderer.cs b/PdfSharpCore/Drawing/IXGraphicsRenderer.cs index 63c17c22..1fb7c4c7 100644 --- a/PdfSharpCore/Drawing/IXGraphicsRenderer.cs +++ b/PdfSharpCore/Drawing/IXGraphicsRenderer.cs @@ -49,12 +49,12 @@ public interface IXGraphicsRenderer void DrawLines(XPen pen, XPoint[] points); /// - /// Draws a Bézier spline. + /// Draws a B�zier spline. /// void DrawBezier(XPen pen, double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4); /// - /// Draws a series of Bézier splines. + /// Draws a series of B�zier splines. /// void DrawBeziers(XPen pen, XPoint[] points); diff --git a/PdfSharpCore/Drawing/ImageSource.cs b/PdfSharpCore/Drawing/ImageSource.cs index 32d9e84c..aaccdbbe 100644 --- a/PdfSharpCore/Drawing/ImageSource.cs +++ b/PdfSharpCore/Drawing/ImageSource.cs @@ -1,4 +1,4 @@ - + using System; using System.Collections.Generic; using System.IO; diff --git a/PdfSharpCore/Drawing/XBaseGradientBrush.cs b/PdfSharpCore/Drawing/XBaseGradientBrush.cs index a58421bf..52bebf7e 100644 --- a/PdfSharpCore/Drawing/XBaseGradientBrush.cs +++ b/PdfSharpCore/Drawing/XBaseGradientBrush.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Ben Askren diff --git a/PdfSharpCore/Drawing/XColorResourceManager.cs b/PdfSharpCore/Drawing/XColorResourceManager.cs index b944acff..c3505b5f 100644 --- a/PdfSharpCore/Drawing/XColorResourceManager.cs +++ b/PdfSharpCore/Drawing/XColorResourceManager.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange @@ -348,4 +348,4 @@ public ColorResourceInfo(XKnownColor knownColor, XColor color, uint argb, string public string NameDE; } } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Drawing/XConvert.cs b/PdfSharpCore/Drawing/XConvert.cs index a9bf992f..d11f61e5 100644 --- a/PdfSharpCore/Drawing/XConvert.cs +++ b/PdfSharpCore/Drawing/XConvert.cs @@ -35,4 +35,4 @@ namespace PdfSharpCore.Drawing internal static class XConvert { } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Drawing/XFontWeights.cs b/PdfSharpCore/Drawing/XFontWeights.cs index 462671e7..55ca9653 100644 --- a/PdfSharpCore/Drawing/XFontWeights.cs +++ b/PdfSharpCore/Drawing/XFontWeights.cs @@ -306,4 +306,4 @@ public static XFontWeight UltraBlack } } #endif -} \ No newline at end of file +} diff --git a/PdfSharpCore/Drawing/XGraphics.cs b/PdfSharpCore/Drawing/XGraphics.cs index 26dfc628..c11e51b5 100644 --- a/PdfSharpCore/Drawing/XGraphics.cs +++ b/PdfSharpCore/Drawing/XGraphics.cs @@ -37,7 +37,7 @@ // ReSharper disable RedundantNameQualifier // ReSharper disable UseNameofExpression -namespace PdfSharpCore.Drawing // #??? aufräumen +namespace PdfSharpCore.Drawing // #??? aufr�umen { /// /// Holds information about the current state of the XGraphics object. @@ -530,7 +530,7 @@ public void DrawLines(XPen pen, double x, double y, params double[] value) // ----- DrawBezier --------------------------------------------------------------------------- /// - /// Draws a Bézier spline defined by four points. + /// Draws a B�zier spline defined by four points. /// public void DrawBezier(XPen pen, XPoint pt1, XPoint pt2, XPoint pt3, XPoint pt4) { @@ -538,7 +538,7 @@ public void DrawBezier(XPen pen, XPoint pt1, XPoint pt2, XPoint pt3, XPoint pt4) } /// - /// Draws a Bézier spline defined by four points. + /// Draws a B�zier spline defined by four points. /// public void DrawBezier(XPen pen, double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4) @@ -554,7 +554,7 @@ public void DrawBezier(XPen pen, double x1, double y1, double x2, double y2, // ----- DrawBeziers -------------------------------------------------------------------------- /// - /// Draws a series of Bézier splines from an array of points. + /// Draws a series of B�zier splines from an array of points. /// public void DrawBeziers(XPen pen, XPoint[] points) { diff --git a/PdfSharpCore/Drawing/XGraphicsPath.cs b/PdfSharpCore/Drawing/XGraphicsPath.cs index aa3af3a7..c75ae3df 100644 --- a/PdfSharpCore/Drawing/XGraphicsPath.cs +++ b/PdfSharpCore/Drawing/XGraphicsPath.cs @@ -502,4 +502,4 @@ public XGraphicsPathInternals Internals /// internal CoreGraphicsPath _corePath; } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Drawing/XGraphicsPathInternals.cs b/PdfSharpCore/Drawing/XGraphicsPathInternals.cs index 7ebff46d..2922b44c 100644 --- a/PdfSharpCore/Drawing/XGraphicsPathInternals.cs +++ b/PdfSharpCore/Drawing/XGraphicsPathInternals.cs @@ -53,4 +53,4 @@ internal XGraphicsPathInternals(XGraphicsPath path) } XGraphicsPath _path; } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Drawing/XImageFormat.cs b/PdfSharpCore/Drawing/XImageFormat.cs index 284d04c2..2c1c4ee7 100644 --- a/PdfSharpCore/Drawing/XImageFormat.cs +++ b/PdfSharpCore/Drawing/XImageFormat.cs @@ -138,4 +138,4 @@ public static XImageFormat Icon // not GDI+ conform private static readonly XImageFormat _pdf = new XImageFormat(new Guid("{84570158-DBF0-4C6B-8368-62D6A3CA76E0}")); } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Drawing/XLinearGradientBrush.cs b/PdfSharpCore/Drawing/XLinearGradientBrush.cs index 28856f4f..186491cb 100644 --- a/PdfSharpCore/Drawing/XLinearGradientBrush.cs +++ b/PdfSharpCore/Drawing/XLinearGradientBrush.cs @@ -79,4 +79,4 @@ public XLinearGradientBrush(XRect rect, XColor color1, XColor color2, XLinearGra internal XRect _rect; internal XLinearGradientMode _linearGradientMode; } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Drawing/XMatrix.cs b/PdfSharpCore/Drawing/XMatrix.cs index 4605e9eb..9c37c6ee 100644 --- a/PdfSharpCore/Drawing/XMatrix.cs +++ b/PdfSharpCore/Drawing/XMatrix.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange diff --git a/PdfSharpCore/Drawing/XPen.cs b/PdfSharpCore/Drawing/XPen.cs index eef2a954..ee29f2a0 100644 --- a/PdfSharpCore/Drawing/XPen.cs +++ b/PdfSharpCore/Drawing/XPen.cs @@ -290,4 +290,4 @@ public bool Overprint bool _dirty = true; readonly bool _immutable; } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Drawing/XRadialGradientBrush.cs b/PdfSharpCore/Drawing/XRadialGradientBrush.cs index 168ba7ea..c1114810 100644 --- a/PdfSharpCore/Drawing/XRadialGradientBrush.cs +++ b/PdfSharpCore/Drawing/XRadialGradientBrush.cs @@ -66,4 +66,4 @@ public XRadialGradientBrush(XPoint center, double r1, double r2, XColor color1, internal XPoint _center1, _center2; internal double _r1, _r2; } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Drawing/XStringFormats.cs b/PdfSharpCore/Drawing/XStringFormats.cs index 4bf943f3..cdc2f1cd 100644 --- a/PdfSharpCore/Drawing/XStringFormats.cs +++ b/PdfSharpCore/Drawing/XStringFormats.cs @@ -224,4 +224,4 @@ public static XStringFormat BottomRight } } } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Drawing/XUnit.cs b/PdfSharpCore/Drawing/XUnit.cs index 92628a2f..e4a59f4b 100644 --- a/PdfSharpCore/Drawing/XUnit.cs +++ b/PdfSharpCore/Drawing/XUnit.cs @@ -590,4 +590,4 @@ string DebuggerDisplay } } } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Drawing/enums/XGdiFontStyle.cs b/PdfSharpCore/Drawing/enums/XGdiFontStyle.cs index ad458e46..34a33f85 100644 --- a/PdfSharpCore/Drawing/enums/XGdiFontStyle.cs +++ b/PdfSharpCore/Drawing/enums/XGdiFontStyle.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange diff --git a/PdfSharpCore/Exceptions/PositionNotFoundException.cs b/PdfSharpCore/Exceptions/PositionNotFoundException.cs index 578d2b94..a5e3d4ea 100644 --- a/PdfSharpCore/Exceptions/PositionNotFoundException.cs +++ b/PdfSharpCore/Exceptions/PositionNotFoundException.cs @@ -1,4 +1,4 @@ -using PdfSharpCore.Pdf; +using PdfSharpCore.Pdf; namespace PdfSharpCore.Exceptions { diff --git a/PdfSharpCore/Fonts.OpenType/FontDescriptor.cs b/PdfSharpCore/Fonts.OpenType/FontDescriptor.cs index bfaf9a5a..f5758624 100644 --- a/PdfSharpCore/Fonts.OpenType/FontDescriptor.cs +++ b/PdfSharpCore/Fonts.OpenType/FontDescriptor.cs @@ -383,4 +383,4 @@ internal static string ComputeKey(string name) return key; } } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Fonts.OpenType/GlyphDataTable.cs b/PdfSharpCore/Fonts.OpenType/GlyphDataTable.cs index 28b22c5e..01250639 100644 Binary files a/PdfSharpCore/Fonts.OpenType/GlyphDataTable.cs and b/PdfSharpCore/Fonts.OpenType/GlyphDataTable.cs differ diff --git a/PdfSharpCore/Fonts.OpenType/IndexToLocationTable.cs b/PdfSharpCore/Fonts.OpenType/IndexToLocationTable.cs index 1e3ac5c5..d6f8c143 100644 Binary files a/PdfSharpCore/Fonts.OpenType/IndexToLocationTable.cs and b/PdfSharpCore/Fonts.OpenType/IndexToLocationTable.cs differ diff --git a/PdfSharpCore/Fonts.OpenType/OpenTypeFontTables.cs b/PdfSharpCore/Fonts.OpenType/OpenTypeFontTables.cs index 04285922..83a5ad2e 100644 Binary files a/PdfSharpCore/Fonts.OpenType/OpenTypeFontTables.cs and b/PdfSharpCore/Fonts.OpenType/OpenTypeFontTables.cs differ diff --git a/PdfSharpCore/Fonts.OpenType/OpenTypeFontface.cs b/PdfSharpCore/Fonts.OpenType/OpenTypeFontface.cs index 33778b32..d89118f1 100644 Binary files a/PdfSharpCore/Fonts.OpenType/OpenTypeFontface.cs and b/PdfSharpCore/Fonts.OpenType/OpenTypeFontface.cs differ diff --git a/PdfSharpCore/Fonts.OpenType/TableDirectoryEntry.cs b/PdfSharpCore/Fonts.OpenType/TableDirectoryEntry.cs index 172aebab..02914176 100644 Binary files a/PdfSharpCore/Fonts.OpenType/TableDirectoryEntry.cs and b/PdfSharpCore/Fonts.OpenType/TableDirectoryEntry.cs differ diff --git a/PdfSharpCore/Fonts.OpenType/enums/TableTagNames.cs b/PdfSharpCore/Fonts.OpenType/enums/TableTagNames.cs index 261b7be9..b9449b7f 100644 --- a/PdfSharpCore/Fonts.OpenType/enums/TableTagNames.cs +++ b/PdfSharpCore/Fonts.OpenType/enums/TableTagNames.cs @@ -208,4 +208,4 @@ static class TableTagNames /// public const string VMtx = "vmtx"; } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Fonts/AdobeGlyphList20.cs b/PdfSharpCore/Fonts/AdobeGlyphList20.cs index 2141efd4..66834542 100644 --- a/PdfSharpCore/Fonts/AdobeGlyphList20.cs +++ b/PdfSharpCore/Fonts/AdobeGlyphList20.cs @@ -4322,4 +4322,4 @@ namespace PdfSharpCore.Fonts } } -#endif \ No newline at end of file +#endif diff --git a/PdfSharpCore/Fonts/FontResolverInfo.cs b/PdfSharpCore/Fonts/FontResolverInfo.cs index f4117f9b..f61a7be0 100644 --- a/PdfSharpCore/Fonts/FontResolverInfo.cs +++ b/PdfSharpCore/Fonts/FontResolverInfo.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange diff --git a/PdfSharpCore/Fonts/FontResolvingOptions.cs b/PdfSharpCore/Fonts/FontResolvingOptions.cs index fe110d73..69dc9d1f 100644 --- a/PdfSharpCore/Fonts/FontResolvingOptions.cs +++ b/PdfSharpCore/Fonts/FontResolvingOptions.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange diff --git a/PdfSharpCore/Fonts/GlobalFontSettings.cs b/PdfSharpCore/Fonts/GlobalFontSettings.cs index f223842c..f67ed069 100644 --- a/PdfSharpCore/Fonts/GlobalFontSettings.cs +++ b/PdfSharpCore/Fonts/GlobalFontSettings.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange @@ -125,4 +125,4 @@ public static PdfFontEncoding DefaultFontEncoding static PdfFontEncoding _fontEncoding; static bool _fontEncodingInitialized; } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Fonts/IFontResolver.cs b/PdfSharpCore/Fonts/IFontResolver.cs index 100d1072..76fbaf61 100644 --- a/PdfSharpCore/Fonts/IFontResolver.cs +++ b/PdfSharpCore/Fonts/IFontResolver.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange @@ -53,4 +53,4 @@ public interface IFontResolver string DefaultFontName { get; } } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Fonts/PlatformFontResolverInfo.cs b/PdfSharpCore/Fonts/PlatformFontResolverInfo.cs index 4bf1d858..2bc958c1 100644 --- a/PdfSharpCore/Fonts/PlatformFontResolverInfo.cs +++ b/PdfSharpCore/Fonts/PlatformFontResolverInfo.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange diff --git a/PdfSharpCore/Internal/DoubleUtil.cs b/PdfSharpCore/Internal/DoubleUtil.cs index ed961b38..e4e3e6d1 100644 --- a/PdfSharpCore/Internal/DoubleUtil.cs +++ b/PdfSharpCore/Internal/DoubleUtil.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Microsoft diff --git a/PdfSharpCore/Internal/FontFamilyModel.cs b/PdfSharpCore/Internal/FontFamilyModel.cs index 02d326c9..ddfe8c8c 100644 --- a/PdfSharpCore/Internal/FontFamilyModel.cs +++ b/PdfSharpCore/Internal/FontFamilyModel.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using PdfSharpCore.Drawing; namespace PdfSharpCore.Internal diff --git a/PdfSharpCore/Internal/TokenizerHelper.cs b/PdfSharpCore/Internal/TokenizerHelper.cs index 35f3b63d..a9cce4ed 100644 --- a/PdfSharpCore/Internal/TokenizerHelper.cs +++ b/PdfSharpCore/Internal/TokenizerHelper.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Microsoft @@ -252,4 +252,4 @@ public bool FoundSeparator string _str; int _strLen; } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Pdf.AcroForms/PdfAcroField.cs b/PdfSharpCore/Pdf.AcroForms/PdfAcroField.cs index ad8f1843..13b45cd0 100644 --- a/PdfSharpCore/Pdf.AcroForms/PdfAcroField.cs +++ b/PdfSharpCore/Pdf.AcroForms/PdfAcroField.cs @@ -486,7 +486,7 @@ public class Keys : KeysBase /// (Optional; PDF 1.3) An alternate field name, to be used in place of the actual /// field name wherever the field must be identified in the user interface (such as /// in error or status messages referring to the field). This text is also useful - /// when extracting the document’s contents in support of accessibility to disabled + /// when extracting the document�s contents in support of accessibility to disabled /// users or for other purposes. /// [KeyInfo(KeyType.TextString | KeyType.Optional)] @@ -507,7 +507,7 @@ public class Keys : KeysBase public const string Ff = "/Ff"; /// - /// (Optional; inheritable) The field’s value, whose format varies depending on + /// (Optional; inheritable) The field�s value, whose format varies depending on /// the field type; see the descriptions of individual field types for further information. /// [KeyInfo(KeyType.Various | KeyType.Optional)] @@ -521,7 +521,7 @@ public class Keys : KeysBase public const string DV = "/DV"; /// - /// (Optional; PDF 1.2) An additional-actions dictionary defining the field’s behavior + /// (Optional; PDF 1.2) An additional-actions dictionary defining the field�s behavior /// in response to various trigger events. This entry has exactly the same meaning as /// the AA entry in an annotation dictionary. /// @@ -534,7 +534,7 @@ public class Keys : KeysBase /// (Required; inheritable) A resource dictionary containing default resources /// (such as fonts, patterns, or color spaces) to be used by the appearance stream. /// At a minimum, this dictionary must contain a Font entry specifying the resource - /// name and font dictionary of the default font for displaying the field’s text. + /// name and font dictionary of the default font for displaying the field�s text. /// [KeyInfo(KeyType.Dictionary | KeyType.Required)] public const string DR = "/DR"; @@ -542,7 +542,7 @@ public class Keys : KeysBase /// /// (Required; inheritable) The default appearance string, containing a sequence of /// valid page-content graphics or text state operators defining such properties as - /// the field’s text size and color. + /// the field�s text size and color. /// [KeyInfo(KeyType.String | KeyType.Required)] public const string DA = "/DA"; diff --git a/PdfSharpCore/Pdf.AcroForms/PdfAcroForm.cs b/PdfSharpCore/Pdf.AcroForms/PdfAcroForm.cs index 20888f49..96350884 100644 --- a/PdfSharpCore/Pdf.AcroForms/PdfAcroForm.cs +++ b/PdfSharpCore/Pdf.AcroForms/PdfAcroForm.cs @@ -74,7 +74,7 @@ public sealed class Keys : KeysBase // ReSharper disable InconsistentNaming /// - /// (Required) An array of references to the document’s root fields (those with + /// (Required) An array of references to the document�s root fields (those with /// no ancestors in the field hierarchy). /// [KeyInfo(KeyType.Array | KeyType.Required, typeof(PdfAcroField.PdfAcroFieldCollection))] diff --git a/PdfSharpCore/Pdf.AcroForms/PdfCheckBoxField.cs b/PdfSharpCore/Pdf.AcroForms/PdfCheckBoxField.cs index d2d0146d..dbf1139f 100644 --- a/PdfSharpCore/Pdf.AcroForms/PdfCheckBoxField.cs +++ b/PdfSharpCore/Pdf.AcroForms/PdfCheckBoxField.cs @@ -68,7 +68,7 @@ public bool Checked //R080317 // TODO if (Fields.Elements.Items.Length == 2) { string value = ((PdfDictionary)(((PdfReference)(Fields.Elements.Items[0])).Value)).Elements.GetString(Keys.V); - //bool bReturn = value.Length != 0 && value != UncheckedValue; //R081114 (3Std.!!) auch auf Nein prüfen; //TODO woher kommt der Wert? + //bool bReturn = value.Length != 0 && value != UncheckedValue; //R081114 (3Std.!!) auch auf Nein pr�fen; //TODO woher kommt der Wert? bool bReturn = value.Length != 0 && value == CheckedName; return bReturn; } @@ -217,7 +217,7 @@ public bool Checked if (Fields.Elements.Items.Length == 2) { string value = ((PdfDictionary)(((PdfReference)(Fields.Elements.Items[0])).Value)).Elements.GetString(Keys.V); - bool bReturn = value.Length != 0 && value != "/Off" && value != "/Nein"; //R081114 (3Std.!!) auch auf Nein prüfen; //TODO woher kommt der Wert? + bool bReturn = value.Length != 0 && value != "/Off" && value != "/Nein"; //R081114 (3Std.!!) auch auf Nein pr�fen; //TODO woher kommt der Wert? return bReturn; } else diff --git a/PdfSharpCore/Pdf.AcroForms/PdfChoiceField.cs b/PdfSharpCore/Pdf.AcroForms/PdfChoiceField.cs index 1896733e..6aef6c3d 100644 --- a/PdfSharpCore/Pdf.AcroForms/PdfChoiceField.cs +++ b/PdfSharpCore/Pdf.AcroForms/PdfChoiceField.cs @@ -64,7 +64,7 @@ protected int IndexInOptArray(string value) opt2 = Elements[Keys.Opt] as PdfArray; else if (Elements[Keys.Opt] is Advanced.PdfReference) { - //falls das Array nicht direkt am Element hängt, + //falls das Array nicht direkt am Element h�ngt, //das Array aus dem referenzierten Element holen opt2 = ((Advanced.PdfReference)Elements[Keys.Opt]).Value as PdfArray; } @@ -134,7 +134,7 @@ protected string ValueInOptArray(int index) /// (Required; inheritable) An array of options to be presented to the user. Each element of /// the array is either a text string representing one of the available options or a two-element /// array consisting of a text string together with a default appearance string for constructing - /// the item’s appearance dynamically at viewing time. + /// the item�s appearance dynamically at viewing time. /// [KeyInfo(KeyType.Array | KeyType.Optional)] public const string Opt = "/Opt"; diff --git a/PdfSharpCore/Pdf.AcroForms/PdfComboBoxField.cs b/PdfSharpCore/Pdf.AcroForms/PdfComboBoxField.cs index 0fc51c64..5b842505 100644 --- a/PdfSharpCore/Pdf.AcroForms/PdfComboBoxField.cs +++ b/PdfSharpCore/Pdf.AcroForms/PdfComboBoxField.cs @@ -64,7 +64,7 @@ public int SelectedIndex { string key = ValueInOptArray(value); Elements.SetString(Keys.V, key); - Elements.SetInteger("/I", value); //R080304 !!!!!!! sonst reagiert die Combobox überhaupt nicht !!!!! + Elements.SetInteger("/I", value); //R080304 !!!!!!! sonst reagiert die Combobox �berhaupt nicht !!!!! } } } @@ -89,7 +89,7 @@ public override PdfItem Value //R080304 //R080317 noch nicht rund try { - //anhängen + //anh�ngen ((PdfArray)(((PdfItem[])(Elements.Values))[2])).Elements.Add(Value); SelectedIndex = SelectedIndex; } diff --git a/PdfSharpCore/Pdf.AcroForms/PdfSignatureField.cs b/PdfSharpCore/Pdf.AcroForms/PdfSignatureField.cs index 3ce237f1..bcb04f72 100644 --- a/PdfSharpCore/Pdf.AcroForms/PdfSignatureField.cs +++ b/PdfSharpCore/Pdf.AcroForms/PdfSignatureField.cs @@ -27,6 +27,11 @@ // DEALINGS IN THE SOFTWARE. #endregion +using PdfSharpCore.Drawing; +using PdfSharpCore.Pdf.Annotations; +using PdfSharpCore.Pdf.Signatures; +using System; + namespace PdfSharpCore.Pdf.AcroForms { /// @@ -34,17 +39,144 @@ namespace PdfSharpCore.Pdf.AcroForms /// public sealed class PdfSignatureField : PdfAcroField { + public string Reason + { + get + { + return Elements.GetDictionary(Keys.V).Elements.GetString(Keys.Reason); + } + set + { + Elements.GetDictionary(Keys.V).Elements[Keys.Reason] = new PdfString(value); + } + } + + public string Location + { + get + { + return Elements.GetDictionary(Keys.V).Elements.GetString(Keys.Location); + } + set + { + Elements.GetDictionary(Keys.V).Elements[Keys.Location] = new PdfString(value); + } + } + + public PdfItem Contents + { + get + { + return Elements.GetDictionary(Keys.V)?.Elements[Keys.Contents]; + } + set + { + if (!Elements.ContainsKey(Keys.V)) + { + PdfDictionary sign = new PdfDictionary(_document); + sign.Elements.Add(Keys.Type, new PdfName("/Sig")); + sign.Elements.Add(Keys.Filter, new PdfName("/Adobe.PPKLite")); + sign.Elements.Add(Keys.SubFilter, new PdfName("/adbe.pkcs7.detached")); + sign.Elements.Add(Keys.M, new PdfDate(DateTime.Now)); + + _document._irefTable.Add(sign); + + Elements.Add(Keys.V, sign); + } + + Elements.GetDictionary(Keys.V).Elements[Keys.Contents] = value; + } + } + + + public PdfItem ByteRange + { + get + { + return Elements.GetDictionary(Keys.V).Elements[Keys.ByteRange]; + } + set + { + Elements.GetDictionary(Keys.V).Elements[Keys.ByteRange] = value; + } + } + + + public PdfRectangle Rectangle + { + get + { + return Elements.GetRectangle(Keys.Rect); + } + set + { + Elements[Keys.Rect] = value; + } + } + + public bool IsVisible => Rectangle.Size.Width > 0 && Rectangle.Size.Height > 0; + + /// /// Initializes a new instance of PdfSignatureField. /// - internal PdfSignatureField(PdfDocument document) - : base(document) - { } + internal PdfSignatureField(PdfDocument document) : base(document) + { + + + Elements.Add(Keys.FT, new PdfName("/Sig")); + Elements.Add(Keys.T, new PdfString("Signature1")); + Elements.Add(Keys.Ff, new PdfInteger(132)); + Elements.Add(Keys.DR, new PdfDictionary()); + Elements.Add(Keys.Type, new PdfName("/Annot")); + Elements.Add(Keys.Subtype, new PdfName("/Widget")); + Elements.Add(Keys.P, document.Pages[0]); + + + PdfDictionary sign = new PdfDictionary(document); + sign.Elements.Add(Keys.Type, new PdfName("/Sig")); + sign.Elements.Add(Keys.Filter, new PdfName("/Adobe.PPKLite")); + sign.Elements.Add(Keys.SubFilter, new PdfName("/adbe.pkcs7.detached")); + sign.Elements.Add(Keys.M, new PdfDate(DateTime.Now)); + + document._irefTable.Add(sign); + document._irefTable.Add(this); + + Elements.Add(Keys.V, sign); + + } internal PdfSignatureField(PdfDictionary dict) : base(dict) { } + internal override void PrepareForSave() + { + base.PrepareForSave(); + } + + public void RenderAppearance(ISignatureAppearanceHandler appearanceHandler) + { + PdfRectangle rect = Elements.GetRectangle(PdfAnnotation.Keys.Rect); + XForm form = new XForm(this._document, rect.Size); + XGraphics gfx = XGraphics.FromForm(form); + + appearanceHandler.RenderAppearance(gfx, rect.ToXRect()); + + form.DrawingFinished(); + + // Get existing or create new appearance dictionary + PdfDictionary ap = Elements[PdfAnnotation.Keys.AP] as PdfDictionary; + if (ap == null) + { + ap = new PdfDictionary(this._document); + Elements[PdfAnnotation.Keys.AP] = ap; + } + + // Set XRef to normal state + ap.Elements["/N"] = form.PdfForm.Reference; + } + /// /// Predefined keys of this dictionary. /// The description comes from PDF 1.4 Reference. @@ -60,7 +192,7 @@ internal PdfSignatureField(PdfDictionary dict) /// /// (Required; inheritable) The name of the signature handler to be used for - /// authenticating the field’s contents, such as Adobe.PPKLite, Entrust.PPKEF, + /// authenticating the field�s contents, such as Adobe.PPKLite, Entrust.PPKEF, /// CICI.SignIt, or VeriSign.PPKVS. /// [KeyInfo(KeyType.Name | KeyType.Required)] @@ -108,11 +240,17 @@ internal PdfSignatureField(PdfDictionary dict) public const string Location = "/Location"; /// - /// (Optional) The reason for the signing, such as (I agree…). + /// (Optional) The reason for the signing, such as (I agree�). /// [KeyInfo(KeyType.TextString | KeyType.Optional)] public const string Reason = "/Reason"; + /// + /// (Optional) + /// + [KeyInfo(KeyType.TextString | KeyType.Optional)] + public const string ContactInfo = "/ContactInfo"; + /// /// Gets the KeysMeta for these keys. /// diff --git a/PdfSharpCore/Pdf.AcroForms/PdfTextField.cs b/PdfSharpCore/Pdf.AcroForms/PdfTextField.cs index 8e45517b..ddd1966d 100644 --- a/PdfSharpCore/Pdf.AcroForms/PdfTextField.cs +++ b/PdfSharpCore/Pdf.AcroForms/PdfTextField.cs @@ -284,7 +284,7 @@ internal override void PrepareForSave() public new class Keys : PdfAcroField.Keys { /// - /// (Optional; inheritable) The maximum length of the field’s text, in characters. + /// (Optional; inheritable) The maximum length of the field�s text, in characters. /// [KeyInfo(KeyType.Integer | KeyType.Optional)] public const string MaxLen = "/MaxLen"; diff --git a/PdfSharpCore/Pdf.AcroForms/enums/PdfAcroFieldFlags.cs b/PdfSharpCore/Pdf.AcroForms/enums/PdfAcroFieldFlags.cs index aac397cc..d2f7c4c3 100644 --- a/PdfSharpCore/Pdf.AcroForms/enums/PdfAcroFieldFlags.cs +++ b/PdfSharpCore/Pdf.AcroForms/enums/PdfAcroFieldFlags.cs @@ -80,7 +80,7 @@ public enum PdfAcroFieldFlags // ----- Specific to text fields -------------------------------------------------------------- /// - /// If set, the field may contain multiple lines of text; if clear, the field’s text + /// If set, the field may contain multiple lines of text; if clear, the field�s text /// is restricted to a single line. /// Multiline = 1 << (13 - 1), @@ -129,7 +129,7 @@ public enum PdfAcroFieldFlags Edit = 1 << (19 - 1), /// - /// If set, the field’s option items should be sorted alphabetically. This flag is + /// If set, the field�s option items should be sorted alphabetically. This flag is /// intended for use by form authoring tools, not by PDF viewer applications; /// viewers should simply display the options in the order in which they occur /// in the Opt array. @@ -137,7 +137,7 @@ public enum PdfAcroFieldFlags Sort = 1 << (20 - 1), /// - /// (PDF 1.4) If set, more than one of the field’s option items may be selected + /// (PDF 1.4) If set, more than one of the field�s option items may be selected /// simultaneously; if clear, no more than one item at a time may be selected. /// MultiSelect = 1 << (22 - 1), diff --git a/PdfSharpCore/Pdf.Actions/PdfGoToAction.cs b/PdfSharpCore/Pdf.Actions/PdfGoToAction.cs index 693977af..0f0631a4 100644 --- a/PdfSharpCore/Pdf.Actions/PdfGoToAction.cs +++ b/PdfSharpCore/Pdf.Actions/PdfGoToAction.cs @@ -71,7 +71,7 @@ void Inititalize() //public const string S = "/S"; /// - /// (Required) The destination to jump to (see Section 8.2.1, “Destinations”). + /// (Required) The destination to jump to (see Section 8.2.1, �Destinations�). /// [KeyInfo(KeyType.Name | KeyType.ByteString | KeyType.Array | KeyType.Required)] public const string D = "/D"; diff --git a/PdfSharpCore/Pdf.Actions/enums/PdfNamedActionNames.cs b/PdfSharpCore/Pdf.Actions/enums/PdfNamedActionNames.cs index 83de7c0e..ef917901 100644 --- a/PdfSharpCore/Pdf.Actions/enums/PdfNamedActionNames.cs +++ b/PdfSharpCore/Pdf.Actions/enums/PdfNamedActionNames.cs @@ -54,4 +54,4 @@ public enum PdfNamedActionNames /// LastPage } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Pdf.Advanced/IContentStream.cs b/PdfSharpCore/Pdf.Advanced/IContentStream.cs index ca8b2863..e5540b3d 100644 --- a/PdfSharpCore/Pdf.Advanced/IContentStream.cs +++ b/PdfSharpCore/Pdf.Advanced/IContentStream.cs @@ -45,4 +45,4 @@ internal interface IContentStream string GetFormName(XForm form); } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Pdf.Advanced/PdfCIDFont.cs b/PdfSharpCore/Pdf.Advanced/PdfCIDFont.cs index ded33b49..8911a885 100644 Binary files a/PdfSharpCore/Pdf.Advanced/PdfCIDFont.cs and b/PdfSharpCore/Pdf.Advanced/PdfCIDFont.cs differ diff --git a/PdfSharpCore/Pdf.Advanced/PdfCatalog.cs b/PdfSharpCore/Pdf.Advanced/PdfCatalog.cs index ab489c62..7cccfe09 100644 --- a/PdfSharpCore/Pdf.Advanced/PdfCatalog.cs +++ b/PdfSharpCore/Pdf.Advanced/PdfCatalog.cs @@ -226,7 +226,7 @@ internal sealed class Keys : KeysBase /// /// (Optional; PDF 1.4) The version of the PDF specification to which the document - /// conforms (for example, 1.4) if later than the version specified in the file’s header. + /// conforms (for example, 1.4) if later than the version specified in the file�s header. /// If the header specifies a later version, or if this entry is absent, the document /// conforms to the version specified in the header. This entry enables a PDF producer /// application to update the version using an incremental update. @@ -236,7 +236,7 @@ internal sealed class Keys : KeysBase /// /// (Required; must be an indirect reference) The page tree node that is the root of - /// the document’s page tree. + /// the document�s page tree. /// [KeyInfo(KeyType.Dictionary | KeyType.Required | KeyType.MustBeIndirect, typeof(PdfPages))] public const string Pages = "/Pages"; @@ -251,7 +251,7 @@ internal sealed class Keys : KeysBase public const string PageLabels = "/PageLabels"; /// - /// (Optional; PDF 1.2) The document’s name dictionary. + /// (Optional; PDF 1.2) The document�s name dictionary. /// [KeyInfo("1.2", KeyType.Dictionary | KeyType.Optional)] public const string Names = "/Names"; @@ -299,14 +299,14 @@ internal sealed class Keys : KeysBase /// /// (Optional; must be an indirect reference) The outline dictionary that is the root - /// of the document’s outline hierarchy. + /// of the document�s outline hierarchy. /// [KeyInfo(KeyType.Dictionary | KeyType.Optional, typeof(PdfOutline))] public const string Outlines = "/Outlines"; /// /// (Optional; PDF 1.1; must be an indirect reference) An array of thread dictionaries - /// representing the document’s article threads. + /// representing the document�s article threads. /// [KeyInfo("1.1", KeyType.Array | KeyType.Optional)] public const string Threads = "/Threads"; @@ -335,7 +335,7 @@ internal sealed class Keys : KeysBase public const string URI = "/URI"; /// - /// (Optional; PDF 1.2) The document’s interactive form (AcroForm) dictionary. + /// (Optional; PDF 1.2) The document�s interactive form (AcroForm) dictionary. /// [KeyInfo("1.2", KeyType.Dictionary | KeyType.Optional, typeof(PdfAcroForm))] public const string AcroForm = "/AcroForm"; @@ -348,14 +348,14 @@ internal sealed class Keys : KeysBase public const string Metadata = "/Metadata"; /// - /// (Optional; PDF 1.3) The document’s structure tree root dictionary. + /// (Optional; PDF 1.3) The document�s structure tree root dictionary. /// [KeyInfo("1.3", KeyType.Dictionary | KeyType.Optional)] public const string StructTreeRoot = "/StructTreeRoot"; /// /// (Optional; PDF 1.4) A mark information dictionary containing information - /// about the document’s usage of Tagged PDF conventions. + /// about the document�s usage of Tagged PDF conventions. /// [KeyInfo("1.4", KeyType.Dictionary | KeyType.Optional)] public const string MarkInfo = "/MarkInfo"; @@ -389,7 +389,7 @@ internal sealed class Keys : KeysBase public const string PieceInfo = "/PieceInfo"; /// - /// (Optional; PDF 1.5; required if a document contains optional content) The document’s + /// (Optional; PDF 1.5; required if a document contains optional content) The document�s /// optional content properties dictionary. /// [KeyInfo("1.5", KeyType.Dictionary | KeyType.Optional)] diff --git a/PdfSharpCore/Pdf.Advanced/PdfContents.cs b/PdfSharpCore/Pdf.Advanced/PdfContents.cs index c1941109..0d4ffe7d 100644 --- a/PdfSharpCore/Pdf.Advanced/PdfContents.cs +++ b/PdfSharpCore/Pdf.Advanced/PdfContents.cs @@ -200,7 +200,7 @@ internal override void WriteObject(PdfWriter writer) { // Save two bytes in PDF stream... if (Elements.Count == 1) - Elements[0].WriteObject(writer); + Elements[0].Write(writer); else base.WriteObject(writer); } diff --git a/PdfSharpCore/Pdf.Advanced/PdfCrossReferenceTable.cs b/PdfSharpCore/Pdf.Advanced/PdfCrossReferenceTable.cs index 855157c0..8dd63353 100644 --- a/PdfSharpCore/Pdf.Advanced/PdfCrossReferenceTable.cs +++ b/PdfSharpCore/Pdf.Advanced/PdfCrossReferenceTable.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange diff --git a/PdfSharpCore/Pdf.Advanced/PdfEmbeddedFile.cs b/PdfSharpCore/Pdf.Advanced/PdfEmbeddedFile.cs index 20dcb243..5a1db453 100644 --- a/PdfSharpCore/Pdf.Advanced/PdfEmbeddedFile.cs +++ b/PdfSharpCore/Pdf.Advanced/PdfEmbeddedFile.cs @@ -1,4 +1,4 @@ -namespace PdfSharpCore.Pdf.Advanced +namespace PdfSharpCore.Pdf.Advanced { /// /// Represent a file stream embedded in the PDF document diff --git a/PdfSharpCore/Pdf.Advanced/PdfExtGState.cs b/PdfSharpCore/Pdf.Advanced/PdfExtGState.cs index 5ca96ee2..49fddf62 100644 --- a/PdfSharpCore/Pdf.Advanced/PdfExtGState.cs +++ b/PdfSharpCore/Pdf.Advanced/PdfExtGState.cs @@ -226,7 +226,7 @@ internal sealed class Keys : KeysBase public const string Type = "/Type"; /// - /// (Optional; PDF 1.3) The line width (see “Line Width” on page 185). + /// (Optional; PDF 1.3) The line width (see �Line Width� on page 185). /// [KeyInfo(KeyType.Real | KeyType.Optional)] public const string LW = "/LW"; @@ -367,7 +367,7 @@ internal sealed class Keys : KeysBase public const string ca = "/ca"; /// - /// (Optional; PDF 1.4) The alpha source flag (“alpha is shape”), specifying whether + /// (Optional; PDF 1.4) The alpha source flag (�alpha is shape�), specifying whether /// the current soft mask and alpha constant are to be interpreted as shape values (true) /// or opacity values (false). /// diff --git a/PdfSharpCore/Pdf.Advanced/PdfExtGStateTable.cs b/PdfSharpCore/Pdf.Advanced/PdfExtGStateTable.cs index f193f67d..ceec093c 100644 --- a/PdfSharpCore/Pdf.Advanced/PdfExtGStateTable.cs +++ b/PdfSharpCore/Pdf.Advanced/PdfExtGStateTable.cs @@ -92,4 +92,4 @@ public PdfExtGState GetExtGStateNonStroke(double alpha, bool overprint) readonly Dictionary _strokeAlphaValues = new Dictionary(); readonly Dictionary _nonStrokeStates = new Dictionary(); } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Pdf.Advanced/PdfFileSpecification.cs b/PdfSharpCore/Pdf.Advanced/PdfFileSpecification.cs index 056aa399..4762b737 100644 --- a/PdfSharpCore/Pdf.Advanced/PdfFileSpecification.cs +++ b/PdfSharpCore/Pdf.Advanced/PdfFileSpecification.cs @@ -1,4 +1,4 @@ -namespace PdfSharpCore.Pdf.Advanced +namespace PdfSharpCore.Pdf.Advanced { /// /// Represent a file stream embedded in the PDF document diff --git a/PdfSharpCore/Pdf.Advanced/PdfFont.cs b/PdfSharpCore/Pdf.Advanced/PdfFont.cs index 19fb30fb..7a6fc291 100644 --- a/PdfSharpCore/Pdf.Advanced/PdfFont.cs +++ b/PdfSharpCore/Pdf.Advanced/PdfFont.cs @@ -144,7 +144,7 @@ public class Keys : KeysBase /// /// (Required except for the standard 14 fonts; must be an indirect reference) - /// A font descriptor describing the font’s metrics other than its glyph widths. + /// A font descriptor describing the font�s metrics other than its glyph widths. /// Note: For the standard 14 fonts, the entries FirstChar, LastChar, Widths, and /// FontDescriptor must either all be present or all be absent. Ordinarily, they are /// absent; specifying them enables a standard font to be overridden. @@ -153,4 +153,4 @@ public class Keys : KeysBase public const string FontDescriptor = "/FontDescriptor"; } } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Pdf.Advanced/PdfFontDescriptor.cs b/PdfSharpCore/Pdf.Advanced/PdfFontDescriptor.cs index 3c03ba8b..64e1852d 100644 --- a/PdfSharpCore/Pdf.Advanced/PdfFontDescriptor.cs +++ b/PdfSharpCore/Pdf.Advanced/PdfFontDescriptor.cs @@ -208,7 +208,7 @@ public sealed class Keys : KeysBase public const string Flags = "/Flags"; /// - /// (Required, except for Type 3 fonts) A rectangle (see Section 3.8.4, “Rectangles”), + /// (Required, except for Type 3 fonts) A rectangle (see Section 3.8.4, �Rectangles�), /// expressed in the glyph coordinate system, specifying the font bounding box. This /// is the smallest rectangle enclosing the shape that would result if all of the /// glyphs of the font were placed with their origins coincident and then filled. @@ -218,8 +218,8 @@ public sealed class Keys : KeysBase /// /// (Required) The angle, expressed in degrees counterclockwise from the vertical, of - /// the dominant vertical strokes of the font. (For example, the 9-o’clock position is 90 - /// degrees, and the 3-o’clock position is –90 degrees.) The value is negative for fonts + /// the dominant vertical strokes of the font. (For example, the 9-o�clock position is 90 + /// degrees, and the 3-o�clock position is �90 degrees.) The value is negative for fonts /// that slope to the right, as almost all italic fonts do. /// [KeyInfo(KeyType.Real | KeyType.Required)] @@ -254,7 +254,7 @@ public sealed class Keys : KeysBase public const string CapHeight = "/CapHeight"; /// - /// (Optional) The font’s x height: the vertical coordinate of the top of flat nonascending + /// (Optional) The font�s x height: the vertical coordinate of the top of flat nonascending /// lowercase letters (like the letter x), measured from the baseline, in fonts that have /// Latin characters. Default value: 0. /// @@ -289,7 +289,7 @@ public sealed class Keys : KeysBase /// /// (Optional) The width to use for character codes whose widths are not specified in a - /// font dictionary’s Widths array. This has a predictable effect only if all such codes + /// font dictionary�s Widths array. This has a predictable effect only if all such codes /// map to glyphs whose actual widths are the same as the value of the MissingWidth entry. /// Default value: 0. /// @@ -317,7 +317,7 @@ public sealed class Keys : KeysBase /// /// (Optional; meaningful only in Type 1 fonts; PDF 1.1) A string listing the character - /// names defined in a font subset. The names in this string must be in PDF syntax—that is, + /// names defined in a font subset. The names in this string must be in PDF syntax�that is, /// each name preceded by a slash (/). The names can appear in any order. The name .notdef /// should be omitted; it is assumed to exist in the font subset. If this entry is absent, /// the only indication of a font subset is the subset tag in the FontName entry. diff --git a/PdfSharpCore/Pdf.Advanced/PdfFormXObject.cs b/PdfSharpCore/Pdf.Advanced/PdfFormXObject.cs index 3e18d762..ec2ad409 100644 --- a/PdfSharpCore/Pdf.Advanced/PdfFormXObject.cs +++ b/PdfSharpCore/Pdf.Advanced/PdfFormXObject.cs @@ -425,7 +425,7 @@ void FixUpObject_old(PdfImportedObjectTable iot, PdfObject value) /// /// (Required) An array of four numbers in the form coordinate system, giving the /// coordinates of the left, bottom, right, and top edges, respectively, of the - /// form XObject’s bounding box. These boundaries are used to clip the form XObject + /// form XObject�s bounding box. These boundaries are used to clip the form XObject /// and to determine its size for caching. /// [KeyInfo(KeyType.Rectangle | KeyType.Required)] @@ -449,7 +449,7 @@ void FixUpObject_old(PdfImportedObjectTable iot, PdfObject value) /// /// (Optional; PDF 1.4) A group attributes dictionary indicating that the contents /// of the form XObject are to be treated as a group and specifying the attributes - /// of that group (see Section 4.9.2, “Group XObjects”). + /// of that group (see Section 4.9.2, �Group XObjects�). /// Note: If a Ref entry (see below) is present, the group attributes also apply to the /// external page imported by that entry, which allows such an imported page to be /// treated as a group without further modification. diff --git a/PdfSharpCore/Pdf.Advanced/PdfGroupAttributes.cs b/PdfSharpCore/Pdf.Advanced/PdfGroupAttributes.cs index c2c5aaa3..24f9ea8b 100644 --- a/PdfSharpCore/Pdf.Advanced/PdfGroupAttributes.cs +++ b/PdfSharpCore/Pdf.Advanced/PdfGroupAttributes.cs @@ -55,7 +55,7 @@ public class Keys : KeysBase /// /// (Required) The group subtype, which identifies the type of group whose /// attributes this dictionary describes and determines the format and meaning - /// of the dictionary’s remaining entries. The only group subtype defined in + /// of the dictionary�s remaining entries. The only group subtype defined in /// PDF 1.4 is Transparency. Other group subtypes may be added in the future. /// [KeyInfo(KeyType.Name | KeyType.Required)] @@ -79,4 +79,4 @@ internal override DictionaryMeta Meta get { return Keys.Meta; } } } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Pdf.Advanced/PdfImage.FaxEncode.cs b/PdfSharpCore/Pdf.Advanced/PdfImage.FaxEncode.cs index 86fc4bf8..cdcae91c 100644 --- a/PdfSharpCore/Pdf.Advanced/PdfImage.FaxEncode.cs +++ b/PdfSharpCore/Pdf.Advanced/PdfImage.FaxEncode.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange diff --git a/PdfSharpCore/Pdf.Advanced/PdfImage.cs b/PdfSharpCore/Pdf.Advanced/PdfImage.cs index a45397d0..0b651881 100644 --- a/PdfSharpCore/Pdf.Advanced/PdfImage.cs +++ b/PdfSharpCore/Pdf.Advanced/PdfImage.cs @@ -2,7 +2,7 @@ // // Authors: // Stefan Lange -// Thomas Hövel +// Thomas H�vel // // Copyright (c) 2005-2016 empira Software GmbH, Cologne Area (Germany) // @@ -730,8 +730,8 @@ private void ReadIndexedMemoryBitmap(int bits/*, ref bool hasAlpha*/) /// (Required for images, except those that use the JPXDecode filter; not allowed for image masks) /// The color space in which image samples are specified; it can be any type of color space except /// Pattern. If the image uses the JPXDecode filter, this entry is optional: - /// • If ColorSpace is present, any color space specifications in the JPEG2000 data are ignored. - /// • If ColorSpace is absent, the color space specifications in the JPEG2000 data are used. + /// � If ColorSpace is present, any color space specifications in the JPEG2000 data are ignored. + /// � If ColorSpace is absent, the color space specifications in the JPEG2000 data are used. /// The Decode array is also ignored unless ImageMask is true. /// [KeyInfo(KeyType.NameOrArray | KeyType.Required)] @@ -781,10 +781,10 @@ private void ReadIndexedMemoryBitmap(int bits/*, ref bool hasAlpha*/) /// /// (Optional) An array of numbers describing how to map image samples into the range of values - /// appropriate for the image’s color space. If ImageMask is true, the array must be either + /// appropriate for the image�s color space. If ImageMask is true, the array must be either /// [0 1] or [1 0]; otherwise, its length must be twice the number of color components required /// by ColorSpace. If the image uses the JPXDecode filter and ImageMask is false, Decode is ignored. - /// Default value: see “Decode Arrays”. + /// Default value: see �Decode Arrays�. /// [KeyInfo(KeyType.Array | KeyType.Optional)] public const string Decode = "/Decode"; @@ -809,8 +809,8 @@ private void ReadIndexedMemoryBitmap(int bits/*, ref bool hasAlpha*/) /// source of mask shape or mask opacity values in the transparent imaging model. The alpha /// source parameter in the graphics state determines whether the mask values are interpreted as /// shape or opacity. If present, this entry overrides the current soft mask in the graphics state, - /// as well as the image’s Mask entry, if any. (However, the other transparency related graphics - /// state parameters — blend mode and alpha constant — remain in effect.) If SMask is absent, the + /// as well as the image�s Mask entry, if any. (However, the other transparency related graphics + /// state parameters � blend mode and alpha constant � remain in effect.) If SMask is absent, the /// image has no associated soft mask (although the current soft mask in the graphics state may /// still apply). /// @@ -821,10 +821,10 @@ private void ReadIndexedMemoryBitmap(int bits/*, ref bool hasAlpha*/) /// (Optional for images that use the JPXDecode filter, meaningless otherwise; PDF 1.5) /// A code specifying how soft-mask information encoded with image samples should be used: /// 0 If present, encoded soft-mask image information should be ignored. - /// 1 The image’s data stream includes encoded soft-mask values. An application can create + /// 1 The image�s data stream includes encoded soft-mask values. An application can create /// a soft-mask image from the information to be used as a source of mask shape or mask /// opacity in the transparency imaging model. - /// 2 The image’s data stream includes color channels that have been preblended with a + /// 2 The image�s data stream includes color channels that have been preblended with a /// background; the image data also includes an opacity channel. An application can create /// a soft-mask image with a Matte entry from the opacity channel information to be used as /// a source of mask shape or mask opacity in the transparency model. If this entry has a @@ -843,13 +843,13 @@ private void ReadIndexedMemoryBitmap(int bits/*, ref bool hasAlpha*/) /// /// (Required if the image is a structural content item; PDF 1.3) The integer key of the - /// image’s entry in the structural parent tree. + /// image�s entry in the structural parent tree. /// [KeyInfo(KeyType.Integer | KeyType.Required)] public const string StructParent = "/StructParent"; /// - /// (Optional; PDF 1.3; indirect reference preferred) The digital identifier of the image’s + /// (Optional; PDF 1.3; indirect reference preferred) The digital identifier of the image�s /// parent Web Capture content set. /// [KeyInfo(KeyType.String | KeyType.Optional)] diff --git a/PdfSharpCore/Pdf.Advanced/PdfInternals.cs b/PdfSharpCore/Pdf.Advanced/PdfInternals.cs index b921ccbd..a4a43157 100644 --- a/PdfSharpCore/Pdf.Advanced/PdfInternals.cs +++ b/PdfSharpCore/Pdf.Advanced/PdfInternals.cs @@ -268,7 +268,7 @@ public void WriteObject(Stream stream, PdfItem item) // Never write an encrypted object PdfWriter writer = new PdfWriter(stream, null); writer.Options = PdfWriterOptions.OmitStream; - item.WriteObject(writer); + item.Write(writer); } /// diff --git a/PdfSharpCore/Pdf.Advanced/PdfPageInterals.cs b/PdfSharpCore/Pdf.Advanced/PdfPageInterals.cs index 07653630..8c613f24 100644 --- a/PdfSharpCore/Pdf.Advanced/PdfPageInterals.cs +++ b/PdfSharpCore/Pdf.Advanced/PdfPageInterals.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange diff --git a/PdfSharpCore/Pdf.Advanced/PdfSoftMask.cs b/PdfSharpCore/Pdf.Advanced/PdfSoftMask.cs index d8f66c2e..7bfb414f 100644 --- a/PdfSharpCore/Pdf.Advanced/PdfSoftMask.cs +++ b/PdfSharpCore/Pdf.Advanced/PdfSoftMask.cs @@ -59,8 +59,8 @@ public class Keys : KeysBase /// /// (Required) A subtype specifying the method to be used in deriving the mask values /// from the transparency group specified by the G entry: - /// Alpha: Use the group’s computed alpha, disregarding its color. - /// Luminosity: Convert the group’s computed color to a single-component luminosity value. + /// Alpha: Use the group�s computed alpha, disregarding its color. + /// Luminosity: Convert the group�s computed color to a single-component luminosity value. /// [KeyInfo(KeyType.Name | KeyType.Required)] public const string S = "/S"; @@ -80,7 +80,7 @@ public class Keys : KeysBase /// This entry is consulted only if the subtype S is Luminosity. The array consists of /// n numbers, where n is the number of components in the color space specified /// by the CS entry in the group attributes dictionary. - /// Default value: the color space’s initial value, representing black. + /// Default value: the color space�s initial value, representing black. /// [KeyInfo(KeyType.Array | KeyType.Optional)] public const string BC = "/BC"; @@ -99,4 +99,4 @@ public class Keys : KeysBase public const string TR = "/TR"; } } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Pdf.Advanced/PdfTilingPattern.cs b/PdfSharpCore/Pdf.Advanced/PdfTilingPattern.cs index 0d72d915..3b848aae 100644 --- a/PdfSharpCore/Pdf.Advanced/PdfTilingPattern.cs +++ b/PdfSharpCore/Pdf.Advanced/PdfTilingPattern.cs @@ -79,10 +79,10 @@ public PdfTilingPattern(PdfDocument document) /// /// (Required) A code that determines how the color of the pattern cell is to be specified: - /// 1: Colored tiling pattern. The pattern’s content stream specifies the colors used to + /// 1: Colored tiling pattern. The pattern�s content stream specifies the colors used to /// paint the pattern cell. When the content stream begins execution, the current color - /// is the one that was initially in effect in the pattern’s parent content stream. - /// 2: Uncolored tiling pattern. The pattern’s content stream does not specify any color + /// is the one that was initially in effect in the pattern�s parent content stream. + /// 2: Uncolored tiling pattern. The pattern�s content stream does not specify any color /// information. Instead, the entire pattern cell is painted with a separately specified color /// each time the pattern is used. Essentially, the content stream describes a stencil /// through which the current color is to be poured. The content stream must not invoke @@ -96,7 +96,7 @@ public PdfTilingPattern(PdfDocument document) /// /// (Required) A code that controls adjustments to the spacing of tiles relative to the device /// pixel grid: - /// 1: Constant spacing. Pattern cells are spaced consistently—that is, by a multiple of a + /// 1: Constant spacing. Pattern cells are spaced consistently�that is, by a multiple of a /// device pixel. To achieve this, the application may need to distort the pattern cell slightly /// by making small adjustments to XStep, YStep, and the transformation matrix. The amount /// of distortion does not exceed 1 device pixel. @@ -113,7 +113,7 @@ public PdfTilingPattern(PdfDocument document) /// /// (Required) An array of four numbers in the pattern coordinate system giving the /// coordinates of the left, bottom, right, and top edges, respectively, of the pattern - /// cell’s bounding box. These boundaries are used to clip the pattern cell. + /// cell�s bounding box. These boundaries are used to clip the pattern cell. /// [KeyInfo(KeyType.Rectangle | KeyType.Optional)] public const string BBox = "/BBox"; @@ -136,7 +136,7 @@ public PdfTilingPattern(PdfDocument document) /// /// (Required) A resource dictionary containing all of the named resources required by - /// the pattern’s content stream (see Section 3.7.2, “Resource Dictionaries”). + /// the pattern�s content stream (see Section 3.7.2, �Resource Dictionaries�). /// [KeyInfo(KeyType.Dictionary | KeyType.Required)] public new const string Resources = "/Resources"; diff --git a/PdfSharpCore/Pdf.Advanced/PdfTrailer.cs b/PdfSharpCore/Pdf.Advanced/PdfTrailer.cs index aef89783..977bb7da 100644 --- a/PdfSharpCore/Pdf.Advanced/PdfTrailer.cs +++ b/PdfSharpCore/Pdf.Advanced/PdfTrailer.cs @@ -218,7 +218,7 @@ internal void Finish() internal class Keys : KeysBase // Reference: TABLE 3.13 Entries in the file trailer dictionary / Page 97 { /// - /// (Required; must not be an indirect reference) The total number of entries in the file’s + /// (Required; must not be an indirect reference) The total number of entries in the file�s /// cross-reference table, as defined by the combination of the original section and all /// update sections. Equivalently, this value is 1 greater than the highest object number /// used in the file. @@ -244,13 +244,13 @@ internal class Keys : KeysBase // Reference: TABLE 3.13 Entries in the file tr public const string Root = "/Root"; /// - /// (Required if document is encrypted; PDF 1.1) The document’s encryption dictionary. + /// (Required if document is encrypted; PDF 1.1) The document�s encryption dictionary. /// [KeyInfo(KeyType.Dictionary | KeyType.Optional, typeof(PdfStandardSecurityHandler))] public const string Encrypt = "/Encrypt"; /// - /// (Optional; must be an indirect reference) The document’s information dictionary. + /// (Optional; must be an indirect reference) The document�s information dictionary. /// [KeyInfo(KeyType.Dictionary | KeyType.Optional, typeof(PdfDocumentInformation))] public const string Info = "/Info"; diff --git a/PdfSharpCore/Pdf.Advanced/PdfTransparencyGroupAttributes.cs b/PdfSharpCore/Pdf.Advanced/PdfTransparencyGroupAttributes.cs index 66b95ed5..17867150 100644 --- a/PdfSharpCore/Pdf.Advanced/PdfTransparencyGroupAttributes.cs +++ b/PdfSharpCore/Pdf.Advanced/PdfTransparencyGroupAttributes.cs @@ -48,12 +48,12 @@ internal PdfTransparencyGroupAttributes(PdfDocument thisDocument) /// /// (Sometimes required, as discussed below) /// The group color space, which is used for the following purposes: - /// • As the color space into which colors are converted when painted into the group - /// • As the blending color space in which objects are composited within the group - /// • As the color space of the group as a whole when it in turn is painted as an object onto its backdrop + /// � As the color space into which colors are converted when painted into the group + /// � As the blending color space in which objects are composited within the group + /// � As the color space of the group as a whole when it in turn is painted as an object onto its backdrop /// The group color space may be any device or CIE-based color space that /// treats its components as independent additive or subtractive values in the - /// range 0.0 to 1.0, subject to the restrictions described in Section 7.2.3, “Blending Color Space.” + /// range 0.0 to 1.0, subject to the restrictions described in Section 7.2.3, �Blending Color Space.� /// These restrictions exclude Lab and lightness-chromaticity ICCBased color spaces, /// as well as the special color spaces Pattern, Indexed, Separation, and DeviceN. /// Device color spaces are subject to remapping according to the DefaultGray, @@ -62,7 +62,7 @@ internal PdfTransparencyGroupAttributes(PdfDocument thisDocument) /// Ordinarily, the CS entry is allowed only for isolated transparency groups /// (those for which I, below, is true), and even then it is optional. However, /// this entry is required in the group attributes dictionary for any transparency - /// group XObject that has no parent group or page from which to inherit — in + /// group XObject that has no parent group or page from which to inherit � in /// particular, one that is the value of the G entry in a soft-mask dictionary of /// subtype Luminosity. /// In addition, it is always permissible to specify CS in the group attributes @@ -74,7 +74,7 @@ internal PdfTransparencyGroupAttributes(PdfDocument thisDocument) /// and the color space is inherited from the actual backdrop with which the /// page is composited. /// Default value: the color space of the parent group or page into which this - /// transparency group is painted. (The parent’s color space in turn can be + /// transparency group is painted. (The parent�s color space in turn can be /// either explicitly specified or inherited.) /// [KeyInfo(KeyType.NameOrArray | KeyType.Optional)] @@ -84,7 +84,7 @@ internal PdfTransparencyGroupAttributes(PdfDocument thisDocument) /// (Optional) A flag specifying whether the transparency group is isolated. /// If this flag is true, objects within the group are composited against a fully /// transparent initial backdrop; if false, they are composited against the - /// group’s backdrop. + /// group�s backdrop. /// Default value: false. /// In the group attributes dictionary for a page, the interpretation of this /// entry is slightly altered. In the normal case in which the page is imposed @@ -101,7 +101,7 @@ internal PdfTransparencyGroupAttributes(PdfDocument thisDocument) /// (Optional) A flag specifying whether the transparency group is a knockout /// group. If this flag is false, later objects within the group are composited /// with earlier ones with which they overlap; if true, they are composited with - /// the group’s initial backdrop and overwrite (“knock out”) any earlier + /// the group�s initial backdrop and overwrite (�knock out�) any earlier /// overlapping objects. /// Default value: false. /// diff --git a/PdfSharpCore/Pdf.Advanced/PdfTrueTypeFont.cs b/PdfSharpCore/Pdf.Advanced/PdfTrueTypeFont.cs index f6e7ae2d..c4446905 100644 --- a/PdfSharpCore/Pdf.Advanced/PdfTrueTypeFont.cs +++ b/PdfSharpCore/Pdf.Advanced/PdfTrueTypeFont.cs @@ -172,7 +172,7 @@ internal override void PrepareForSave() /// /// (Required) The PostScript name of the font. For Type 1 fonts, this is usually /// the value of the FontName entry in the font program; for more information. - /// The Post-Script name of the font can be used to find the font’s definition in + /// The Post-Script name of the font can be used to find the font�s definition in /// the consumer application or its environment. It is also the name that is used when /// printing to a PostScript output device. /// @@ -181,14 +181,14 @@ internal override void PrepareForSave() /// /// (Required except for the standard 14 fonts) The first character code defined - /// in the font’s Widths array. + /// in the font�s Widths array. /// [KeyInfo(KeyType.Integer)] public const string FirstChar = "/FirstChar"; /// /// (Required except for the standard 14 fonts) The last character code defined - /// in the font’s Widths array. + /// in the font�s Widths array. /// [KeyInfo(KeyType.Integer)] public const string LastChar = "/LastChar"; @@ -207,7 +207,7 @@ internal override void PrepareForSave() /// /// (Required except for the standard 14 fonts; must be an indirect reference) - /// A font descriptor describing the font’s metrics other than its glyph widths. + /// A font descriptor describing the font�s metrics other than its glyph widths. /// Note: For the standard 14 fonts, the entries FirstChar, LastChar, Widths, and /// FontDescriptor must either all be present or all be absent. Ordinarily, they are /// absent; specifying them enables a standard font to be overridden. @@ -216,10 +216,10 @@ internal override void PrepareForSave() public new const string FontDescriptor = "/FontDescriptor"; /// - /// (Optional) A specification of the font’s character encoding if different from its + /// (Optional) A specification of the font�s character encoding if different from its /// built-in encoding. The value of Encoding is either the name of a predefined /// encoding (MacRomanEncoding, MacExpertEncoding, or WinAnsiEncoding, as described in - /// Appendix D) or an encoding dictionary that specifies differences from the font’s + /// Appendix D) or an encoding dictionary that specifies differences from the font�s /// built-in encoding or from a specified predefined encoding. /// [KeyInfo(KeyType.Name | KeyType.Dictionary)] diff --git a/PdfSharpCore/Pdf.Advanced/PdfType0Font.cs b/PdfSharpCore/Pdf.Advanced/PdfType0Font.cs index c79d827a..019a8538 100644 --- a/PdfSharpCore/Pdf.Advanced/PdfType0Font.cs +++ b/PdfSharpCore/Pdf.Advanced/PdfType0Font.cs @@ -185,9 +185,9 @@ internal override void PrepareForSave() /// dictionary. The conventions described here ensure maximum compatibility /// with existing Acrobat products. /// If the descendant is a Type 0 CIDFont, this name should be the concatenation - /// of the CIDFont’s BaseFont name, a hyphen, and the CMap name given in the + /// of the CIDFont�s BaseFont name, a hyphen, and the CMap name given in the /// Encoding entry (or the CMapName entry in the CMap). If the descendant is a - /// Type 2 CIDFont, this name should be the same as the CIDFont’s BaseFont name. + /// Type 2 CIDFont, this name should be the same as the CIDFont�s BaseFont name. /// [KeyInfo(KeyType.Name | KeyType.Required)] public new const string BaseFont = "/BaseFont"; diff --git a/PdfSharpCore/Pdf.Advanced/PdfType1Font.cs b/PdfSharpCore/Pdf.Advanced/PdfType1Font.cs index c49eac34..a410d3ab 100644 --- a/PdfSharpCore/Pdf.Advanced/PdfType1Font.cs +++ b/PdfSharpCore/Pdf.Advanced/PdfType1Font.cs @@ -97,7 +97,7 @@ public PdfType1Font(PdfDocument document) /// /// (Required) The PostScript name of the font. For Type 1 fonts, this is usually /// the value of the FontName entry in the font program; for more information. - /// The Post-Script name of the font can be used to find the font’s definition in + /// The Post-Script name of the font can be used to find the font�s definition in /// the consumer application or its environment. It is also the name that is used when /// printing to a PostScript output device. /// @@ -106,14 +106,14 @@ public PdfType1Font(PdfDocument document) /// /// (Required except for the standard 14 fonts) The first character code defined - /// in the font’s Widths array. + /// in the font�s Widths array. /// [KeyInfo(KeyType.Integer)] public const string FirstChar = "/FirstChar"; /// /// (Required except for the standard 14 fonts) The last character code defined - /// in the font’s Widths array. + /// in the font�s Widths array. /// [KeyInfo(KeyType.Integer)] public const string LastChar = "/LastChar"; @@ -132,7 +132,7 @@ public PdfType1Font(PdfDocument document) /// /// (Required except for the standard 14 fonts; must be an indirect reference) - /// A font descriptor describing the font’s metrics other than its glyph widths. + /// A font descriptor describing the font�s metrics other than its glyph widths. /// Note: For the standard 14 fonts, the entries FirstChar, LastChar, Widths, and /// FontDescriptor must either all be present or all be absent. Ordinarily, they are /// absent; specifying them enables a standard font to be overridden. @@ -141,10 +141,10 @@ public PdfType1Font(PdfDocument document) public new const string FontDescriptor = "/FontDescriptor"; /// - /// (Optional) A specification of the font’s character encoding if different from its + /// (Optional) A specification of the font�s character encoding if different from its /// built-in encoding. The value of Encoding is either the name of a predefined /// encoding (MacRomanEncoding, MacExpertEncoding, or WinAnsiEncoding, as described in - /// Appendix D) or an encoding dictionary that specifies differences from the font’s + /// Appendix D) or an encoding dictionary that specifies differences from the font�s /// built-in encoding or from a specified predefined encoding. /// [KeyInfo(KeyType.Name | KeyType.Dictionary)] diff --git a/PdfSharpCore/Pdf.Annotations/PdfAnnotation.cs b/PdfSharpCore/Pdf.Annotations/PdfAnnotation.cs index e5e470b9..3721a00a 100644 --- a/PdfSharpCore/Pdf.Annotations/PdfAnnotation.cs +++ b/PdfSharpCore/Pdf.Annotations/PdfAnnotation.cs @@ -106,7 +106,7 @@ public PdfRectangle Rectangle } /// - /// Gets or sets the text label to be displayed in the title bar of the annotation’s + /// Gets or sets the text label to be displayed in the title bar of the annotation�s /// pop-up window when open and active. By convention, this entry identifies /// the user who added the annotation. /// @@ -136,7 +136,7 @@ public string Subject /// /// 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’s + /// annotation does not display text, an alternate description of the annotation�s /// contents in human-readable form. /// public string Contents @@ -234,9 +234,9 @@ public class Keys : KeysBase /// /// (Optional) Text to be displayed for the annotation or, if this type of annotation - /// does not display text, an alternate description of the annotation’s contents + /// does not display text, an alternate description of the annotation�s contents /// in human-readable form. In either case, this text is useful when - /// extracting the document’s contents in support of accessibility to users with + /// extracting the document�s contents in support of accessibility to users with /// disabilities or for other purposes. /// [KeyInfo(KeyType.TextString | KeyType.Optional)] @@ -268,7 +268,7 @@ public class Keys : KeysBase /// /// (Optional; PDF 1.2) A border style dictionary specifying the characteristics of - /// the annotation’s border. + /// the annotation�s border. /// [KeyInfo("1.2", KeyType.Dictionary | KeyType.Optional)] public const string BS = "/BS"; @@ -283,14 +283,14 @@ public class Keys : KeysBase /// /// (Required if the appearance dictionary AP contains one or more subdictionaries; PDF 1.2) - /// The annotation’s appearance state, which selects the applicable appearance stream from + /// The annotation�s appearance state, which selects the applicable appearance stream from /// an appearance subdictionary. /// [KeyInfo("1.2", KeyType.Dictionary | KeyType.Optional)] public const string AS = "/AS"; /// - /// (Optional) An array specifying the characteristics of the annotation’s border. + /// (Optional) An array specifying the characteristics of the annotation�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. @@ -311,9 +311,9 @@ public class Keys : KeysBase /// (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: - /// • The background of the annotation’s icon when closed - /// • The title bar of the annotation’s pop-up window - /// • The border of a link annotation + /// � The background of the annotation�s icon when closed + /// � The title bar of the annotation�s pop-up window + /// � The border of a link annotation /// [KeyInfo("1.1", KeyType.Array | KeyType.Optional)] public const string C = "/C"; @@ -333,7 +333,7 @@ public class Keys : KeysBase // ----- Excerpt of entries specific to markup annotations ---------------------------------- /// - /// (Optional; PDF 1.1) The text label to be displayed in the title bar of the annotation’s + /// (Optional; PDF 1.1) The text label to be displayed in the title bar of the annotation�s /// pop-up window when open and active. By convention, this entry identifies /// the user who added the annotation. /// @@ -354,8 +354,8 @@ public class Keys : KeysBase /// 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’s appearance stream, it may incorporate the CA value - /// into the stream’s content.) + /// regenerates the annotation�s appearance stream, it may incorporate the CA value + /// into the stream�s content.) /// The implicit blend mode is Normal. /// Default value: 1.0. /// diff --git a/PdfSharpCore/Pdf.Annotations/PdfFileAttachmentAnnotation.cs b/PdfSharpCore/Pdf.Annotations/PdfFileAttachmentAnnotation.cs index 34c995e2..c7725fab 100644 --- a/PdfSharpCore/Pdf.Annotations/PdfFileAttachmentAnnotation.cs +++ b/PdfSharpCore/Pdf.Annotations/PdfFileAttachmentAnnotation.cs @@ -1,4 +1,4 @@ -using PdfSharpCore.Pdf.Advanced; +using PdfSharpCore.Pdf.Advanced; using System; namespace PdfSharpCore.Pdf.Annotations diff --git a/PdfSharpCore/Pdf.Annotations/PdfLinkAnnotation.cs b/PdfSharpCore/Pdf.Annotations/PdfLinkAnnotation.cs index 39199273..b5b975d0 100644 --- a/PdfSharpCore/Pdf.Annotations/PdfLinkAnnotation.cs +++ b/PdfSharpCore/Pdf.Annotations/PdfLinkAnnotation.cs @@ -180,11 +180,11 @@ internal override void WriteObject(PdfWriter writer) public const string Dest = "/Dest"; /// - /// (Optional; PDF 1.2) The annotation’s highlighting mode, the visual effect to be + /// (Optional; PDF 1.2) The annotation�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’s border. + /// O (Outline) Invert the annotation�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. diff --git a/PdfSharpCore/Pdf.Annotations/PdfWidgetAnnotation.cs b/PdfSharpCore/Pdf.Annotations/PdfWidgetAnnotation.cs index 0b3e9d86..b8ba68e8 100644 --- a/PdfSharpCore/Pdf.Annotations/PdfWidgetAnnotation.cs +++ b/PdfSharpCore/Pdf.Annotations/PdfWidgetAnnotation.cs @@ -56,12 +56,12 @@ void Initialize() internal new class Keys : PdfAnnotation.Keys { /// - /// (Optional) The annotation’s highlighting mode, the visual effect to be used when + /// (Optional) The annotation�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’s border. - /// P (Push) Display the annotation’s down appearance, if any. If no down appearance is defined, + /// O (Outline) Invert the annotation�s border. + /// P (Push) Display the annotation�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). @@ -73,7 +73,7 @@ void Initialize() /// /// (Optional) An appearance characteristics dictionary to be used in constructing a dynamic - /// appearance stream specifying the annotation’s visual presentation on the page. + /// appearance stream specifying the annotation�s visual presentation on the page. /// The name MK for this entry is of historical significance only and has no direct meaning. /// [KeyInfo(KeyType.Dictionary | KeyType.Optional)] diff --git a/PdfSharpCore/Pdf.Annotations/enums/PdfAnnotationFlags.cs b/PdfSharpCore/Pdf.Annotations/enums/PdfAnnotationFlags.cs index edb3b42b..4a7f9156 100644 --- a/PdfSharpCore/Pdf.Annotations/enums/PdfAnnotationFlags.cs +++ b/PdfSharpCore/Pdf.Annotations/enums/PdfAnnotationFlags.cs @@ -61,7 +61,7 @@ public enum PdfAnnotationFlags Print = 1 << (3 - 1), /// - /// (PDF 1.3) If set, do not scale the annotation’s appearance to match the magnification + /// (PDF 1.3) If set, do not scale the annotation�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. @@ -69,7 +69,7 @@ public enum PdfAnnotationFlags NoZoom = 1 << (4 - 1), /// - /// (PDF 1.3) If set, do not rotate the annotation’s appearance to match the rotation + /// (PDF 1.3) If set, do not rotate the annotation�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. /// @@ -96,7 +96,7 @@ public enum PdfAnnotationFlags /// /// (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’s contents, such as the value of a form + /// not restrict changes to the annotation�s contents, such as the value of a form /// field. /// Locked = 1 << (8 - 1), diff --git a/PdfSharpCore/Pdf.Content.Objects/CObjects.cs b/PdfSharpCore/Pdf.Content.Objects/CObjects.cs index af440074..27bbbe48 100644 --- a/PdfSharpCore/Pdf.Content.Objects/CObjects.cs +++ b/PdfSharpCore/Pdf.Content.Objects/CObjects.cs @@ -926,4 +926,4 @@ internal override void WriteObject(ContentWriter writer) writer.WriteLineRaw(ToString()); } } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Pdf.Content/Chars.cs b/PdfSharpCore/Pdf.Content/Chars.cs index 1181f0aa..9f47eb12 100644 --- a/PdfSharpCore/Pdf.Content/Chars.cs +++ b/PdfSharpCore/Pdf.Content/Chars.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange diff --git a/PdfSharpCore/Pdf.Filters/PngFilter.cs b/PdfSharpCore/Pdf.Filters/PngFilter.cs index 7900c354..7a63e19d 100644 --- a/PdfSharpCore/Pdf.Filters/PngFilter.cs +++ b/PdfSharpCore/Pdf.Filters/PngFilter.cs @@ -1,4 +1,4 @@ -using PdfSharpCore.Pdf.IO; +using PdfSharpCore.Pdf.IO; using System; namespace PdfSharpCore.Pdf.Filters diff --git a/PdfSharpCore/Pdf.Filters/StreamDecoder.cs b/PdfSharpCore/Pdf.Filters/StreamDecoder.cs index 3740d74c..b71309b3 100644 --- a/PdfSharpCore/Pdf.Filters/StreamDecoder.cs +++ b/PdfSharpCore/Pdf.Filters/StreamDecoder.cs @@ -1,4 +1,4 @@ -using PdfSharpCore.Pdf.IO; +using PdfSharpCore.Pdf.IO; using System; namespace PdfSharpCore.Pdf.Filters diff --git a/PdfSharpCore/Pdf.IO/Chars.cs b/PdfSharpCore/Pdf.IO/Chars.cs index 283255f7..d14e1f9c 100644 --- a/PdfSharpCore/Pdf.IO/Chars.cs +++ b/PdfSharpCore/Pdf.IO/Chars.cs @@ -178,11 +178,11 @@ public sealed class Chars /// /// The soft hyphen. /// - public const char SoftHyphen = '­'; // char(173) + public const char SoftHyphen = '�'; // char(173) /// /// The currency sign. /// - public const char Currency = '¤'; + public const char Currency = '�'; // ReSharper restore InconsistentNaming } diff --git a/PdfSharpCore/Pdf.IO/Lexer.cs b/PdfSharpCore/Pdf.IO/Lexer.cs index c669b1c1..67407c64 100644 --- a/PdfSharpCore/Pdf.IO/Lexer.cs +++ b/PdfSharpCore/Pdf.IO/Lexer.cs @@ -188,11 +188,11 @@ internal long MoveToStartOfStream() { long pos; - // Skip illegal blanks behind «stream». + // Skip illegal blanks behind �stream�. while (_currChar == Chars.SP) ScanNextChar(true); - // Skip new line behind «stream». + // Skip new line behind �stream�. if (_currChar == Chars.CR) { if (_nextChar == Chars.LF) @@ -535,7 +535,7 @@ public Symbol ScanLiteralString() } // Phase 2: deal with UTF-16BE if necessary. - // UTF-16BE Unicode strings start with U+FEFF ("þÿ"). There can be empty strings with UTF-16BE prefix. + // UTF-16BE Unicode strings start with U+FEFF ("��"). There can be empty strings with UTF-16BE prefix. Phase2: if (_token.Length >= 2 && _token[0] == '\xFE' && _token[1] == '\xFF') { diff --git a/PdfSharpCore/Pdf.IO/Parser.cs b/PdfSharpCore/Pdf.IO/Parser.cs index 136d04b9..0830621b 100644 --- a/PdfSharpCore/Pdf.IO/Parser.cs +++ b/PdfSharpCore/Pdf.IO/Parser.cs @@ -192,8 +192,8 @@ public PdfObject ReadObject(PdfObject pdfObject, PdfObjectID objectID, bool incl break; // Acrobat 6 Professional proudly presents: The Null object! - // Even with a one-digit object number an indirect reference «x 0 R» to this object is - // one character larger than the direct use of «null». Probable this is the reason why + // Even with a one-digit object number an indirect reference �x 0 R� to this object is + // one character larger than the direct use of �null�. Probable this is the reason why // it is true that Acrobat Web Capture 6.0 creates this object, but obviously never // creates a reference to it! case Symbol.Null: @@ -1301,7 +1301,7 @@ private PdfTrailer ReadXRefStream(PdfCrossReferenceTable xrefTable) int prev = xrefStream.Elements.GetInteger(PdfCrossReferenceStream.Keys.Prev); PdfArray w = (PdfArray)xrefStream.Elements.GetValue(PdfCrossReferenceStream.Keys.W); - // E.g.: W[1 2 1] ¤ Index[7 12] ¤ Size 19 + // E.g.: W[1 2 1] � Index[7 12] � Size 19 // Setup subsections. int subsectionCount; @@ -1820,4 +1820,4 @@ public static uint ReadBytes(byte[] bytes, int index, int byteCount) return value; } } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Pdf.IO/PdfReader.cs b/PdfSharpCore/Pdf.IO/PdfReader.cs index 2cdb0b90..0ba43fd5 100644 --- a/PdfSharpCore/Pdf.IO/PdfReader.cs +++ b/PdfSharpCore/Pdf.IO/PdfReader.cs @@ -499,6 +499,13 @@ public static PdfDocument Open(Stream stream, string password, PdfDocumentOpenMo // Is type xref to compressed object? if (item.Type == 2) { + if (document._irefTable.ObjectTable.TryGetValue(new PdfObjectID(idx2), out var irefToRead) && irefToRead.Position > 0) + { + // The object has been overridden by a trailer with a specific position. + // Don't read from compressed objects. Continue on later to "read all indirect objects" + continue; + } + PdfReference irefNew = parser.ReadCompressedObject(new PdfObjectID((int)item.Field2), (int)item.Field3); Debug.Assert(document._irefTable.Contains(iref.ObjectID)); diff --git a/PdfSharpCore/Pdf.IO/PdfWriter.cs b/PdfSharpCore/Pdf.IO/PdfWriter.cs index d24e1532..c4b95063 100644 --- a/PdfSharpCore/Pdf.IO/PdfWriter.cs +++ b/PdfSharpCore/Pdf.IO/PdfWriter.cs @@ -199,7 +199,7 @@ public void Write(PdfString value) PdfStringEncoding encoding = (PdfStringEncoding)(value.Flags & PdfStringFlags.EncodingMask); string pdf = (value.Flags & PdfStringFlags.HexLiteral) == 0 ? PdfEncoders.ToStringLiteral(value.EncryptionValue, encoding == PdfStringEncoding.Unicode, SecurityHandler) : - PdfEncoders.ToHexStringLiteral(value.EncryptionValue, encoding == PdfStringEncoding.Unicode, SecurityHandler); + PdfEncoders.ToHexStringLiteral(value.EncryptionValue, encoding == PdfStringEncoding.Unicode, SecurityHandler, value.PaddingLeft); WriteRaw(pdf); _lastCat = CharCat.Delimiter; @@ -404,7 +404,7 @@ public void WriteStream(PdfDictionary value, bool omitStream) if (omitStream) { - WriteRaw(" «...stream content omitted...»\n"); // useful for debugging only + WriteRaw(" �...stream content omitted...�\n"); // useful for debugging only } else { diff --git a/PdfSharpCore/Pdf.IO/enums/PdfReadAccuracy.cs b/PdfSharpCore/Pdf.IO/enums/PdfReadAccuracy.cs index 9f62d3f9..0675027c 100644 --- a/PdfSharpCore/Pdf.IO/enums/PdfReadAccuracy.cs +++ b/PdfSharpCore/Pdf.IO/enums/PdfReadAccuracy.cs @@ -1,4 +1,4 @@ -namespace PdfSharpCore.Pdf.IO.enums +namespace PdfSharpCore.Pdf.IO.enums { public enum PdfReadAccuracy { diff --git a/PdfSharpCore/Pdf.Internal/AnsiEncoding.cs b/PdfSharpCore/Pdf.Internal/AnsiEncoding.cs index b38632a2..10b741e1 100644 --- a/PdfSharpCore/Pdf.Internal/AnsiEncoding.cs +++ b/PdfSharpCore/Pdf.Internal/AnsiEncoding.cs @@ -219,7 +219,7 @@ public static char UnicodeToAnsi(char ch) case '\u0178': return '\u009F'; } - return '\u00A4'; // Char 164 is ANSI value of '¤'. + return '\u00A4'; // Char 164 is ANSI value of '�'. } /// @@ -246,4 +246,4 @@ public static char UnicodeToAnsi(char ch) /* F0 */ '\u00F0', '\u00F1', '\u00F2', '\u00F3', '\u00F4', '\u00F5', '\u00F6', '\u00F7', '\u00F8', '\u00F9', '\u00FA', '\u00FB', '\u00FC', '\u00FD', '\u00FE', '\u00FF' }; } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Pdf.Internal/ColorSpaceHelper.cs b/PdfSharpCore/Pdf.Internal/ColorSpaceHelper.cs index dfe92d19..b87d2466 100644 --- a/PdfSharpCore/Pdf.Internal/ColorSpaceHelper.cs +++ b/PdfSharpCore/Pdf.Internal/ColorSpaceHelper.cs @@ -72,4 +72,4 @@ public static bool IsEqualCmyk(XColor x, XColor y) return x.C == y.C && x.M == y.M && x.Y == y.Y && x.K == y.K; } } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Pdf.Internal/DocEncoding.cs b/PdfSharpCore/Pdf.Internal/DocEncoding.cs index 88e456aa..daaa25b0 100644 --- a/PdfSharpCore/Pdf.Internal/DocEncoding.cs +++ b/PdfSharpCore/Pdf.Internal/DocEncoding.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange diff --git a/PdfSharpCore/Pdf.Internal/PdfDiagnostics.cs b/PdfSharpCore/Pdf.Internal/PdfDiagnostics.cs index 4a3b37c1..63073bef 100644 --- a/PdfSharpCore/Pdf.Internal/PdfDiagnostics.cs +++ b/PdfSharpCore/Pdf.Internal/PdfDiagnostics.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange diff --git a/PdfSharpCore/Pdf.Internal/PdfEncoders.cs b/PdfSharpCore/Pdf.Internal/PdfEncoders.cs index 7c050919..91576c6f 100644 --- a/PdfSharpCore/Pdf.Internal/PdfEncoders.cs +++ b/PdfSharpCore/Pdf.Internal/PdfEncoders.cs @@ -245,9 +245,9 @@ public static string ToStringLiteral(byte[] bytes, bool unicode, PdfStandardSecu /// /// Converts a raw string into a raw hexadecimal string literal, possibly encrypted. /// - public static string ToHexStringLiteral(string text, PdfStringEncoding encoding, PdfStandardSecurityHandler securityHandler) + public static string ToHexStringLiteral(string text, PdfStringEncoding encoding, PdfStandardSecurityHandler securityHandler, int paddingLeft) { - if (String.IsNullOrEmpty(text)) + if (String.IsNullOrEmpty(text) && paddingLeft == 0) return "<>"; byte[] bytes; @@ -274,10 +274,36 @@ public static string ToHexStringLiteral(string text, PdfStringEncoding encoding, throw new NotImplementedException(encoding.ToString()); } + if (bytes.Length < paddingLeft) + { + byte[] tmp = new byte[paddingLeft]; + Array.Copy(bytes, tmp, bytes.Length); + bytes = tmp; + } + byte[] agTemp = FormatStringLiteral(bytes, encoding == PdfStringEncoding.Unicode, true, true, securityHandler); return RawEncoding.GetString(agTemp, 0, agTemp.Length); } + /// + /// Converts a raw string into a raw hexadecimal string literal, possibly encrypted. + /// + public static string ToHexStringLiteral(byte[] bytes, bool unicode, PdfStandardSecurityHandler securityHandler, int paddingLeft) + { + if ((bytes == null || bytes.Length == 0) && paddingLeft == 0) + return "<>"; + + if (bytes.Length < paddingLeft) + { + byte[] tmp = new byte[paddingLeft]; + Array.Copy(bytes, tmp, bytes.Length); + bytes = tmp; + } + + byte[] agTemp = FormatStringLiteral(bytes, unicode, true, true, securityHandler); + return RawEncoding.GetString(agTemp, 0, agTemp.Length); + } + /// /// Converts a raw string into a raw hexadecimal string literal, possibly encrypted. /// diff --git a/PdfSharpCore/Pdf.Internal/ThreadLocalStorage.cs b/PdfSharpCore/Pdf.Internal/ThreadLocalStorage.cs index c5ac5550..e7e137ca 100644 --- a/PdfSharpCore/Pdf.Internal/ThreadLocalStorage.cs +++ b/PdfSharpCore/Pdf.Internal/ThreadLocalStorage.cs @@ -126,4 +126,4 @@ public void DetachDocument(PdfDocument.DocumentHandle handle) /// readonly Dictionary _importedDocuments; } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Pdf.Printing/PdfFilePrinter.cs b/PdfSharpCore/Pdf.Printing/PdfFilePrinter.cs index 55da8908..de1950f8 100644 --- a/PdfSharpCore/Pdf.Printing/PdfFilePrinter.cs +++ b/PdfSharpCore/Pdf.Printing/PdfFilePrinter.cs @@ -251,4 +251,4 @@ static public string DefaultPrinterName static string _defaultPrinterName; } } -#endif \ No newline at end of file +#endif diff --git a/PdfSharpCore/Pdf.Security/AESEncryptor.cs b/PdfSharpCore/Pdf.Security/AESEncryptor.cs index aec5c2d4..2ca0a9e1 100644 --- a/PdfSharpCore/Pdf.Security/AESEncryptor.cs +++ b/PdfSharpCore/Pdf.Security/AESEncryptor.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Linq; using System.Security.Cryptography; diff --git a/PdfSharpCore/Pdf.Security/EncryptorBase.cs b/PdfSharpCore/Pdf.Security/EncryptorBase.cs index 96ef3385..c42d2653 100644 --- a/PdfSharpCore/Pdf.Security/EncryptorBase.cs +++ b/PdfSharpCore/Pdf.Security/EncryptorBase.cs @@ -1,4 +1,4 @@ -using PdfSharpCore.Pdf.Internal; +using PdfSharpCore.Pdf.Internal; using System; using System.Security.Cryptography; diff --git a/PdfSharpCore/Pdf.Security/EncryptorFactory.cs b/PdfSharpCore/Pdf.Security/EncryptorFactory.cs index f0e8ab33..0fc7e2a1 100644 --- a/PdfSharpCore/Pdf.Security/EncryptorFactory.cs +++ b/PdfSharpCore/Pdf.Security/EncryptorFactory.cs @@ -1,4 +1,4 @@ -using PdfSharpCore.Pdf.IO; +using PdfSharpCore.Pdf.IO; namespace PdfSharpCore.Pdf.Security { diff --git a/PdfSharpCore/Pdf.Security/IEncryptor.cs b/PdfSharpCore/Pdf.Security/IEncryptor.cs index 005c59b8..d53ee92d 100644 --- a/PdfSharpCore/Pdf.Security/IEncryptor.cs +++ b/PdfSharpCore/Pdf.Security/IEncryptor.cs @@ -18,4 +18,4 @@ internal interface IEncryptor byte[] Encrypt(byte[] bytes); } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Pdf.Security/PdfSecurityHandler.cs b/PdfSharpCore/Pdf.Security/PdfSecurityHandler.cs index 59399297..3a34f0ec 100644 --- a/PdfSharpCore/Pdf.Security/PdfSecurityHandler.cs +++ b/PdfSharpCore/Pdf.Security/PdfSecurityHandler.cs @@ -109,18 +109,18 @@ internal class Keys : KeysBase /// /// (Optional) The method used, if any, by the consumer application to decrypt data. /// The following values are supported: - /// • None The application does not decrypt data but directs the input + /// � None The application does not decrypt data but directs the input /// stream to the security handler for decryption. (See implementation /// note 30 in Appendix H.) - /// • V2 The application asks the security handler for the encryption key + /// � V2 The application asks the security handler for the encryption key /// and implicitly decrypts data with Algorithm 3.1, using the RC4 algorithm. - /// • AESV2(PDF 1.6) The application asks the security handler for the + /// � AESV2(PDF 1.6) The application asks the security handler for the /// encryption key and implicitly decrypts data with Algorithm 3.1, using /// the AES-128 algorithm in Cipher Block Chaining(CBC) with padding /// mode with a 16-byte block size and an initialization vector that is /// randomly generated and placed as the first 16 bytes in the stream or /// string. The key size(Length) shall be 128 bits. - /// • AESV3(ExtensionLevel 3) The application asks the security handler + /// � AESV3(ExtensionLevel 3) The application asks the security handler /// for the encryption key and implicitly decrypts data with /// Algorithm 3.1a, using the AES-256 algorithm in Cipher Block /// Chaining(CBC) with padding mode with a 16-byte block size and an diff --git a/PdfSharpCore/Pdf.Security/PdfStandardSecurityHandler.cs b/PdfSharpCore/Pdf.Security/PdfStandardSecurityHandler.cs index 9ee42857..b7069647 100644 --- a/PdfSharpCore/Pdf.Security/PdfStandardSecurityHandler.cs +++ b/PdfSharpCore/Pdf.Security/PdfStandardSecurityHandler.cs @@ -644,13 +644,13 @@ internal override void WriteObject(PdfWriter writer) /// /// (Required) A number specifying which revision of the standard security handler /// should be used to interpret this dictionary: - /// • 2 if the document is encrypted with a V value less than 2 and does not have any of + /// � 2 if the document is encrypted with a V value less than 2 and does not have any of /// the access permissions set (by means of the P entry, below) that are designated /// "Revision 3 or greater". - /// • 3 if the document is encrypted with a V value of 2 or 3, or has any "Revision 3 or + /// � 3 if the document is encrypted with a V value of 2 or 3, or has any "Revision 3 or /// greater" access permissions set. - /// • 4 if the document is encrypted with a V value of 4 - /// • 5 (ExtensionLevel 3) if the document is encrypted with a V value of 5 + /// � 4 if the document is encrypted with a V value of 4 + /// � 5 (ExtensionLevel 3) if the document is encrypted with a V value of 5 /// [KeyInfo(KeyType.Integer | KeyType.Required)] public const string R = "/R"; @@ -659,9 +659,9 @@ internal override void WriteObject(PdfWriter writer) /// (Required) A string used in computing the encryption key. /// The value of the string depends on the value of the /// revision number, the R entry described above. - /// • The value of R is 4 or less: A 32-byte string, based on both the owner and user passwords, that is used in + /// � The value of R is 4 or less: A 32-byte string, based on both the owner and user passwords, that is used in /// computing the encryption key and in determining whether a valid owner password was entered. - /// • The value for R is 5: (ExtensionLevel 3) A 48-byte string, based on the owner and user passwords, that is used in + /// � The value for R is 5: (ExtensionLevel 3) A 48-byte string, based on the owner and user passwords, that is used in /// computing the encryption key and in determining whether a valid owner password was entered. /// [KeyInfo(KeyType.String | KeyType.Required)] @@ -670,9 +670,9 @@ internal override void WriteObject(PdfWriter writer) /// /// (Required) A string based on the user password. The value /// of the string depends on the value of the revision number, the R entry described above. - /// • The value of R is 4 or less: A 32-byte string, based on the user password, that is used in determining + /// � The value of R is 4 or less: A 32-byte string, based on the user password, that is used in determining /// whether to prompt the user for a password and, if so, whether a valid user or owner password was entered. - /// • The value for R is 5: (ExtensionLevel 3) A 48-byte string, based on the user password, that is used in + /// � The value for R is 5: (ExtensionLevel 3) A 48-byte string, based on the user password, that is used in /// determining whether to prompt the user for a password and, if so, whether a valid user password was entered. /// [KeyInfo(KeyType.String | KeyType.Required)] diff --git a/PdfSharpCore/Pdf.Security/RC4Encryptor.cs b/PdfSharpCore/Pdf.Security/RC4Encryptor.cs index 75db29b2..06a6177a 100644 --- a/PdfSharpCore/Pdf.Security/RC4Encryptor.cs +++ b/PdfSharpCore/Pdf.Security/RC4Encryptor.cs @@ -1,4 +1,4 @@ -using PdfSharpCore.Pdf.Internal; +using PdfSharpCore.Pdf.Internal; using System; namespace PdfSharpCore.Pdf.Security diff --git a/PdfSharpCore/Pdf.Security/enums/PdfUserAccessPermission.cs b/PdfSharpCore/Pdf.Security/enums/PdfUserAccessPermission.cs index 764badae..c2622116 100644 --- a/PdfSharpCore/Pdf.Security/enums/PdfUserAccessPermission.cs +++ b/PdfSharpCore/Pdf.Security/enums/PdfUserAccessPermission.cs @@ -42,7 +42,7 @@ internal enum PdfUserAccessPermission /// PermitAll = -3, // = 0xFFFFFFFC, - // Bit 1–2 Reserved; must be 0. + // Bit 1�2 Reserved; must be 0. // Bit 3 (Revision 2) Print the document. // (Revision 3 or greater) Print the document (possibly not at the highest @@ -65,7 +65,7 @@ internal enum PdfUserAccessPermission // signature fields). PermitAnnotations = 0x00000020, //1 << (6 - 1), - // Bit 7–8 Reserved; must be 1. + // Bit 7�8 Reserved; must be 1. // 9 (Revision 3 or greater) Fill in existing interactive form fields (including // signature fields), even if bit 6 is clear. @@ -87,6 +87,6 @@ internal enum PdfUserAccessPermission // (See implementation note 24 in Appendix H.) PermitFullQualityPrint = 0x00000800, //1 << (12 - 1), - //Bit 13–32 (Revision 3 or greater) Reserved; must be 1. + //Bit 13�32 (Revision 3 or greater) Reserved; must be 1. } } diff --git a/PdfSharpCore/Pdf.Signatures/DefaultAppearanceHandler.cs b/PdfSharpCore/Pdf.Signatures/DefaultAppearanceHandler.cs new file mode 100644 index 00000000..c2c48f95 --- /dev/null +++ b/PdfSharpCore/Pdf.Signatures/DefaultAppearanceHandler.cs @@ -0,0 +1,32 @@ +using System; +using PdfSharpCore.Drawing; +using PdfSharpCore.Drawing.Layout; + +namespace PdfSharpCore.Pdf.Signatures +{ + internal class DefaultAppearanceHandler : ISignatureAppearanceHandler + { + public string Location { get; set; } + public string Reason { get; set; } + public string Signer { get; set; } + + + public void RenderAppearance(XGraphics gfx, XRect rect) + { + var backColor = XColor.Empty; + var defaultText = string.Format("Signed by: {0}\nLocation: {1}\nReason: {2}\nDate: {3}", Signer, Location, Reason, DateTime.Now); + + XFont font = new XFont("Verdana", 7, XFontStyle.Regular); + + XTextFormatter txtFormat = new XTextFormatter(gfx); + + var currentPosition = new XPoint(0, 0); + + txtFormat.DrawString(defaultText, + font, + new XSolidBrush(XColor.FromKnownColor(XKnownColor.Black)), + new XRect(currentPosition.X, currentPosition.Y, rect.Width - currentPosition.X, rect.Height), + XStringFormats.TopLeft); + } + } +} diff --git a/PdfSharpCore/Pdf.Signatures/DefaultSigner.cs b/PdfSharpCore/Pdf.Signatures/DefaultSigner.cs new file mode 100644 index 00000000..e04ddc83 --- /dev/null +++ b/PdfSharpCore/Pdf.Signatures/DefaultSigner.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Security.Cryptography.Pkcs; +using System.Security.Cryptography.X509Certificates; +using System.Text; + +namespace PdfSharpCore.Pdf.Signatures +{ + public class DefaultSigner : ISigner + { + public X509Certificate2 Certificate { get; private set; } + + public DefaultSigner(X509Certificate2 Certificate) + { + this.Certificate = Certificate; + } + + public byte[] GetSignedCms(Stream stream) + { + var range = new byte[stream.Length]; + + stream.Position = 0; + stream.Read(range, 0, range.Length); + + + + var contentInfo = new ContentInfo(range); + + SignedCms signedCms = new SignedCms(contentInfo, true); + CmsSigner signer = new CmsSigner(Certificate); + signer.UnsignedAttributes.Add(new Pkcs9SigningTime()); + + signedCms.ComputeSignature(signer, true); + var bytes = signedCms.Encode(); + + return bytes; + } + + + + public string GetName() + { + return Certificate.GetNameInfo(X509NameType.SimpleName, false); + } + } +} diff --git a/PdfSharpCore/Pdf.Signatures/ISignatureAppearanceHandler.cs b/PdfSharpCore/Pdf.Signatures/ISignatureAppearanceHandler.cs new file mode 100644 index 00000000..35064985 --- /dev/null +++ b/PdfSharpCore/Pdf.Signatures/ISignatureAppearanceHandler.cs @@ -0,0 +1,9 @@ +using PdfSharpCore.Drawing; + +namespace PdfSharpCore.Pdf.Signatures +{ + public interface ISignatureAppearanceHandler + { + void RenderAppearance(XGraphics gfx, XRect rect); + } +} diff --git a/PdfSharpCore/Pdf.Signatures/ISigner.cs b/PdfSharpCore/Pdf.Signatures/ISigner.cs new file mode 100644 index 00000000..3c6ea2cf --- /dev/null +++ b/PdfSharpCore/Pdf.Signatures/ISigner.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; + +namespace PdfSharpCore.Pdf.Signatures +{ + public interface ISigner + { + byte[] GetSignedCms(Stream stream); + + string GetName(); + + } +} diff --git a/PdfSharpCore/Pdf.Signatures/PdfSignatureHandler.cs b/PdfSharpCore/Pdf.Signatures/PdfSignatureHandler.cs new file mode 100644 index 00000000..79a7dd10 --- /dev/null +++ b/PdfSharpCore/Pdf.Signatures/PdfSignatureHandler.cs @@ -0,0 +1,159 @@ +using PdfSharpCore.Drawing; +using PdfSharpCore.Pdf; +using PdfSharpCore.Pdf.AcroForms; +using PdfSharpCore.Pdf.Advanced; +using PdfSharpCore.Pdf.Annotations; +using PdfSharpCore.Pdf.Signatures; +using System; +using System.Collections.Generic; +using System.IO; +using System.Net.Security; +using System.Security.Cryptography.Pkcs; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Xml.Linq; +using static PdfSharpCore.Pdf.AcroForms.PdfAcroField; + +namespace PdfSharpCore.Pdf.Signatures +{ + public class IntEventArgs : EventArgs { public int Value { get; set; } } + + /// + /// Handles the signature + /// + public class PdfSignatureHandler + { + + private PositionTracker contentsTraker; + private PositionTracker rangeTracker; + private int? maximumSignatureLength; + private const int byteRangePaddingLength = 36; // the place big enough required to replace [0 0 0 0] with the correct value + + public event EventHandler SignatureSizeComputed = (s, e) => { }; + + public PdfDocument Document { get; private set; } + public PdfSignatureOptions Options { get; private set; } + private ISigner signer { get; set; } + + public void AttachToDocument(PdfDocument documentToSign) + { + this.Document = documentToSign; + this.Document.BeforeSave += AddSignatureComponents; + this.Document.AfterSave += ComputeSignatureAndRange; + + if (!maximumSignatureLength.HasValue) + { + maximumSignatureLength = signer.GetSignedCms(new MemoryStream(new byte[] { 0})).Length; + SignatureSizeComputed(this, new IntEventArgs() { Value = maximumSignatureLength.Value }); + } + } + + public PdfSignatureHandler(ISigner signer, PdfSignatureOptions options, int? signatureMaximumLength = null) + { + this.signer = signer; + this.maximumSignatureLength = signatureMaximumLength; + this.Options = options; + } + + private void ComputeSignatureAndRange(object sender, PdfDocumentEventArgs e) + { + var writer = e.Writer; + writer.Stream.Position = rangeTracker.Start; + var rangeArray = new PdfArray(new PdfInteger(0), + new PdfInteger((int)contentsTraker.Start), + new PdfInteger((int)contentsTraker.End), + new PdfInteger((int)(writer.Stream.Length - contentsTraker.End))); + rangeArray.Write(writer); + + var rangeToSign = GetRangeToSign(writer.Stream); + + var signature = signer.GetSignedCms(rangeToSign); + if (signature.Length > maximumSignatureLength) + throw new Exception("The signature length is bigger that the approximation made."); + + var hexFormated = Encoding.Default.GetBytes(FormatHex(signature)); + + writer.Stream.Position = contentsTraker.Start+1; + writer.Write(hexFormated); + } + + string FormatHex(byte[] bytes) + { + var retval = new StringBuilder(); + + for (int idx = 0; idx < bytes.Length; idx++) + retval.AppendFormat("{0:x2}", bytes[idx]); + + return retval.ToString(); + } + + private RangedStream GetRangeToSign(Stream stream) + { + return new RangedStream(stream, new List() + { + new RangedStream.Range(0, contentsTraker.Start), + new RangedStream.Range(contentsTraker.End, stream.Length - contentsTraker.End) + }); + + } + + private void AddSignatureComponents(object sender, EventArgs e) + { + var catalog = Document.Catalog; + + if (catalog.AcroForm == null) + catalog.AcroForm = new PdfAcroForm(Document); + + if (catalog.AcroForm.Elements.ContainsKey(PdfAcroForm.Keys.SigFlags)) + { + catalog.AcroForm.Elements.Remove(PdfAcroForm.Keys.SigFlags); + } + catalog.AcroForm.Elements.Add(PdfAcroForm.Keys.SigFlags, new PdfInteger(3)); + + PdfSignatureField signature = Options.FieldName == null ? null : catalog.AcroForm.Fields[Options.FieldName] as PdfSignatureField; + bool isNew = signature == null; + + if (isNew) + { + signature = new PdfSignatureField(Document); + signature.Elements[Keys.T] = new PdfString(Options.FieldName ?? "Signature1"); + } + + if (isNew || (Options.Rectangle != XRect.Empty && Options.Rectangle != default)) + { + signature.Rectangle = new PdfRectangle(Options.Rectangle); + } + + var paddedContents = new PdfString("", PdfStringFlags.HexLiteral, maximumSignatureLength.Value); + var paddedRange = new PdfArray(Document, byteRangePaddingLength, new PdfInteger(0), new PdfInteger(0), new PdfInteger(0), new PdfInteger(0)); + + this.contentsTraker = new PositionTracker(paddedContents); + this.rangeTracker = new PositionTracker(paddedRange); + + signature.Contents = paddedContents; + signature.ByteRange = paddedRange; + signature.Reason = Options.Reason; + signature.Location = Options.Location; + + if (signature.IsVisible) + { + signature.RenderAppearance(Options.AppearanceHandler ?? new DefaultAppearanceHandler() + { + Location = Options.Location, + Reason = Options.Reason, + Signer = signer.GetName() + }); + } + + if (isNew) + { + if (!Document.Pages[0].Elements.ContainsKey(PdfPage.Keys.Annots)) + Document.Pages[0].Elements.Add(PdfPage.Keys.Annots, new PdfArray(Document)); + + (Document.Pages[0].Elements[PdfPage.Keys.Annots] as PdfArray).Elements.Add(signature); + + catalog.AcroForm.Fields.Elements.Add(signature); + } + } + } +} diff --git a/PdfSharpCore/Pdf.Signatures/PdfSignatureOptions.cs b/PdfSharpCore/Pdf.Signatures/PdfSignatureOptions.cs new file mode 100644 index 00000000..0ac4a8c0 --- /dev/null +++ b/PdfSharpCore/Pdf.Signatures/PdfSignatureOptions.cs @@ -0,0 +1,17 @@ +using PdfSharpCore.Drawing; +using System; +using System.Collections.Generic; +using System.Text; + +namespace PdfSharpCore.Pdf.Signatures +{ + public class PdfSignatureOptions + { + public string FieldName { get; set; } + public ISignatureAppearanceHandler AppearanceHandler { get; set; } + public string ContactInfo { get; set; } + public string Location { get; set; } + public string Reason { get; set; } + public XRect Rectangle { get; set; } + } +} diff --git a/PdfSharpCore/Pdf.Signatures/PositionTracker.cs b/PdfSharpCore/Pdf.Signatures/PositionTracker.cs new file mode 100644 index 00000000..b0e6a328 --- /dev/null +++ b/PdfSharpCore/Pdf.Signatures/PositionTracker.cs @@ -0,0 +1,18 @@ +namespace PdfSharpCore.Pdf.Signatures +{ + internal class PositionTracker + { + public PdfItem Item { get; private set; } + public long Start { get; private set; } + public long End { get; private set; } + + public PositionTracker(PdfItem item) + { + Item = item; + Item.BeforeWrite += (s, e) => + this.Start = e.Position; + Item.AfterWrite += (s, e) => + this.End = e.Position; + } + } +} diff --git a/PdfSharpCore/Pdf.Signatures/RangedStream.cs b/PdfSharpCore/Pdf.Signatures/RangedStream.cs new file mode 100644 index 00000000..7e2a61b6 --- /dev/null +++ b/PdfSharpCore/Pdf.Signatures/RangedStream.cs @@ -0,0 +1,173 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; + +namespace PdfSharpCore.Pdf.Signatures +{ + public class RangedStream : Stream + { + private Range[] ranges; + + public class Range + { + + public Range(long offset, long length) + { + this.Offset = offset; + this.Length = length; + } + public long Offset { get; set; } + public long Length { get; set; } + } + + private Stream stream { get; set; } + + + public RangedStream(Stream originalStrem, List ranges) + { + this.stream = originalStrem; + + long previousPosition = 0; + + this.ranges = ranges.OrderBy(item => item.Offset).ToArray(); + foreach (var range in ranges) + { + if (range.Offset < previousPosition) + throw new Exception("Ranges are not continuous"); + previousPosition = range.Offset + range.Length ; + } + } + + + public override bool CanRead + { + get + { + throw new NotImplementedException(); + } + } + + public override bool CanSeek + { + get + { + throw new NotImplementedException(); + } + } + + public override bool CanWrite + { + get + { + return false; + } + } + + public override long Length + { + get + { + return ranges.Sum(item => item.Length); + } + } + + + private IEnumerable GetPreviousRanges(long position) + { + return ranges.Where(item => item.Offset < position && item.Offset + item.Length < position); + } + + private Range GetCurrentRange(long position) + { + return ranges.FirstOrDefault(item => item.Offset <= position && item.Offset + item.Length > position); + } + + + + public override long Position + { + get + { + return GetPreviousRanges(stream.Position).Sum(item => item.Length) + stream.Position - GetCurrentRange(stream.Position).Offset; + } + + set + { + Range currentRange = null; + List previousRanges = new List(); + long maxPosition = 0; + foreach (var range in ranges) + { + currentRange = range; + maxPosition += range.Length; + if (maxPosition > value) + break; + previousRanges.Add(range); + } + + long positionInCurrentRange = value - previousRanges.Sum(item => item.Length); + stream.Position = currentRange.Offset + positionInCurrentRange; + } + } + + + + public override void Flush() + { + throw new NotImplementedException(); + } + + public override int Read(byte[] buffer, int offset, int count) + { + + var length = stream.Length; + int retVal = 0; + for (int i = 0; i < count; i++) + { + + if (stream.Position == length) + { + break; + } + + PerformSkipIfNeeded(); + retVal += stream.Read(buffer, offset++, 1); + + } + + return retVal; + } + + + private void PerformSkipIfNeeded() + { + var currentRange = GetCurrentRange(stream.Position); + + if (currentRange == null) + stream.Position = GetNextRange().Offset; + } + + private Range GetNextRange() + { + return ranges.OrderBy(item => item.Offset).First(item => item.Offset > stream.Position); + } + + + public override long Seek(long offset, SeekOrigin origin) + { + throw new NotImplementedException(); + } + + public override void SetLength(long value) + { + throw new NotImplementedException(); + } + + public override void Write(byte[] buffer, int offset, int count) + { + throw new NotImplementedException(); + } + } +} diff --git a/PdfSharpCore/Pdf/EntryInfoAttribute.cs b/PdfSharpCore/Pdf/EntryInfoAttribute.cs index 942b947f..c7e49f22 100644 --- a/PdfSharpCore/Pdf/EntryInfoAttribute.cs +++ b/PdfSharpCore/Pdf/EntryInfoAttribute.cs @@ -138,4 +138,4 @@ public string FixedValue } string _fixedValue; } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Pdf/PdfArray.cs b/PdfSharpCore/Pdf/PdfArray.cs index 0b43ce0c..23d21018 100644 --- a/PdfSharpCore/Pdf/PdfArray.cs +++ b/PdfSharpCore/Pdf/PdfArray.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange @@ -70,6 +70,19 @@ public PdfArray(PdfDocument document, params PdfItem[] items) Elements.Add(item); } + + public PdfArray(params PdfItem[] items) + { + foreach (PdfItem item in items) + Elements.Add(item); + } + + public PdfArray(PdfDocument document, int paddingRight, params PdfItem[] items) + : this(document, items) + { + this.PaddingRight = paddingRight; + } + /// /// Initializes a new instance from an existing dictionary. Used for object type transformation. /// @@ -118,6 +131,8 @@ public ArrayElements Elements get { return _elements ?? (_elements = new ArrayElements(this)); } } + public int PaddingRight { get; private set; } + /// /// Returns an enumerator that iterates through a collection. /// @@ -152,9 +167,17 @@ internal override void WriteObject(PdfWriter writer) for (int idx = 0; idx < count; idx++) { PdfItem value = Elements[idx]; - value.WriteObject(writer); + value.Write(writer); } writer.WriteEndObject(); + if (PaddingRight > 0) + { + var bytes = new byte[PaddingRight]; + for (int i = 0; i < PaddingRight; i++) + bytes[i] = 32; + + writer.Write(bytes); + } } /// diff --git a/PdfSharpCore/Pdf/PdfBooleanObject.cs b/PdfSharpCore/Pdf/PdfBooleanObject.cs index 28d89052..96d17804 100644 --- a/PdfSharpCore/Pdf/PdfBooleanObject.cs +++ b/PdfSharpCore/Pdf/PdfBooleanObject.cs @@ -82,7 +82,7 @@ public override string ToString() } /// - /// Writes the keyword «false» or «true». + /// Writes the keyword �false� or �true�. /// internal override void WriteObject(PdfWriter writer) { diff --git a/PdfSharpCore/Pdf/PdfDictionary.cs b/PdfSharpCore/Pdf/PdfDictionary.cs index 65a529f2..e6a6ef79 100644 --- a/PdfSharpCore/Pdf/PdfDictionary.cs +++ b/PdfSharpCore/Pdf/PdfDictionary.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange @@ -235,8 +235,8 @@ internal virtual void WriteDictionaryElement(PdfWriter writer, PdfName key) Debug.Assert(false, "Check when we come here."); } #endif - key.WriteObject(writer); - item.WriteObject(writer); + key.Write(writer); + item.Write(writer); writer.NewLine(); } diff --git a/PdfSharpCore/Pdf/PdfDocument.cs b/PdfSharpCore/Pdf/PdfDocument.cs index 674ef4b0..c37807bd 100644 --- a/PdfSharpCore/Pdf/PdfDocument.cs +++ b/PdfSharpCore/Pdf/PdfDocument.cs @@ -44,12 +44,19 @@ namespace PdfSharpCore.Pdf { + internal class PdfDocumentEventArgs : EventArgs + { + public PdfWriter Writer { get; set; } + } + /// /// Represents a PDF document. /// [DebuggerDisplay("(Name={Name})")] // A name makes debugging easier public sealed class PdfDocument : PdfObject, IDisposable { + internal event EventHandler BeforeSave = (s, e) => { }; + internal event EventHandler AfterSave = (s, e) => { }; internal DocumentState _state; internal PdfDocumentOpenMode _openMode; @@ -249,7 +256,7 @@ public void Save(string path) throw new InvalidOperationException(PSSR.CannotModify); - using (Stream stream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.None)) + using (Stream stream = new FileStream(path, FileMode.Create, FileAccess.ReadWrite, FileShare.None)) { Save(stream); } @@ -308,6 +315,8 @@ public void Save(Stream stream) /// void DoSave(PdfWriter writer) { + this.BeforeSave(this, EventArgs.Empty); + if (_pages == null || _pages.Count == 0) { if (_outStream != null) @@ -358,13 +367,13 @@ void DoSave(PdfWriter writer) GetType(); #endif iref.Position = writer.Position; - iref.Value.WriteObject(writer); + iref.Value.Write(writer); } var startxref = writer.Position; _irefTable.WriteObject(writer); writer.WriteRaw("trailer\n"); _trailer.Elements.SetInteger("/Size", count + 1); - _trailer.WriteObject(writer); + _trailer.Write(writer); writer.WriteEof(this, startxref); //if (encrypt) @@ -377,6 +386,7 @@ void DoSave(PdfWriter writer) { if (writer != null) { + this.AfterSave(this, new PdfDocumentEventArgs() { Writer = writer }); writer.Stream.Flush(); // DO NOT CLOSE WRITER HERE //writer.Close(); diff --git a/PdfSharpCore/Pdf/PdfDocumentInformation.cs b/PdfSharpCore/Pdf/PdfDocumentInformation.cs index 55116c30..06c777d7 100644 --- a/PdfSharpCore/Pdf/PdfDocumentInformation.cs +++ b/PdfSharpCore/Pdf/PdfDocumentInformation.cs @@ -128,7 +128,7 @@ public DateTime ModificationDate internal sealed class Keys : KeysBase { /// - /// (Optional; PDF 1.1) The document’s title. + /// (Optional; PDF 1.1) The document�s title. /// [KeyInfo(KeyType.String | KeyType.Optional)] public const string Title = "/Title"; diff --git a/PdfSharpCore/Pdf/PdfDocumentOptions.cs b/PdfSharpCore/Pdf/PdfDocumentOptions.cs index fe545a22..46cd5bd9 100644 --- a/PdfSharpCore/Pdf/PdfDocumentOptions.cs +++ b/PdfSharpCore/Pdf/PdfDocumentOptions.cs @@ -108,4 +108,4 @@ public PdfUseFlateDecoderForJpegImages UseFlateDecoderForJpegImages } PdfUseFlateDecoderForJpegImages _useFlateDecoderForJpegImages = PdfUseFlateDecoderForJpegImages.Never; } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Pdf/PdfDocumentSettings.cs b/PdfSharpCore/Pdf/PdfDocumentSettings.cs index 64423690..25d05ff0 100644 --- a/PdfSharpCore/Pdf/PdfDocumentSettings.cs +++ b/PdfSharpCore/Pdf/PdfDocumentSettings.cs @@ -65,4 +65,4 @@ public TrimMargins TrimMargins } TrimMargins _trimMargins = new TrimMargins(); } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Pdf/PdfInteger.cs b/PdfSharpCore/Pdf/PdfInteger.cs index 4611ec0d..39908a03 100644 --- a/PdfSharpCore/Pdf/PdfInteger.cs +++ b/PdfSharpCore/Pdf/PdfInteger.cs @@ -185,4 +185,4 @@ string IFormattable.ToString(string _value, IFormatProvider provider) #endregion } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Pdf/PdfItem.cs b/PdfSharpCore/Pdf/PdfItem.cs index 6abfb375..6385d6bb 100644 --- a/PdfSharpCore/Pdf/PdfItem.cs +++ b/PdfSharpCore/Pdf/PdfItem.cs @@ -32,12 +32,19 @@ namespace PdfSharpCore.Pdf { + public class PdfItemEventArgs : EventArgs + { + public long Position { get; set; } + } + /// /// The base class of all PDF objects and simple PDF types. /// public abstract class PdfItem : ICloneable { // All simple types (i.e. derived from PdfItem but not from PdfObject) must be immutable. + internal event EventHandler BeforeWrite; + internal event EventHandler AfterWrite; object ICloneable.Clone() { @@ -65,5 +72,14 @@ protected virtual object Copy() /// to the specified PdfWriter. /// internal abstract void WriteObject(PdfWriter writer); + + internal void Write(PdfWriter writer) + { + var startPosition = writer.Layout == PdfWriterLayout.Verbose ? writer.Position + 1 : writer.Position; + + this.BeforeWrite?.Invoke(this, new PdfItemEventArgs() { Position = startPosition }); + WriteObject(writer); + this.AfterWrite?.Invoke(this, new PdfItemEventArgs() { Position = writer.Position }); + } } } diff --git a/PdfSharpCore/Pdf/PdfLong.cs b/PdfSharpCore/Pdf/PdfLong.cs index ab85a1b5..2af81661 100644 --- a/PdfSharpCore/Pdf/PdfLong.cs +++ b/PdfSharpCore/Pdf/PdfLong.cs @@ -222,4 +222,4 @@ public uint ToUInt32(IFormatProvider provider) #endregion } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Pdf/PdfNullObject.cs b/PdfSharpCore/Pdf/PdfNullObject.cs index eff9f25e..534b7bb4 100644 --- a/PdfSharpCore/Pdf/PdfNullObject.cs +++ b/PdfSharpCore/Pdf/PdfNullObject.cs @@ -62,7 +62,7 @@ public override string ToString() } /// - /// Writes the keyword «null». + /// Writes the keyword �null�. /// internal override void WriteObject(PdfWriter writer) { diff --git a/PdfSharpCore/Pdf/PdfObject.cs b/PdfSharpCore/Pdf/PdfObject.cs index b582cbd9..c1a2db45 100644 --- a/PdfSharpCore/Pdf/PdfObject.cs +++ b/PdfSharpCore/Pdf/PdfObject.cs @@ -599,4 +599,4 @@ public PdfReference Reference } PdfReference _iref; } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Pdf/PdfOutline.cs b/PdfSharpCore/Pdf/PdfOutline.cs index 39f5b5f9..3a0648a0 100644 --- a/PdfSharpCore/Pdf/PdfOutline.cs +++ b/PdfSharpCore/Pdf/PdfOutline.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange diff --git a/PdfSharpCore/Pdf/PdfPage.cs b/PdfSharpCore/Pdf/PdfPage.cs index 1d69ecb3..4cef93f2 100644 --- a/PdfSharpCore/Pdf/PdfPage.cs +++ b/PdfSharpCore/Pdf/PdfPage.cs @@ -759,7 +759,7 @@ internal sealed class Keys : InheritablePageKeys /// /// (Required if PieceInfo is present; optional otherwise; PDF 1.3) The date and time - /// when the page’s contents were most recently modified. If a page-piece dictionary + /// when the page�s contents were most recently modified. If a page-piece dictionary /// (PieceInfo) is present, the modification date is used to ascertain which of the /// application data dictionaries that it contains correspond to the current content /// of the page. @@ -785,8 +785,8 @@ internal sealed class Keys : InheritablePageKeys /// /// (Optional; PDF 1.3) A rectangle, expressed in default user space units, defining the - /// extent of the page’s meaningful content (including potential white space) as intended - /// by the page’s creator. Default value: the value of CropBox. + /// extent of the page�s meaningful content (including potential white space) as intended + /// by the page�s creator. Default value: the value of CropBox. /// [KeyInfo("1.3", KeyType.Rectangle | KeyType.Optional)] public const string ArtBox = "/ArtBox"; @@ -807,21 +807,21 @@ internal sealed class Keys : InheritablePageKeys /// in order, to form a single stream. This allows PDF producers to create image objects and /// other resources as they occur, even though they interrupt the content stream. The division /// between streams may occur only at the boundaries between lexical tokens but is unrelated - /// to the page’s logical content or organization. Applications that consume or produce PDF + /// to the page�s logical content or organization. Applications that consume or produce PDF /// files are not required to preserve the existing structure of the Contents array. /// [KeyInfo(KeyType.Array | KeyType.Stream | KeyType.Optional)] public const string Contents = "/Contents"; /// - /// (Optional; PDF 1.4) A group attributes dictionary specifying the attributes of the page’s + /// (Optional; PDF 1.4) A group attributes dictionary specifying the attributes of the page�s /// page group for use in the transparent imaging model. /// [KeyInfo("1.4", KeyType.Dictionary | KeyType.Optional)] public const string Group = "/Group"; /// - /// (Optional) A stream object defining the page’s thumbnail image. + /// (Optional) A stream object defining the page�s thumbnail image. /// [KeyInfo(KeyType.Stream | KeyType.Optional)] public const string Thumb = "/Thumb"; @@ -835,7 +835,7 @@ internal sealed class Keys : InheritablePageKeys public const string B = "/B"; /// - /// (Optional; PDF 1.1) The page’s display duration (also called its advance timing): the + /// (Optional; PDF 1.1) The page�s display duration (also called its advance timing): the /// maximum length of time, in seconds, that the page is displayed during presentations before /// the viewer application automatically advances to the next page. By default, the viewer does /// not advance automatically. @@ -878,20 +878,20 @@ internal sealed class Keys : InheritablePageKeys /// /// (Required if the page contains structural content items; PDF 1.3) - /// The integer key of the page’s entry in the structural parent tree. + /// The integer key of the page�s entry in the structural parent tree. /// [KeyInfo(KeyType.Integer | KeyType.Optional)] public const string StructParents = "/StructParents"; /// /// (Optional; PDF 1.3; indirect reference preferred) The digital identifier of - /// the page’s parent Web Capture content set. + /// the page�s parent Web Capture content set. /// [KeyInfo("1.3", KeyType.String | KeyType.Optional)] public const string ID = "/ID"; /// - /// (Optional; PDF 1.3) The page’s preferred zoom (magnification) factor: the factor + /// (Optional; PDF 1.3) The page�s preferred zoom (magnification) factor: the factor /// by which it should be scaled to achieve the natural display magnification. /// [KeyInfo("1.3", KeyType.Real | KeyType.Optional)] diff --git a/PdfSharpCore/Pdf/PdfReal.cs b/PdfSharpCore/Pdf/PdfReal.cs index 96cbc8cc..3832db4f 100644 --- a/PdfSharpCore/Pdf/PdfReal.cs +++ b/PdfSharpCore/Pdf/PdfReal.cs @@ -80,4 +80,4 @@ internal override void WriteObject(PdfWriter writer) writer.Write(this); } } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Pdf/PdfRectangle.cs b/PdfSharpCore/Pdf/PdfRectangle.cs index 650204c6..d7f338d5 100644 --- a/PdfSharpCore/Pdf/PdfRectangle.cs +++ b/PdfSharpCore/Pdf/PdfRectangle.cs @@ -322,7 +322,7 @@ public XRect ToXRect() } /// - /// Returns the rectangle as a string in the form «[x1 y1 x2 y2]». + /// Returns the rectangle as a string in the form �[x1 y1 x2 y2]�. /// public override string ToString() { diff --git a/PdfSharpCore/Pdf/PdfString.cs b/PdfSharpCore/Pdf/PdfString.cs index 2ed2acbe..a66d5ce9 100644 --- a/PdfSharpCore/Pdf/PdfString.cs +++ b/PdfSharpCore/Pdf/PdfString.cs @@ -166,10 +166,11 @@ public PdfString(string value, PdfStringEncoding encoding) _flags = (PdfStringFlags)encoding; } - internal PdfString(string value, PdfStringFlags flags) + internal PdfString(string value, PdfStringFlags flags, int paddingLeft = 0) { _value = value; _flags = flags; + this.PaddingLeft = paddingLeft; } /// @@ -246,6 +247,8 @@ private byte[] GetBytesFromEncoding() } } + public int PaddingLeft { get; private set; } + /// /// Returns the string. /// @@ -255,7 +258,7 @@ public override string ToString() PdfStringEncoding encoding = (PdfStringEncoding)(_flags & PdfStringFlags.EncodingMask); string pdf = (_flags & PdfStringFlags.HexLiteral) == 0 ? PdfEncoders.ToStringLiteral(_value, encoding, null) : - PdfEncoders.ToHexStringLiteral(_value, encoding, null); + PdfEncoders.ToHexStringLiteral(_value, encoding, null, PaddingLeft); return pdf; #else return _value; diff --git a/PdfSharpCore/Pdf/PdfUInteger.cs b/PdfSharpCore/Pdf/PdfUInteger.cs index 6fb980f4..a61b27f2 100644 --- a/PdfSharpCore/Pdf/PdfUInteger.cs +++ b/PdfSharpCore/Pdf/PdfUInteger.cs @@ -225,4 +225,4 @@ public uint ToUInt32(IFormatProvider provider) #endregion } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Pdf/PdfViewerPreferences.cs b/PdfSharpCore/Pdf/PdfViewerPreferences.cs index 13389805..49e75fd1 100644 --- a/PdfSharpCore/Pdf/PdfViewerPreferences.cs +++ b/PdfSharpCore/Pdf/PdfViewerPreferences.cs @@ -46,7 +46,7 @@ internal PdfViewerPreferences(PdfDocument document) { } /// - /// Gets or sets a value indicating whether to hide the viewer application’s tool + /// Gets or sets a value indicating whether to hide the viewer application�s tool /// bars when the document is active. /// public bool HideToolbar @@ -56,7 +56,7 @@ public bool HideToolbar } /// - /// Gets or sets a value indicating whether to hide the viewer application’s + /// Gets or sets a value indicating whether to hide the viewer application�s /// menu bar when the document is active. /// public bool HideMenubar @@ -67,8 +67,8 @@ public bool HideMenubar /// /// Gets or sets a value indicating whether to hide user interface elements in - /// the document’s window (such as scroll bars and navigation controls), - /// leaving only the document’s contents displayed. + /// the document�s window (such as scroll bars and navigation controls), + /// leaving only the document�s contents displayed. /// public bool HideWindowUI { @@ -77,7 +77,7 @@ public bool HideWindowUI } /// - /// Gets or sets a value indicating whether to resize the document’s window to + /// Gets or sets a value indicating whether to resize the document�s window to /// fit the size of the first displayed page. /// public bool FitWindow @@ -87,7 +87,7 @@ public bool FitWindow } /// - /// Gets or sets a value indicating whether to position the document’s window + /// Gets or sets a value indicating whether to position the document�s window /// in the center of the screen. /// public bool CenterWindow @@ -97,7 +97,7 @@ public bool CenterWindow } /// - /// Gets or sets a value indicating whether the window’s title bar + /// Gets or sets a value indicating whether the window�s title bar /// should display the document title taken from the Title entry of the document /// information dictionary. If false, the title bar should instead display the name /// of the PDF file containing the document. @@ -111,7 +111,7 @@ public bool DisplayDocTitle /// /// The predominant reading order for text: LeftToRight or RightToLeft /// (including vertical writing systems, such as Chinese, Japanese, and Korean). - /// This entry has no direct effect on the document’s contents or page numbering + /// This entry has no direct effect on the document�s contents or page numbering /// but can be used to determine the relative positioning of pages when displayed /// side by side or printed n-up. Default value: LeftToRight. /// @@ -155,14 +155,14 @@ public PdfReadingDirection? Direction internal sealed class Keys : KeysBase { /// - /// (Optional) A flag specifying whether to hide the viewer application’s tool + /// (Optional) A flag specifying whether to hide the viewer application�s tool /// bars when the document is active. Default value: false. /// [KeyInfo(KeyType.Boolean | KeyType.Optional)] public const string HideToolbar = "/HideToolbar"; /// - /// (Optional) A flag specifying whether to hide the viewer application’s + /// (Optional) A flag specifying whether to hide the viewer application�s /// menu bar when the document is active. Default value: false. /// [KeyInfo(KeyType.Boolean | KeyType.Optional)] @@ -170,28 +170,28 @@ internal sealed class Keys : KeysBase /// /// (Optional) A flag specifying whether to hide user interface elements in - /// the document’s window (such as scroll bars and navigation controls), - /// leaving only the document’s contents displayed. Default value: false. + /// the document�s window (such as scroll bars and navigation controls), + /// leaving only the document�s contents displayed. Default value: false. /// [KeyInfo(KeyType.Boolean | KeyType.Optional)] public const string HideWindowUI = "/HideWindowUI"; /// - /// (Optional) A flag specifying whether to resize the document’s window to + /// (Optional) A flag specifying whether to resize the document�s window to /// fit the size of the first displayed page. Default value: false. /// [KeyInfo(KeyType.Boolean | KeyType.Optional)] public const string FitWindow = "/FitWindow"; /// - /// (Optional) A flag specifying whether to position the document’s window + /// (Optional) A flag specifying whether to position the document�s window /// in the center of the screen. Default value: false. /// [KeyInfo(KeyType.Boolean | KeyType.Optional)] public const string CenterWindow = "/CenterWindow"; /// - /// (Optional; PDF 1.4) A flag specifying whether the window’s title bar + /// (Optional; PDF 1.4) A flag specifying whether the window�s title bar /// should display the document title taken from the Title entry of the document /// information dictionary. If false, the title bar should instead display the name /// of the PDF file containing the document. Default value: false. @@ -200,7 +200,7 @@ internal sealed class Keys : KeysBase public const string DisplayDocTitle = "/DisplayDocTitle"; /// - /// (Optional) The document’s page mode, specifying how to display the document on + /// (Optional) The document�s page mode, specifying how to display the document on /// exiting full-screen mode: /// UseNone Neither document outline nor thumbnail images visible /// UseOutlines Document outline visible @@ -216,7 +216,7 @@ internal sealed class Keys : KeysBase /// (Optional; PDF 1.3) The predominant reading order for text: /// L2R Left to right /// R2L Right to left (including vertical writing systems, such as Chinese, Japanese, and Korean) - /// This entry has no direct effect on the document’s contents or page numbering + /// This entry has no direct effect on the document�s contents or page numbering /// but can be used to determine the relative positioning of pages when displayed /// side by side or printed n-up. Default value: L2R. /// @@ -230,7 +230,7 @@ internal sealed class Keys : KeysBase /// boundary is not defined in the page object, its default value is used. /// Default value: CropBox. /// Note: This entry is intended primarily for use by prepress applications that - /// interpret or manipulate the page boundaries as described in Section 10.10.1, “Page Boundaries.” + /// interpret or manipulate the page boundaries as described in Section 10.10.1, �Page Boundaries.� /// Most PDF consumer applications disregard it. /// [KeyInfo(KeyType.Name | KeyType.Optional)] @@ -243,7 +243,7 @@ internal sealed class Keys : KeysBase /// boundary is not defined in the page object, its default value is used. /// Default value: CropBox. /// Note: This entry is intended primarily for use by prepress applications that - /// interpret or manipulate the page boundaries as described in Section 10.10.1, “Page Boundaries.” + /// interpret or manipulate the page boundaries as described in Section 10.10.1, �Page Boundaries.� /// Most PDF consumer applications disregard it. /// [KeyInfo(KeyType.Name | KeyType.Optional)] @@ -256,7 +256,7 @@ internal sealed class Keys : KeysBase /// defined in the page object, its default value is used. /// Default value: CropBox. /// Note: This entry is intended primarily for use by prepress applications that - /// interpret or manipulate the page boundaries as described in Section 10.10.1, “Page Boundaries.” + /// interpret or manipulate the page boundaries as described in Section 10.10.1, �Page Boundaries.� /// Most PDF consumer applications disregard it. /// [KeyInfo(KeyType.Name | KeyType.Optional)] @@ -305,4 +305,4 @@ internal override DictionaryMeta Meta get { return Keys.Meta; } } } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Pdf/enums/AnnotationCopyingType.cs b/PdfSharpCore/Pdf/enums/AnnotationCopyingType.cs index 45a55deb..db362587 100644 --- a/PdfSharpCore/Pdf/enums/AnnotationCopyingType.cs +++ b/PdfSharpCore/Pdf/enums/AnnotationCopyingType.cs @@ -1,4 +1,4 @@ -namespace PdfSharpCore.Pdf +namespace PdfSharpCore.Pdf { /// /// Defines how annotations should be copied. diff --git a/PdfSharpCore/Pdf/enums/PdfColorMode.cs b/PdfSharpCore/Pdf/enums/PdfColorMode.cs index 8be4d821..3a1c357f 100644 --- a/PdfSharpCore/Pdf/enums/PdfColorMode.cs +++ b/PdfSharpCore/Pdf/enums/PdfColorMode.cs @@ -49,4 +49,4 @@ public enum PdfColorMode /// Cmyk, } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Pdf/enums/PdfCustomValueCompression.cs b/PdfSharpCore/Pdf/enums/PdfCustomValueCompression.cs index d9b9a2d1..c040c9f8 100644 --- a/PdfSharpCore/Pdf/enums/PdfCustomValueCompression.cs +++ b/PdfSharpCore/Pdf/enums/PdfCustomValueCompression.cs @@ -49,4 +49,4 @@ public enum PdfCustomValueCompressionMode /// Compressed, } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Pdf/enums/PdfFlateEncodeMode.cs b/PdfSharpCore/Pdf/enums/PdfFlateEncodeMode.cs index 3236d17d..36158528 100644 --- a/PdfSharpCore/Pdf/enums/PdfFlateEncodeMode.cs +++ b/PdfSharpCore/Pdf/enums/PdfFlateEncodeMode.cs @@ -49,4 +49,4 @@ public enum PdfFlateEncodeMode /// BestCompression, } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Pdf/enums/PdfPageMode.cs b/PdfSharpCore/Pdf/enums/PdfPageMode.cs index db895720..a75f3965 100644 --- a/PdfSharpCore/Pdf/enums/PdfPageMode.cs +++ b/PdfSharpCore/Pdf/enums/PdfPageMode.cs @@ -66,4 +66,4 @@ public enum PdfPageMode /// UseAttachments, } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Pdf/enums/PdfReadingDirection.cs b/PdfSharpCore/Pdf/enums/PdfReadingDirection.cs index 8c4a6454..7ca78a63 100644 --- a/PdfSharpCore/Pdf/enums/PdfReadingDirection.cs +++ b/PdfSharpCore/Pdf/enums/PdfReadingDirection.cs @@ -44,4 +44,4 @@ public enum PdfReadingDirection /// RightToLeft, } -} \ No newline at end of file +} diff --git a/PdfSharpCore/Pdf/enums/PdfUseFlateDecoderForJpegImages.cs b/PdfSharpCore/Pdf/enums/PdfUseFlateDecoderForJpegImages.cs index 9a815b6c..57c25010 100644 --- a/PdfSharpCore/Pdf/enums/PdfUseFlateDecoderForJpegImages.cs +++ b/PdfSharpCore/Pdf/enums/PdfUseFlateDecoderForJpegImages.cs @@ -52,4 +52,4 @@ public enum PdfUseFlateDecoderForJpegImages /// Always, } -} \ No newline at end of file +} diff --git a/PdfSharpCore/PdfSharpCore.csproj b/PdfSharpCore/PdfSharpCore.csproj index f203595a..f2a45e59 100644 --- a/PdfSharpCore/PdfSharpCore.csproj +++ b/PdfSharpCore/PdfSharpCore.csproj @@ -1,8 +1,7 @@  - netstandard2.0;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0 - false + netstandard2.0;netcoreapp3.1;net6.0;net8.0 True Stefan Steiger and Contributors PdfSharp for .NET Core @@ -50,6 +49,7 @@ PdfSharpCore is a partial port of PdfSharp.Xamarin for .NET Core Additionally Mi + diff --git a/PdfSharpCore/SilverlightInternals/AgHacks.cs b/PdfSharpCore/SilverlightInternals/AgHacks.cs index 3c0e7aba..67c0ca69 100644 --- a/PdfSharpCore/SilverlightInternals/AgHacks.cs +++ b/PdfSharpCore/SilverlightInternals/AgHacks.cs @@ -1,4 +1,4 @@ -#region PDFsharp - A .NET library for processing PDF +#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange diff --git a/PdfSharpCore/Utils/FontResolver.cs b/PdfSharpCore/Utils/FontResolver.cs index bfa2bac6..55f30ea5 100644 --- a/PdfSharpCore/Utils/FontResolver.cs +++ b/PdfSharpCore/Utils/FontResolver.cs @@ -1,4 +1,4 @@ - + using System.Linq; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; diff --git a/PdfSharpCore/root/PSSR.cs b/PdfSharpCore/root/PSSR.cs index f047cbfd..2d528240 100644 --- a/PdfSharpCore/root/PSSR.cs +++ b/PdfSharpCore/root/PSSR.cs @@ -387,4 +387,4 @@ static PSSR() #endregion } -} \ No newline at end of file +} diff --git a/PdfSharpCore/root/PageSizeConverter.cs b/PdfSharpCore/root/PageSizeConverter.cs index 395a4fc3..791f0662 100644 --- a/PdfSharpCore/root/PageSizeConverter.cs +++ b/PdfSharpCore/root/PageSizeConverter.cs @@ -108,70 +108,70 @@ public static XSize ToSize(PageSize value) // The non-ISO sizes ... - case PageSize.Quarto: // 8 x 10 inch² + case PageSize.Quarto: // 8 x 10 inch� return new XSize(576, 720); - case PageSize.Foolscap: // 8 x 13 inch² + case PageSize.Foolscap: // 8 x 13 inch� return new XSize(576, 936); - case PageSize.Executive: // 7.5 x 10 inch² + case PageSize.Executive: // 7.5 x 10 inch� return new XSize(540, 720); - case PageSize.GovernmentLetter: // 8 x 10.5 inch² + case PageSize.GovernmentLetter: // 8 x 10.5 inch� return new XSize(576, 756); - case PageSize.Letter: // 8.5 x 11 inch² + case PageSize.Letter: // 8.5 x 11 inch� return new XSize(612, 792); - case PageSize.Legal: // 8.5 x 14 inch² + case PageSize.Legal: // 8.5 x 14 inch� return new XSize(612, 1008); - case PageSize.Ledger: // 17 x 11 inch² + case PageSize.Ledger: // 17 x 11 inch� return new XSize(1224, 792); - case PageSize.Tabloid: // 11 x 17 inch² + case PageSize.Tabloid: // 11 x 17 inch� return new XSize(792, 1224); - case PageSize.Post: // 15.5 x 19.25 inch² + case PageSize.Post: // 15.5 x 19.25 inch� return new XSize(1126, 1386); - case PageSize.Crown: // 20 x 15 inch² + case PageSize.Crown: // 20 x 15 inch� return new XSize(1440, 1080); - case PageSize.LargePost: // 16.5 x 21 inch² + case PageSize.LargePost: // 16.5 x 21 inch� return new XSize(1188, 1512); - case PageSize.Demy: // 17.5 x 22 inch² + case PageSize.Demy: // 17.5 x 22 inch� return new XSize(1260, 1584); - case PageSize.Medium: // 18 x 23 inch² + case PageSize.Medium: // 18 x 23 inch� return new XSize(1296, 1656); - case PageSize.Royal: // 20 x 25 inch² + case PageSize.Royal: // 20 x 25 inch� return new XSize(1440, 1800); - case PageSize.Elephant: // 23 x 28 inch² + case PageSize.Elephant: // 23 x 28 inch� return new XSize(1565, 2016); - case PageSize.DoubleDemy: // 23.5 x 35 inch² + case PageSize.DoubleDemy: // 23.5 x 35 inch� return new XSize(1692, 2520); - case PageSize.QuadDemy: // 35 x 45 inch² + case PageSize.QuadDemy: // 35 x 45 inch� return new XSize(2520, 3240); - case PageSize.STMT: // 5.5 x 8.5 inch² + case PageSize.STMT: // 5.5 x 8.5 inch� return new XSize(396, 612); - case PageSize.Folio: // 8.5 x 13 inch² + case PageSize.Folio: // 8.5 x 13 inch� return new XSize(612, 936); - case PageSize.Statement: // 5.5 x 8.5 inch² + case PageSize.Statement: // 5.5 x 8.5 inch� return new XSize(396, 612); - case PageSize.Size10x14: // 10 x 14 inch² + case PageSize.Size10x14: // 10 x 14 inch� return new XSize(720, 1008); } throw new ArgumentException("Invalid PageSize.", "value"); } } -} \ No newline at end of file +} diff --git a/PdfSharpCore/root/ProductVersionInfo.cs b/PdfSharpCore/root/ProductVersionInfo.cs index 090c94c4..a7eaa687 100644 --- a/PdfSharpCore/root/ProductVersionInfo.cs +++ b/PdfSharpCore/root/ProductVersionInfo.cs @@ -90,7 +90,7 @@ public static class ProductVersionInfo /// /// The copyright information. /// - public const string Copyright = "Copyright © 2005-2016 empira Software GmbH."; + public const string Copyright = "Copyright � 2005-2016 empira Software GmbH."; /// /// The trademark the product. diff --git a/PdfSharpCore/root/enums/PSMsgID.cs b/PdfSharpCore/root/enums/PSMsgID.cs index 058b21ed..28f9eeba 100644 --- a/PdfSharpCore/root/enums/PSMsgID.cs +++ b/PdfSharpCore/root/enums/PSMsgID.cs @@ -73,4 +73,4 @@ enum PSMsgID /// UnknownEncryption, } -} \ No newline at end of file +} diff --git a/PdfSharpCore/root/enums/PageSize.cs b/PdfSharpCore/root/enums/PageSize.cs index c97082ec..36433ad1 100644 --- a/PdfSharpCore/root/enums/PageSize.cs +++ b/PdfSharpCore/root/enums/PageSize.cs @@ -218,7 +218,7 @@ public enum PageSize Post = 108, /// - /// 20 ×Identifies a paper sheet size of 20 inch times 15 inch or 508 mm times 381 mm. + /// 20 �Identifies a paper sheet size of 20 inch times 15 inch or 508 mm times 381 mm. /// Crown = 109, @@ -277,10 +277,10 @@ public enum PageSize /// Size10x14 = 122, - //A 11 × 8.5 279 × 216 - //B 17 × 11 432 × 279 - //C 22 × 17 559 × 432 - //D 34 × 22 864 × 559 - //E 44 × 34 1118 × 864 + //A 11 � 8.5 279 � 216 + //B 17 � 11 432 � 279 + //C 22 � 17 559 � 432 + //D 34 � 22 864 � 559 + //E 44 � 34 1118 � 864 } -} \ No newline at end of file +} diff --git a/SampleApp/Program.cs b/SampleApp/Program.cs index 1f46c514..8b6c715d 100644 --- a/SampleApp/Program.cs +++ b/SampleApp/Program.cs @@ -1,4 +1,4 @@ - + namespace SampleApp { diff --git a/SignatureTestConsole/Program.cs b/SignatureTestConsole/Program.cs new file mode 100644 index 00000000..aaeb8c04 --- /dev/null +++ b/SignatureTestConsole/Program.cs @@ -0,0 +1,117 @@ +using PdfSharpCore.Drawing; +using PdfSharpCore.Pdf; +using System.Security.Cryptography.X509Certificates; +using PdfSharpCore.Pdf.IO; +using PdfSharpCore.Drawing.Layout; +using PdfSharpCore.Pdf.Signatures; +using System; +using PdfSharpCore.Pdf.AcroForms; + +namespace TestConsole +{ + class Program + { + public static void Main(string[] args) + { + //Program.CreateAndSign(); + Program.SignNewField(); + Program.SignExisting(); + Program.SignExistingNonDigital(); + } + + private static void CreateAndSign() + { + string text = "CreateAndSign.pdf"; + XFont font = new XFont("Verdana", 10.0, XFontStyle.Regular); + PdfDocument pdfDocument = new PdfDocument(); + PdfPage pdfPage = pdfDocument.AddPage(); + XGraphics xGraphics = XGraphics.FromPdfPage(pdfPage); + XRect layoutRectangle = new XRect(0.0, 0.0, pdfPage.Width, pdfPage.Height); + xGraphics.DrawString("Sample document", font, XBrushes.Black, layoutRectangle, XStringFormats.TopCenter); + PdfSignatureOptions options = new PdfSignatureOptions + { + ContactInfo = "Contact Info", + Location = "Paris", + Reason = "Test signatures", + Rectangle = new XRect(36.0, 700.0, 200.0, 50.0) + }; + PdfSignatureHandler pdfSignatureHandler = new PdfSignatureHandler( new DefaultSigner(Program.GetCertificate()), options); + pdfSignatureHandler.AttachToDocument(pdfDocument); + pdfDocument.Save(text); + } + private static void SignNewField() + { + string text = string.Format("SignNewField.pdf", new object[0]); + PdfDocument pdfDocument = PdfReader.Open("TestFiles\\doc1.pdf"); + PdfSignatureOptions options = new PdfSignatureOptions + { + ContactInfo = "Contact Info", + Location = "Paris", + Reason = "Test signatures", + Rectangle = new XRect(36.0, 735.0, 200.0, 50.0), + AppearanceHandler = new Program.SignAppearenceHandler() + }; + + PdfSignatureHandler pdfSignatureHandler = new PdfSignatureHandler(new DefaultSigner(Program.GetCertificate()), options); + pdfSignatureHandler.AttachToDocument(pdfDocument); + pdfDocument.Save(text); + } + private static void SignExisting() + { + string text = string.Format("SignExisting.pdf", new object[0]); + PdfDocument pdfDocument = PdfReader.Open(@"TestFiles\\Adobe Digital signing instructions-unsigned.pdf"); + PdfSignatureOptions options = new PdfSignatureOptions + { + ContactInfo = "Contact Info", + Location = "Paris", + Reason = "Test signatures", + //Rectangle = new XRect(32, 348, 316, 50), + AppearanceHandler = new Program.SignAppearenceHandler(), + FieldName = "Signature1" + }; + + PdfSignatureHandler pdfSignatureHandler = new PdfSignatureHandler(new DefaultSigner(Program.GetCertificate()), options); + pdfSignatureHandler.AttachToDocument(pdfDocument); + pdfDocument.Save(text); + } + + private static void SignExistingNonDigital() + { + string text = string.Format("SignExistingNonDigital.pdf", new object[0]); + PdfDocument pdfDocument = PdfReader.Open(@"TestFiles\\Adobe Digital signing instructions-unsigned.pdf"); + (pdfDocument.AcroForm.Fields["Signature1"] as PdfSignatureField).RenderAppearance(new SignAppearenceHandler()); + pdfDocument.Save(text); + } + + private static X509Certificate2 GetCertificate() + { + // add yours here + return new X509Certificate2("TestFiles\\myself.pfx", "password", X509KeyStorageFlags.Exportable); + } + + private class SignAppearenceHandler : ISignatureAppearanceHandler + { + private XImage Image = XImage.FromFile("TestFiles\\logo.jpg"); + public void RenderAppearance(XGraphics gfx, XRect rect) + { + XColor empty = XColor.Empty; + string text = "Signed by Napoleon \nLocation: Paris \nDate: " + DateTime.Now.ToString(); + XFont font = new XFont("Verdana", 8.0, XFontStyle.Regular); + XTextFormatter xTextFormatter = new XTextFormatter(gfx); + XPoint xPoint = new XPoint(0.0, 0.0); + bool flag = this.Image != null; + if (flag) + { + double ratio = 1; + if (this.Image.PixelHeight > rect.Height) + { + ratio = rect.Height / this.Image.PixelHeight; + } + gfx.DrawImage(this.Image, xPoint.X, xPoint.Y, Image.PixelWidth * ratio, Image.PixelHeight * ratio); + xPoint = new XPoint(Image.PixelWidth * ratio + 5, 0.0); + } + xTextFormatter.DrawString(text, font, new XSolidBrush(XColor.FromKnownColor(XKnownColor.Black)), new XRect(xPoint.X, xPoint.Y, rect.Width - xPoint.X, rect.Height), XStringFormats.TopLeft); + } + } + } +} diff --git a/SignatureTestConsole/SignatureTestConsole.csproj b/SignatureTestConsole/SignatureTestConsole.csproj new file mode 100644 index 00000000..9a15e9bb --- /dev/null +++ b/SignatureTestConsole/SignatureTestConsole.csproj @@ -0,0 +1,18 @@ + + + + Exe + net5.0;net6.0 + + + + + + + + + Always + + + + diff --git a/SignatureTestConsole/TestFiles/Adobe Digital signing instructions-unsigned.pdf b/SignatureTestConsole/TestFiles/Adobe Digital signing instructions-unsigned.pdf new file mode 100644 index 00000000..eb202d28 Binary files /dev/null and b/SignatureTestConsole/TestFiles/Adobe Digital signing instructions-unsigned.pdf differ diff --git a/SignatureTestConsole/TestFiles/doc1.pdf b/SignatureTestConsole/TestFiles/doc1.pdf new file mode 100644 index 00000000..2838868e Binary files /dev/null and b/SignatureTestConsole/TestFiles/doc1.pdf differ diff --git a/SignatureTestConsole/TestFiles/logo.jpg b/SignatureTestConsole/TestFiles/logo.jpg new file mode 100644 index 00000000..7ea75b00 Binary files /dev/null and b/SignatureTestConsole/TestFiles/logo.jpg differ