First commit
Send all results
This commit is contained in:
400
PdfSharp/root/PSSR.cs
Normal file
400
PdfSharp/root/PSSR.cs
Normal file
@@ -0,0 +1,400 @@
|
||||
#region PDFsharp - A .NET library for processing PDF
|
||||
//
|
||||
// Authors:
|
||||
// Stefan Lange
|
||||
//
|
||||
// Copyright (c) 2005-2017 empira Software GmbH, Cologne Area (Germany)
|
||||
//
|
||||
// http://www.pdfsharp.com
|
||||
// http://sourceforge.net/projects/pdfsharp
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Resources;
|
||||
using System.Reflection;
|
||||
using PdfSharp.Drawing;
|
||||
using PdfSharp.Internal;
|
||||
using PdfSharp.Pdf;
|
||||
|
||||
#pragma warning disable 1591
|
||||
|
||||
namespace PdfSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// The Pdf-Sharp-String-Resources.
|
||||
/// </summary>
|
||||
// ReSharper disable once InconsistentNaming
|
||||
static class PSSR
|
||||
{
|
||||
// How to use:
|
||||
// Create a function or property for each message text, depending on how many parameters are
|
||||
// part of the message. For the beginning, type plain English text in the function or property.
|
||||
// The use of functions is safe when a parameter must be changed. The compiler tells you all
|
||||
// places in your code that must be modified.
|
||||
// For localization, create an enum value for each function or property with the same name. Then
|
||||
// create localized message files with the enum values as messages identifiers. In the properties
|
||||
// and functions all text is replaced by Format or GetString functions with the corresponding enum value
|
||||
// as first parameter. The use of enums ensures that typing errors in message resource names are
|
||||
// simply impossible. Use the TestResourceMessages function to ensure that each enum value has an
|
||||
// appropriate message text.
|
||||
|
||||
#region Helper functions
|
||||
/// <summary>
|
||||
/// Loads the message from the resource associated with the enum type and formats it
|
||||
/// using 'String.Format'. Because this function is intended to be used during error
|
||||
/// handling it never raises an exception.
|
||||
/// </summary>
|
||||
/// <param name="id">The type of the parameter identifies the resource
|
||||
/// and the name of the enum identifies the message in the resource.</param>
|
||||
/// <param name="args">Parameters passed through 'String.Format'.</param>
|
||||
/// <returns>The formatted message.</returns>
|
||||
public static string Format(PSMsgID id, params object[] args)
|
||||
{
|
||||
string message;
|
||||
try
|
||||
{
|
||||
message = GetString(id);
|
||||
message = message != null ? Format(message, args) : "INTERNAL ERROR: Message not found in resources.";
|
||||
return message;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
message = String.Format("UNEXPECTED ERROR while formatting message with ID {0}: {1}", id.ToString(), ex.ToString());
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
public static string Format(string format, params object[] args)
|
||||
{
|
||||
if (format == null)
|
||||
throw new ArgumentNullException("format");
|
||||
|
||||
string message;
|
||||
try
|
||||
{
|
||||
message = String.Format(format, args);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
message = String.Format("UNEXPECTED ERROR while formatting message '{0}': {1}", format, ex);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the localized message identified by the specified DomMsgID.
|
||||
/// </summary>
|
||||
public static string GetString(PSMsgID id)
|
||||
{
|
||||
return ResMngr.GetString(id.ToString());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region General messages
|
||||
|
||||
public static string IndexOutOfRange
|
||||
{
|
||||
get { return "The index is out of range."; }
|
||||
}
|
||||
|
||||
public static string ListEnumCurrentOutOfRange
|
||||
{
|
||||
get { return "Enumeration out of range."; }
|
||||
}
|
||||
|
||||
public static string PageIndexOutOfRange
|
||||
{
|
||||
get { return "The index of a page is out of range."; }
|
||||
}
|
||||
|
||||
public static string OutlineIndexOutOfRange
|
||||
{
|
||||
get { return "The index of an outline is out of range."; }
|
||||
}
|
||||
|
||||
public static string SetValueMustNotBeNull
|
||||
{
|
||||
get { return "The set value property must not be null."; }
|
||||
}
|
||||
|
||||
public static string InvalidValue(int val, string name, int min, int max)
|
||||
{
|
||||
return Format("{0} is not a valid value for {1}. {1} should be greater than or equal to {2} and less than or equal to {3}.",
|
||||
val, name, min, max);
|
||||
}
|
||||
|
||||
public static string ObsoleteFunktionCalled
|
||||
{
|
||||
get { return "The function is obsolete and must not be called."; }
|
||||
}
|
||||
|
||||
public static string OwningDocumentRequired
|
||||
{
|
||||
get { return "The PDF object must belong to a PdfDocument, but property Document is null."; }
|
||||
}
|
||||
|
||||
public static string FileNotFound(string path)
|
||||
{
|
||||
return Format("The file '{0}' does not exist.", path);
|
||||
}
|
||||
|
||||
public static string FontDataReadOnly
|
||||
{
|
||||
get { return "Font data is read-only."; }
|
||||
}
|
||||
|
||||
public static string ErrorReadingFontData
|
||||
{
|
||||
get { return "Error while parsing an OpenType font."; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region XGraphics specific messages
|
||||
|
||||
// ----- XGraphics ----------------------------------------------------------------------------
|
||||
|
||||
public static string PointArrayEmpty
|
||||
{
|
||||
get { return "The PointF array must not be empty."; }
|
||||
}
|
||||
|
||||
public static string PointArrayAtLeast(int count)
|
||||
{
|
||||
return Format("The point array must contain {0} or more points.", count);
|
||||
}
|
||||
|
||||
public static string NeedPenOrBrush
|
||||
{
|
||||
get { return "XPen or XBrush or both must not be null."; }
|
||||
}
|
||||
|
||||
public static string CannotChangeImmutableObject(string typename)
|
||||
{
|
||||
return String.Format("You cannot change this immutable {0} object.", typename);
|
||||
}
|
||||
|
||||
public static string FontAlreadyAdded(string fontname)
|
||||
{
|
||||
return String.Format("Fontface with the name '{0}' already added to font collection.", fontname);
|
||||
}
|
||||
|
||||
public static string NotImplementedForFontsRetrievedWithFontResolver(string name)
|
||||
{
|
||||
return String.Format("Not implemented for font '{0}', because it was retrieved with font resolver.", name);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PDF specific messages
|
||||
|
||||
// ----- PDF ----------------------------------------------------------------------------------
|
||||
|
||||
public static string InvalidPdf
|
||||
{
|
||||
get { return "The file is not a valid PDF document."; }
|
||||
}
|
||||
|
||||
public static string InvalidVersionNumber
|
||||
{
|
||||
get { return "Invalid version number. Valid values are 12, 13, and 14."; }
|
||||
}
|
||||
|
||||
public static string CannotHandleXRefStreams
|
||||
{
|
||||
get { return "Cannot handle cross-reference streams. The current implementation of PDFsharp cannot handle this PDF feature introduced with Acrobat 6."; }
|
||||
}
|
||||
|
||||
public static string PasswordRequired
|
||||
{
|
||||
get { return "A password is required to open the PDF document."; }
|
||||
}
|
||||
|
||||
public static string InvalidPassword
|
||||
{
|
||||
get { return "The specified password is invalid."; }
|
||||
}
|
||||
|
||||
public static string OwnerPasswordRequired
|
||||
{
|
||||
get { return "To modify the document the owner password is required"; }
|
||||
}
|
||||
|
||||
public static string UserOrOwnerPasswordRequired
|
||||
{
|
||||
get { return GetString(PSMsgID.UserOrOwnerPasswordRequired); }
|
||||
//get { return "At least a user or an owner password is required to encrypt the document."; }
|
||||
}
|
||||
|
||||
public static string CannotModify
|
||||
{
|
||||
get { return "The document cannot be modified."; }
|
||||
}
|
||||
|
||||
public static string NameMustStartWithSlash
|
||||
{
|
||||
//get { return GetString(PSMsgID.NameMustStartWithSlash); }
|
||||
get { return "A PDF name must start with a slash (/)."; }
|
||||
}
|
||||
|
||||
public static string ImportPageNumberOutOfRange(int pageNumber, int maxPage, string path)
|
||||
{
|
||||
return String.Format("The page cannot be imported from document '{2}', because the page number is out of range. " +
|
||||
"The specified page number is {0}, but it must be in the range from 1 to {1}.", pageNumber, maxPage, path);
|
||||
}
|
||||
|
||||
public static string MultiplePageInsert
|
||||
{
|
||||
get { return "The page cannot be added to this document because the document already owned this page."; }
|
||||
}
|
||||
|
||||
public static string UnexpectedTokenInPdfFile
|
||||
{
|
||||
get { return "Unexpected token in PDF file. The PDF file may be corrupt. If it is not, please send us the file for service."; }
|
||||
}
|
||||
|
||||
public static string InappropriateColorSpace(PdfColorMode colorMode, XColorSpace colorSpace)
|
||||
{
|
||||
string mode;
|
||||
switch (colorMode)
|
||||
{
|
||||
case PdfColorMode.Rgb:
|
||||
mode = "RGB";
|
||||
break;
|
||||
|
||||
case PdfColorMode.Cmyk:
|
||||
mode = "CMYK";
|
||||
break;
|
||||
|
||||
default:
|
||||
mode = "(undefined)";
|
||||
break;
|
||||
}
|
||||
|
||||
string space;
|
||||
switch (colorSpace)
|
||||
{
|
||||
case XColorSpace.Rgb:
|
||||
space = "RGB";
|
||||
break;
|
||||
|
||||
case XColorSpace.Cmyk:
|
||||
space = "CMYK";
|
||||
break;
|
||||
|
||||
case XColorSpace.GrayScale:
|
||||
space = "grayscale";
|
||||
break;
|
||||
|
||||
default:
|
||||
space = "(undefined)";
|
||||
break;
|
||||
}
|
||||
return String.Format("The document requires color mode {0}, but a color is defined using {1}. " +
|
||||
"Use only colors that match the color mode of the PDF document", mode, space);
|
||||
}
|
||||
|
||||
public static string CannotGetGlyphTypeface(string fontName)
|
||||
{
|
||||
return Format("Cannot get a matching glyph typeface for font '{0}'.", fontName);
|
||||
}
|
||||
|
||||
|
||||
// ----- PdfParser ----------------------------------------------------------------------------
|
||||
|
||||
public static string UnexpectedToken(string token)
|
||||
{
|
||||
return Format(PSMsgID.UnexpectedToken, token);
|
||||
//return Format("Token '{0}' was not expected.", token);
|
||||
}
|
||||
|
||||
public static string UnknownEncryption
|
||||
{
|
||||
get { return GetString(PSMsgID.UnknownEncryption); }
|
||||
//get { return "The PDF document is protected with an encryption not supported by PDFsharp."; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Resource manager
|
||||
|
||||
/// <summary>
|
||||
/// Gets the resource manager for this module.
|
||||
/// </summary>
|
||||
public static ResourceManager ResMngr
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_resmngr == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
Lock.EnterFontFactory();
|
||||
if (_resmngr == null)
|
||||
{
|
||||
#if true_
|
||||
// Force the English language.
|
||||
System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.InvariantCulture;
|
||||
#endif
|
||||
#if !NETFX_CORE && !UWP
|
||||
_resmngr = new ResourceManager("PdfSharp.Resources.Messages",
|
||||
Assembly.GetExecutingAssembly());
|
||||
#else
|
||||
_resmngr = new ResourceManager("PdfSharp.Resources.Messages",
|
||||
typeof(PSSR).GetTypeInfo().Assembly);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
finally { Lock.ExitFontFactory(); }
|
||||
}
|
||||
return _resmngr;
|
||||
}
|
||||
}
|
||||
static ResourceManager _resmngr;
|
||||
|
||||
/// <summary>
|
||||
/// Writes all messages defined by PSMsgID.
|
||||
/// </summary>
|
||||
[Conditional("DEBUG")]
|
||||
public static void TestResourceMessages()
|
||||
{
|
||||
#if !SILVERLIGHT
|
||||
string[] names = Enum.GetNames(typeof(PSMsgID));
|
||||
foreach (string name in names)
|
||||
{
|
||||
string message = String.Format("{0}: '{1}'", name, ResMngr.GetString(name));
|
||||
Debug.Assert(message != null);
|
||||
Debug.WriteLine(message);
|
||||
}
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
|
||||
static PSSR()
|
||||
{
|
||||
TestResourceMessages();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
181
PdfSharp/root/PageSizeConverter.cs
Normal file
181
PdfSharp/root/PageSizeConverter.cs
Normal file
@@ -0,0 +1,181 @@
|
||||
#region PDFsharp - A .NET library for processing PDF
|
||||
//
|
||||
// Authors:
|
||||
// Stefan Lange
|
||||
//
|
||||
// Copyright (c) 2005-2017 empira Software GmbH, Cologne Area (Germany)
|
||||
//
|
||||
// http://www.pdfsharp.com
|
||||
// http://sourceforge.net/projects/pdfsharp
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
#if GDI
|
||||
using System.Drawing;
|
||||
#endif
|
||||
#if WPF
|
||||
using System.Windows;
|
||||
#endif
|
||||
using PdfSharp.Drawing;
|
||||
|
||||
namespace PdfSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Converter from <see cref="PageSize"/> to <see cref="XSize"/>.
|
||||
/// </summary>
|
||||
public static class PageSizeConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts the specified page size enumeration to a pair of values in point.
|
||||
/// </summary>
|
||||
public static XSize ToSize(PageSize value)
|
||||
{
|
||||
// The international definitions are:
|
||||
// 1 inch == 25.4 mm
|
||||
// 1 inch == 72 point
|
||||
switch (value)
|
||||
{
|
||||
// Source http://www.din-formate.de/reihe-a-din-groessen-mm-pixel-dpi.html
|
||||
case PageSize.A0:
|
||||
return new XSize(2384, 3370);
|
||||
|
||||
case PageSize.A1:
|
||||
return new XSize(1684, 2384);
|
||||
|
||||
case PageSize.A2:
|
||||
return new XSize(1191, 1684);
|
||||
|
||||
case PageSize.A3:
|
||||
return new XSize(842, 1191);
|
||||
|
||||
case PageSize.A4:
|
||||
return new XSize(595, 842);
|
||||
|
||||
case PageSize.A5:
|
||||
return new XSize(420, 595);
|
||||
|
||||
|
||||
case PageSize.RA0:
|
||||
return new XSize(2438, 3458);
|
||||
|
||||
case PageSize.RA1:
|
||||
return new XSize(1729, 2438);
|
||||
|
||||
case PageSize.RA2:
|
||||
return new XSize(1219, 1729);
|
||||
|
||||
case PageSize.RA3:
|
||||
return new XSize(865, 1219);
|
||||
|
||||
case PageSize.RA4:
|
||||
return new XSize(609, 865);
|
||||
|
||||
case PageSize.RA5:
|
||||
return new XSize(433, 609);
|
||||
|
||||
|
||||
case PageSize.B0:
|
||||
return new XSize(2835, 4008);
|
||||
|
||||
case PageSize.B1:
|
||||
return new XSize(2004, 2835);
|
||||
|
||||
case PageSize.B2:
|
||||
return new XSize(1417, 2004);
|
||||
|
||||
case PageSize.B3:
|
||||
return new XSize(1001, 1417);
|
||||
|
||||
case PageSize.B4:
|
||||
return new XSize(709, 1001);
|
||||
|
||||
case PageSize.B5:
|
||||
return new XSize(499, 709);
|
||||
|
||||
// The non-ISO sizes ...
|
||||
|
||||
case PageSize.Quarto: // 8 x 10 inch<63>
|
||||
return new XSize(576, 720);
|
||||
|
||||
case PageSize.Foolscap: // 8 x 13 inch<63>
|
||||
return new XSize(576, 936);
|
||||
|
||||
case PageSize.Executive: // 7.5 x 10 inch<63>
|
||||
return new XSize(540, 720);
|
||||
|
||||
case PageSize.GovernmentLetter: // 8 x 10.5 inch<63>
|
||||
return new XSize(576, 756);
|
||||
|
||||
case PageSize.Letter: // 8.5 x 11 inch<63>
|
||||
return new XSize(612, 792);
|
||||
|
||||
case PageSize.Legal: // 8.5 x 14 inch<63>
|
||||
return new XSize(612, 1008);
|
||||
|
||||
case PageSize.Ledger: // 17 x 11 inch<63>
|
||||
return new XSize(1224, 792);
|
||||
|
||||
case PageSize.Tabloid: // 11 x 17 inch<63>
|
||||
return new XSize(792, 1224);
|
||||
|
||||
case PageSize.Post: // 15.5 x 19.25 inch<63>
|
||||
return new XSize(1126, 1386);
|
||||
|
||||
case PageSize.Crown: // 20 x 15 inch<63>
|
||||
return new XSize(1440, 1080);
|
||||
|
||||
case PageSize.LargePost: // 16.5 x 21 inch<63>
|
||||
return new XSize(1188, 1512);
|
||||
|
||||
case PageSize.Demy: // 17.5 x 22 inch<63>
|
||||
return new XSize(1260, 1584);
|
||||
|
||||
case PageSize.Medium: // 18 x 23 inch<63>
|
||||
return new XSize(1296, 1656);
|
||||
|
||||
case PageSize.Royal: // 20 x 25 inch<63>
|
||||
return new XSize(1440, 1800);
|
||||
|
||||
case PageSize.Elephant: // 23 x 28 inch<63>
|
||||
return new XSize(1565, 2016);
|
||||
|
||||
case PageSize.DoubleDemy: // 23.5 x 35 inch<63>
|
||||
return new XSize(1692, 2520);
|
||||
|
||||
case PageSize.QuadDemy: // 35 x 45 inch<63>
|
||||
return new XSize(2520, 3240);
|
||||
|
||||
case PageSize.STMT: // 5.5 x 8.5 inch<63>
|
||||
return new XSize(396, 612);
|
||||
|
||||
case PageSize.Folio: // 8.5 x 13 inch<63>
|
||||
return new XSize(612, 936);
|
||||
|
||||
case PageSize.Statement: // 5.5 x 8.5 inch<63>
|
||||
return new XSize(396, 612);
|
||||
|
||||
case PageSize.Size10x14: // 10 x 14 inch<63>
|
||||
return new XSize(720, 1008);
|
||||
}
|
||||
throw new ArgumentException("Invalid PageSize.", "value");
|
||||
}
|
||||
}
|
||||
}
|
64
PdfSharp/root/PdfSharpException.cs
Normal file
64
PdfSharp/root/PdfSharpException.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
#region PDFsharp - A .NET library for processing PDF
|
||||
//
|
||||
// Authors:
|
||||
// Stefan Lange
|
||||
//
|
||||
// Copyright (c) 2005-2017 empira Software GmbH, Cologne Area (Germany)
|
||||
//
|
||||
// http://www.pdfsharp.com
|
||||
// http://sourceforge.net/projects/pdfsharp
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
|
||||
namespace PdfSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class of all exceptions in the PDFsharp frame work.
|
||||
/// </summary>
|
||||
public class PdfSharpException : Exception
|
||||
{
|
||||
// The class is not yet used
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PdfSharpException"/> class.
|
||||
/// </summary>
|
||||
public PdfSharpException()
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PdfSharpException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="message">The exception message.</param>
|
||||
public PdfSharpException(string message)
|
||||
: base(message)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PdfSharpException"/> class.
|
||||
/// </summary>
|
||||
/// <param name="message">The exception message.</param>
|
||||
/// <param name="innerException">The inner exception.</param>
|
||||
public PdfSharpException(string message, Exception innerException) :
|
||||
base(message, innerException)
|
||||
{ }
|
||||
}
|
||||
}
|
270
PdfSharp/root/ProductVersionInfo.cs
Normal file
270
PdfSharp/root/ProductVersionInfo.cs
Normal file
@@ -0,0 +1,270 @@
|
||||
#region PDFsharp - A .NET library for processing PDF
|
||||
//
|
||||
// Authors:
|
||||
// Stefan Lange
|
||||
//
|
||||
// Copyright (c) 2005-2017 empira Software GmbH, Cologne Area (Germany)
|
||||
//
|
||||
// http://www.pdfsharp.com
|
||||
// http://sourceforge.net/projects/pdfsharp
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
|
||||
namespace PdfSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Version info base for all PDFsharp related assemblies.
|
||||
/// </summary>
|
||||
public static class ProductVersionInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The title of the product.
|
||||
/// </summary>
|
||||
public const string Title = "PDFsharp";
|
||||
|
||||
/// <summary>
|
||||
/// A characteristic description of the product.
|
||||
/// </summary>
|
||||
public const string Description = "A .NET library for processing PDF.";
|
||||
|
||||
/// <summary>
|
||||
/// The PDF producer information string.
|
||||
/// TODO: Called Creator in MigraDoc???
|
||||
/// </summary>
|
||||
public const string Producer = Title + " " + VersionMajor + "." + VersionMinor + "." + VersionBuild + Technology + " (" + Url + ")";
|
||||
|
||||
/// <summary>
|
||||
/// The PDF producer information string including VersionPatch.
|
||||
/// </summary>
|
||||
public const string Producer2 = Title + " " + VersionMajor + "." + VersionMinor + "." + VersionBuild + "." + VersionPatch + Technology + " (" + Url + ")";
|
||||
|
||||
/// <summary>
|
||||
/// The full version number.
|
||||
/// </summary>
|
||||
public const string Version = VersionMajor + "." + VersionMinor + "." + VersionBuild + "." + VersionPatch;
|
||||
|
||||
/// <summary>
|
||||
/// The full version string.
|
||||
/// </summary>
|
||||
public const string Version2 = VersionMajor + "." + VersionMinor + "." + VersionBuild + "." + VersionPatch + Technology;
|
||||
|
||||
/// <summary>
|
||||
/// The home page of this product.
|
||||
/// </summary>
|
||||
public const string Url = "www.pdfsharp.com";
|
||||
|
||||
/// <summary>
|
||||
/// Unused.
|
||||
/// </summary>
|
||||
public const string Configuration = "";
|
||||
|
||||
/// <summary>
|
||||
/// The company that created/owned the product.
|
||||
/// </summary>
|
||||
public const string Company = "empira Software GmbH, Cologne Area (Germany)";
|
||||
|
||||
/// <summary>
|
||||
/// The name the product.
|
||||
/// </summary>
|
||||
public const string Product = "PDFsharp";
|
||||
|
||||
/// <summary>
|
||||
/// The copyright information.
|
||||
/// </summary>
|
||||
public const string Copyright = "Copyright <20> 2005-2017 empira Software GmbH.";
|
||||
|
||||
/// <summary>
|
||||
/// The trademark the product.
|
||||
/// </summary>
|
||||
public const string Trademark = "PDFsharp";
|
||||
|
||||
/// <summary>
|
||||
/// Unused.
|
||||
/// </summary>
|
||||
public const string Culture = "";
|
||||
|
||||
/// <summary>
|
||||
/// The major version number of the product.
|
||||
/// </summary>
|
||||
public const string VersionMajor = "1";
|
||||
|
||||
/// <summary>
|
||||
/// The minor version number of the product.
|
||||
/// </summary>
|
||||
public const string VersionMinor = "50";
|
||||
|
||||
/// <summary>
|
||||
/// The build number of the product.
|
||||
/// </summary>
|
||||
public const string VersionBuild = "4740"; // V16G // Build = days since 2005-01-01 - change this values ONLY HERE
|
||||
|
||||
/// <summary>
|
||||
/// The patch number of the product.
|
||||
/// </summary>
|
||||
public const string VersionPatch = "0";
|
||||
|
||||
/// <summary>
|
||||
/// The Version Prerelease String for NuGet.
|
||||
/// </summary>
|
||||
public const string VersionPrerelease = "beta5"; // "" for stable Release, e.g. "beta" or "rc.1.2" for Prerelease. // Also used for NuGet Version.
|
||||
|
||||
#if DEBUG
|
||||
/// <summary>
|
||||
/// The calculated build number.
|
||||
/// </summary>
|
||||
// ReSharper disable RedundantNameQualifier
|
||||
public static int BuildNumber = (System.DateTime.Now - new System.DateTime(2005, 1, 1)).Days;
|
||||
// ReSharper restore RedundantNameQualifier
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// E.g. "2005-01-01", for use in NuGet Script.
|
||||
/// </summary>
|
||||
public const string VersionReferenceDate = "2005-01-01";
|
||||
|
||||
/// <summary>
|
||||
/// Use _ instead of blanks and special characters. Can be complemented with a suffix in the NuGet Script.
|
||||
/// Nuspec Doc: The unique identifier for the package. This is the package name that is shown when packages
|
||||
/// are listed using the Package Manager Console. These are also used when installing a package using the
|
||||
/// Install-Package command within the Package Manager Console. Package IDs may not contain any spaces
|
||||
/// or characters that are invalid in an URL. In general, they follow the same rules as .NET namespaces do.
|
||||
/// So Foo.Bar is a valid ID, Foo! and Foo Bar are not.
|
||||
/// </summary>
|
||||
public const string NuGetID = "PDFsharp";
|
||||
|
||||
/// <summary>
|
||||
/// Nuspec Doc: The human-friendly title of the package displayed in the Manage NuGet Packages dialog.
|
||||
/// If none is specified, the ID is used instead.
|
||||
/// </summary>
|
||||
public const string NuGetTitle = "PDFsharp";
|
||||
|
||||
/// <summary>
|
||||
/// Nuspec Doc: A comma-separated list of authors of the package code.
|
||||
/// </summary>
|
||||
public const string NuGetAuthors = "empira Software GmbH";
|
||||
|
||||
/// <summary>
|
||||
/// Nuspec Doc: A comma-separated list of the package creators. This is often the same list as in authors.
|
||||
/// This is ignored when uploading the package to the NuGet.org Gallery.
|
||||
/// </summary>
|
||||
public const string NuGetOwners = "empira Software GmbH";
|
||||
|
||||
/// <summary>
|
||||
/// Nuspec Doc: A long description of the package. This shows up in the right pane of the Add Package Dialog
|
||||
/// as well as in the Package Manager Console when listing packages using the Get-Package command.
|
||||
/// </summary>
|
||||
// This assignment must be written in one line because it will be parsed from a PS1 file.
|
||||
public const string NuGetDescription = "PDFsharp is the Open Source .NET library that easily creates and processes PDF documents on the fly from any .NET language. The same drawing routines can be used to create PDF documents, draw on the screen, or send output to any printer.";
|
||||
|
||||
/// <summary>
|
||||
/// Nuspec Doc: A description of the changes made in each release of the package. This field only shows up
|
||||
/// when the _Updates_ tab is selected and the package is an update to a previously installed package.
|
||||
/// It is displayed where the Description would normally be displayed.
|
||||
/// </summary>
|
||||
public const string NuGetReleaseNotes = "";
|
||||
|
||||
/// <summary>
|
||||
/// Nuspec Doc: A short description of the package. If specified, this shows up in the middle pane of the
|
||||
/// Add Package Dialog. If not specified, a truncated version of the description is used instead.
|
||||
/// </summary>
|
||||
public const string NuGetSummary = "A .NET library for processing PDF.";
|
||||
|
||||
/// <summary>
|
||||
/// Nuspec Doc: The locale ID for the package, such as en-us.
|
||||
/// </summary>
|
||||
public const string NuGetLanguage = "";
|
||||
|
||||
/// <summary>
|
||||
/// Nuspec Doc: A URL for the home page of the package.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// http://www.pdfsharp.net/NuGetPackage_PDFsharp-GDI.ashx
|
||||
/// http://www.pdfsharp.net/NuGetPackage_PDFsharp-WPF.ashx
|
||||
/// </remarks>
|
||||
public const string NuGetProjectUrl = "www.pdfsharp.net";
|
||||
|
||||
/// <summary>
|
||||
/// Nuspec Doc: A URL for the image to use as the icon for the package in the Manage NuGet Packages
|
||||
/// dialog box. This should be a 32x32-pixel .png file that has a transparent background.
|
||||
/// </summary>
|
||||
public const string NuGetIconUrl = "http://www.pdfsharp.net/resources/PDFsharp-Logo-32x32.png";
|
||||
|
||||
/// <summary>
|
||||
/// Nuspec Doc: A link to the license that the package is under.
|
||||
/// </summary>
|
||||
public const string NuGetLicenseUrl = "http://www.pdfsharp.net/PDFsharp_License.ashx";
|
||||
|
||||
/// <summary>
|
||||
/// Nuspec Doc: A Boolean value that specifies whether the client needs to ensure that the package license (described by licenseUrl) is accepted before the package is installed.
|
||||
/// </summary>
|
||||
public const bool NuGetRequireLicenseAcceptance = false;
|
||||
|
||||
/// <summary>
|
||||
/// Nuspec Doc: A space-delimited list of tags and keywords that describe the package. This information is used to help make sure users can find the package using
|
||||
/// searches in the Add Package Reference dialog box or filtering in the Package Manager Console window.
|
||||
/// </summary>
|
||||
public const string NuGetTags = "PDFsharp PDF creation";
|
||||
|
||||
/// <summary>
|
||||
/// The technology tag of the product:
|
||||
/// (none) Pure .NET
|
||||
/// -gdi : GDI+,
|
||||
/// -wpf : WPF,
|
||||
/// -hybrid : Both GDI+ and WPF (hybrid).
|
||||
/// -sl : Silverlight
|
||||
/// -wp : Windows Phone
|
||||
/// -wrt : Windows RunTime
|
||||
/// </summary>
|
||||
#if GDI && !WPF
|
||||
// GDI+ (System.Drawing)
|
||||
public const string Technology = "-gdi";
|
||||
#endif
|
||||
#if WPF && !GDI && !SILVERLIGHT
|
||||
// Windows Presentation Foundation
|
||||
public const string Technology = "-wpf";
|
||||
#endif
|
||||
#if WPF && GDI
|
||||
// Hybrid - for testing only
|
||||
public const string Technology = "-h";
|
||||
#endif
|
||||
#if SILVERLIGHT && !WINDOWS_PHONE
|
||||
// Silverlight 5
|
||||
public const string Technology = "-sl";
|
||||
#endif
|
||||
#if WINDOWS_PHONE
|
||||
// Windows Phone
|
||||
public const string Technology = "-wp";
|
||||
#endif
|
||||
#if NETFX_CORE
|
||||
// WinRT
|
||||
public const string Technology = "-wrt";
|
||||
#endif
|
||||
#if UWP
|
||||
// Windows Universal App
|
||||
public const string Technology = "-uwp";
|
||||
#endif
|
||||
#if CORE
|
||||
// .net without GDI+ and WPF
|
||||
public const string Technology = ""; // no extension
|
||||
#endif
|
||||
}
|
||||
}
|
49
PdfSharp/root/VersionInfo.cs
Normal file
49
PdfSharp/root/VersionInfo.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
#region PDFsharp - A .NET library for processing PDF
|
||||
//
|
||||
// Authors:
|
||||
// Stefan Lange
|
||||
//
|
||||
// Copyright (c) 2005-2017 empira Software GmbH, Cologne Area (Germany)
|
||||
//
|
||||
// http://www.pdfsharp.com
|
||||
// http://sourceforge.net/projects/pdfsharp
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
namespace PdfSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Version info of this assembly.
|
||||
/// </summary>
|
||||
static class VersionInfo
|
||||
{
|
||||
public const string Title = ProductVersionInfo.Title;
|
||||
public const string Description = ProductVersionInfo.Description;
|
||||
public const string Producer = ProductVersionInfo.Producer;
|
||||
public const string Version = ProductVersionInfo.Version;
|
||||
public const string Url = ProductVersionInfo.Url;
|
||||
public const string Configuration = "";
|
||||
public const string Company = ProductVersionInfo.Company;
|
||||
public const string Product = ProductVersionInfo.Product;
|
||||
public const string Copyright = ProductVersionInfo.Copyright;
|
||||
public const string Trademark = ProductVersionInfo.Trademark;
|
||||
public const string Culture = "";
|
||||
}
|
||||
}
|
76
PdfSharp/root/enums/PSMsgID.cs
Normal file
76
PdfSharp/root/enums/PSMsgID.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
#region PDFsharp - A .NET library for processing PDF
|
||||
//
|
||||
// Authors:
|
||||
// Stefan Lange
|
||||
//
|
||||
// Copyright (c) 2005-2017 empira Software GmbH, Cologne Area (Germany)
|
||||
//
|
||||
// http://www.pdfsharp.com
|
||||
// http://sourceforge.net/projects/pdfsharp
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
namespace PdfSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents IDs for error and diagnostic messages generated by PDFsharp.
|
||||
/// </summary>
|
||||
// ReSharper disable once InconsistentNaming
|
||||
enum PSMsgID
|
||||
{
|
||||
// ----- General Messages ---------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// PSMsgID.
|
||||
/// </summary>
|
||||
SampleMessage1,
|
||||
|
||||
/// <summary>
|
||||
/// PSMsgID.
|
||||
/// </summary>
|
||||
SampleMessage2,
|
||||
|
||||
// ----- XGraphics Messages ---------------------------------------------------------------
|
||||
|
||||
// ----- PDF Messages ----------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// PSMsgID.
|
||||
/// </summary>
|
||||
NameMustStartWithSlash,
|
||||
|
||||
/// <summary>
|
||||
/// PSMsgID.
|
||||
/// </summary>
|
||||
UserOrOwnerPasswordRequired,
|
||||
|
||||
// ----- PdfParser Messages -------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// PSMsgID.
|
||||
/// </summary>
|
||||
UnexpectedToken,
|
||||
|
||||
/// <summary>
|
||||
/// PSMsgID.
|
||||
/// </summary>
|
||||
UnknownEncryption,
|
||||
}
|
||||
}
|
54
PdfSharp/root/enums/PageOrientation.cs
Normal file
54
PdfSharp/root/enums/PageOrientation.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
#region PDFsharp - A .NET library for processing PDF
|
||||
//
|
||||
// Authors:
|
||||
// Stefan Lange
|
||||
//
|
||||
// Copyright (c) 2005-2017 empira Software GmbH, Cologne Area (Germany)
|
||||
//
|
||||
// http://www.pdfsharp.com
|
||||
// http://sourceforge.net/projects/pdfsharp
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
namespace PdfSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Base namespace of PDFsharp. Most classes are implemented in nested namespaces like e. g. PdfSharp.Pdf.
|
||||
/// </summary>
|
||||
/// <seealso cref="PdfSharp.Pdf"></seealso>
|
||||
[System.Runtime.CompilerServices.CompilerGenerated]
|
||||
internal class NamespaceDoc { }
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the orientation of a page.
|
||||
/// </summary>
|
||||
public enum PageOrientation
|
||||
{
|
||||
/// <summary>
|
||||
/// The default page orientation.
|
||||
/// </summary>
|
||||
Portrait,
|
||||
|
||||
/// <summary>
|
||||
/// The width and height of the page are reversed.
|
||||
/// </summary>
|
||||
Landscape,
|
||||
}
|
||||
}
|
281
PdfSharp/root/enums/PageSize.cs
Normal file
281
PdfSharp/root/enums/PageSize.cs
Normal file
@@ -0,0 +1,281 @@
|
||||
#region PDFsharp - A .NET library for processing PDF
|
||||
//
|
||||
// Authors:
|
||||
// Stefan Lange
|
||||
//
|
||||
// Copyright (c) 2005-2017 empira Software GmbH, Cologne Area (Germany)
|
||||
//
|
||||
// http://www.pdfsharp.com
|
||||
// http://sourceforge.net/projects/pdfsharp
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
namespace PdfSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Identifies the most popular predefined page sizes.
|
||||
/// </summary>
|
||||
public enum PageSize
|
||||
{
|
||||
/// <summary>
|
||||
/// The width or height of the page are set manually and override the PageSize property.
|
||||
/// </summary>
|
||||
Undefined = 0,
|
||||
|
||||
// ISO formats (link is dead in the meantime)
|
||||
// see http://www.engineeringtoolbox.com/drawings-paper-sheets-sizes-25_349.html
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 841 mm times 1189 mm or 33.11 inch times 46.81 inch.
|
||||
/// </summary>
|
||||
A0 = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 594 mm times 841 mm or 23.39 inch times 33.1 inch.
|
||||
/// </summary>
|
||||
A1 = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 420 mm times 594 mm or 16.54 inch times 23.29 inch.
|
||||
/// </summary>
|
||||
A2 = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 297 mm times 420 mm or 11.69 inch times 16.54 inch.
|
||||
/// </summary>
|
||||
A3 = 4,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 210 mm times 297 mm or 8.27 inch times 11.69 inch.
|
||||
/// </summary>
|
||||
A4 = 5,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 148 mm times 210 mm or 5.83 inch times 8.27 inch.
|
||||
/// </summary>
|
||||
A5 = 6,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 860 mm times 1220 mm.
|
||||
/// </summary>
|
||||
RA0 = 7,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 610 mm times 860 mm.
|
||||
/// </summary>
|
||||
RA1 = 8,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 430 mm times 610 mm.
|
||||
/// </summary>
|
||||
RA2 = 9,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 305 mm times 430 mm.
|
||||
/// </summary>
|
||||
RA3 = 10,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 215 mm times 305 mm.
|
||||
/// </summary>
|
||||
RA4 = 11,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 153 mm times 215 mm.
|
||||
/// </summary>
|
||||
RA5 = 12,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 1000 mm times 1414 mm or 39.37 inch times 55.67 inch.
|
||||
/// </summary>
|
||||
B0 = 13,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 707 mm times 1000 mm or 27.83 inch times 39.37 inch.
|
||||
/// </summary>
|
||||
B1 = 14,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 500 mm times 707 mm or 19.68 inch times 27.83 inch.
|
||||
/// </summary>
|
||||
B2 = 15,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 353 mm times 500 mm or 13.90 inch times 19.68 inch.
|
||||
/// </summary>
|
||||
B3 = 16,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 250 mm times 353 mm or 9.84 inch times 13.90 inch.
|
||||
/// </summary>
|
||||
B4 = 17,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 176 mm times 250 mm or 6.93 inch times 9.84 inch.
|
||||
/// </summary>
|
||||
B5 = 18,
|
||||
|
||||
#if true_
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 917 mm times 1297 mm or 36.00 inch times 51.20 inch.
|
||||
/// </summary>
|
||||
C0 = 19,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 648 mm times 917 mm or 25.60 inch times 36.00 inch.
|
||||
/// </summary>
|
||||
C1 = 20,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 458 mm times 648 mm or 18.00 inch times 25.60 inch.
|
||||
/// </summary>
|
||||
C2 = 21,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 324 mm times 458 mm or 12.80 inch times 18.00 inch.
|
||||
/// </summary>
|
||||
C3 = 22,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 229 mm times 324 mm or 9.00 inch times 12.80 inch.
|
||||
/// </summary>
|
||||
C4 = 23,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 162 mm times 229 mm or 6.40 inch times 9.0 inch.
|
||||
/// </summary>
|
||||
C5 = 24,
|
||||
#endif
|
||||
|
||||
// Current U.S. loose paper sizes
|
||||
// see http://www.reference.com/browse/wiki/Paper_size
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 10 inch times 8 inch or 254 mm times 203 mm.
|
||||
/// </summary>
|
||||
Quarto = 100,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 13 inch times 8 inch or 330 mm times 203 mm.
|
||||
/// </summary>
|
||||
Foolscap = 101,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 10.5 inch times 7.25 inch or 267 mm times 184 mm.
|
||||
/// </summary>
|
||||
Executive = 102,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 10.5 inch times 8 inch 267 mm times 203 mm.
|
||||
/// </summary>
|
||||
GovernmentLetter = 103,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 11 inch times 8.5 inch 279 mm times 216 mm.
|
||||
/// </summary>
|
||||
Letter = 104,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 14 inch times 8.5 inch 356 mm times 216 mm.
|
||||
/// </summary>
|
||||
Legal = 105,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 17 inch times 11 inch or 432 mm times 279 mm.
|
||||
/// </summary>
|
||||
Ledger = 106,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 17 inch times 11 inch or 432 mm times 279 mm.
|
||||
/// </summary>
|
||||
Tabloid = 107,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 19.25 inch times 15.5 inch 489 mm times 394 mm.
|
||||
/// </summary>
|
||||
Post = 108,
|
||||
|
||||
/// <summary>
|
||||
/// 20 <20>Identifies a paper sheet size of 20 inch times 15 inch or 508 mm times 381 mm.
|
||||
/// </summary>
|
||||
Crown = 109,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 21 inch times 16.5 inch 533 mm times 419 mm.
|
||||
/// </summary>
|
||||
LargePost = 110,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 22.5 inch times 17.5 inch 572 mm times 445 mm.
|
||||
/// </summary>
|
||||
Demy = 111,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 23 inch times 18 inch or 584 mm times 457 mm.
|
||||
/// </summary>
|
||||
Medium = 112,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 25 inch times 20 inch or 635 mm times 508 mm.
|
||||
/// </summary>
|
||||
Royal = 113,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 28 inch times 23 inch or 711 mm times 584 mm.
|
||||
/// </summary>
|
||||
Elephant = 114,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 35 inch times 23.5 inch or 889 mm times 597 mm.
|
||||
/// </summary>
|
||||
DoubleDemy = 115,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 45 inch times 35 inch 1143 times 889 mm.
|
||||
/// </summary>
|
||||
QuadDemy = 116,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 8.5 inch times 5.5 inch or 216 mm times 396 mm.
|
||||
/// </summary>
|
||||
STMT = 117,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 8.5 inch times 13 inch or 216 mm times 330 mm.
|
||||
/// </summary>
|
||||
Folio = 120,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 5.5 inch times 8.5 inch or 396 mm times 216 mm.
|
||||
/// </summary>
|
||||
Statement = 121,
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a paper sheet size of 10 inch times 14 inch.
|
||||
/// </summary>
|
||||
Size10x14 = 122,
|
||||
|
||||
//A 11 <20> 8.5 279 <20> 216
|
||||
//B 17 <20> 11 432 <20> 279
|
||||
//C 22 <20> 17 559 <20> 432
|
||||
//D 34 <20> 22 864 <20> 559
|
||||
//E 44 <20> 34 1118 <20> 864
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user