diff --git a/BuildLibs/Lakerfield.MigraDoc.1.32.4.nuspec b/BuildLibs/Lakerfield.MigraDoc.1.32.4.nuspec
new file mode 100644
index 0000000..529016d
--- /dev/null
+++ b/BuildLibs/Lakerfield.MigraDoc.1.32.4.nuspec
@@ -0,0 +1,19 @@
+
+
+
+ Lakerfield.MigraDoc
+ 1.32.4
+ Michael Lakerveld
+ https://github.com/Lakerfield/PdfSharp
+ false
+ Special MigraDoc build from Lakerfield
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BuildLibs/Lakerfield.PdfSharp.1.32.4.nuspec b/BuildLibs/Lakerfield.PdfSharp.1.32.4.nuspec
new file mode 100644
index 0000000..c8716b3
--- /dev/null
+++ b/BuildLibs/Lakerfield.PdfSharp.1.32.4.nuspec
@@ -0,0 +1,15 @@
+
+
+
+ Lakerfield.PdfSharp
+ 1.32.4
+ Michael Lakerveld
+ https://github.com/Lakerfield/PdfSharp
+ false
+ Special PdfSharp build from Lakerfield
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BuildLibs/MigraDoc.DocumentObjectModel-WPF.dll b/BuildLibs/MigraDoc.DocumentObjectModel-WPF.dll
index 38ec9c3..0bdddb8 100644
Binary files a/BuildLibs/MigraDoc.DocumentObjectModel-WPF.dll and b/BuildLibs/MigraDoc.DocumentObjectModel-WPF.dll differ
diff --git a/BuildLibs/MigraDoc.Rendering-WPF.dll b/BuildLibs/MigraDoc.Rendering-WPF.dll
index 06f2cb5..b7dc351 100644
Binary files a/BuildLibs/MigraDoc.Rendering-WPF.dll and b/BuildLibs/MigraDoc.Rendering-WPF.dll differ
diff --git a/BuildLibs/MigraDoc.RtfRendering-WPF.dll b/BuildLibs/MigraDoc.RtfRendering-WPF.dll
index d043f00..5ab484f 100644
Binary files a/BuildLibs/MigraDoc.RtfRendering-WPF.dll and b/BuildLibs/MigraDoc.RtfRendering-WPF.dll differ
diff --git a/BuildLibs/PdfSharp-WPF.dll b/BuildLibs/PdfSharp-WPF.dll
index 488e48d..ee2b95b 100644
Binary files a/BuildLibs/PdfSharp-WPF.dll and b/BuildLibs/PdfSharp-WPF.dll differ
diff --git a/BuildLibs/PdfSharp.Charting-WPF.dll b/BuildLibs/PdfSharp.Charting-WPF.dll
index 4afcf10..c33c1e9 100644
Binary files a/BuildLibs/PdfSharp.Charting-WPF.dll and b/BuildLibs/PdfSharp.Charting-WPF.dll differ
diff --git a/MigraDoc/code/MigraDoc.DocumentObjectModel/MigraDoc.DocumentObjectModel-WPF.csproj b/MigraDoc/code/MigraDoc.DocumentObjectModel/MigraDoc.DocumentObjectModel-WPF.csproj
index d88c1e5..db10a89 100644
--- a/MigraDoc/code/MigraDoc.DocumentObjectModel/MigraDoc.DocumentObjectModel-WPF.csproj
+++ b/MigraDoc/code/MigraDoc.DocumentObjectModel/MigraDoc.DocumentObjectModel-WPF.csproj
@@ -1,5 +1,5 @@
-
+
Local
9.0.30729
@@ -30,7 +30,7 @@
true
3.5
false
- v3.0
+ v4.6.1
publish\
true
Disk
@@ -53,6 +53,7 @@
+
bin\Debug\
@@ -62,7 +63,8 @@
TRACE;DEBUG
- bin\Debug\MigraDoc.DocumentObjectModel-WPF.xml
+
+
true
4096
false
@@ -75,6 +77,7 @@
full
prompt
AllRules.ruleset
+ false
bin\Release\
@@ -97,6 +100,7 @@
none
prompt
AllRules.ruleset
+ false
@@ -625,4 +629,4 @@
-
+
\ No newline at end of file
diff --git a/MigraDoc/code/MigraDoc.DocumentObjectModel/MigraDoc.DocumentObjectModel.Shapes/enums/BarcodeType.cs b/MigraDoc/code/MigraDoc.DocumentObjectModel/MigraDoc.DocumentObjectModel.Shapes/enums/BarcodeType.cs
index 69086c2..ffe2d58 100644
--- a/MigraDoc/code/MigraDoc.DocumentObjectModel/MigraDoc.DocumentObjectModel.Shapes/enums/BarcodeType.cs
+++ b/MigraDoc/code/MigraDoc.DocumentObjectModel/MigraDoc.DocumentObjectModel.Shapes/enums/BarcodeType.cs
@@ -50,6 +50,10 @@ public enum BarcodeType
///
/// Barcode "Code 128"
///
- Barcode128
+ Barcode128,
+ ///
+ /// Barcode "EAN 13"
+ ///
+ BarcodeEan13,
}
}
diff --git a/MigraDoc/code/MigraDoc.DocumentObjectModel/Properties/Resources.Designer.cs b/MigraDoc/code/MigraDoc.DocumentObjectModel/Properties/Resources.Designer.cs
index cecdd03..9b682e8 100644
--- a/MigraDoc/code/MigraDoc.DocumentObjectModel/Properties/Resources.Designer.cs
+++ b/MigraDoc/code/MigraDoc.DocumentObjectModel/Properties/Resources.Designer.cs
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.488
+// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
diff --git a/MigraDoc/code/MigraDoc.Rendering/MigraDoc.Rendering-WPF.csproj b/MigraDoc/code/MigraDoc.Rendering/MigraDoc.Rendering-WPF.csproj
index 89204cc..199c693 100644
--- a/MigraDoc/code/MigraDoc.Rendering/MigraDoc.Rendering-WPF.csproj
+++ b/MigraDoc/code/MigraDoc.Rendering/MigraDoc.Rendering-WPF.csproj
@@ -1,5 +1,5 @@
-
+
Local
9.0.30729
@@ -29,7 +29,7 @@
true
3.5
- v3.0
+ v4.6.1
publish\
true
Disk
@@ -53,6 +53,7 @@
+
bin\Debug\
@@ -77,6 +78,7 @@
full
prompt
AllRules.ruleset
+ false
bin\Release\
@@ -100,6 +102,7 @@
none
prompt
AllRules.ruleset
+ false
@@ -118,6 +121,7 @@
System.Drawing
+
System.XML
diff --git a/MigraDoc/code/MigraDoc.Rendering/MigraDoc.Rendering/BarcodeRenderer.cs b/MigraDoc/code/MigraDoc.Rendering/MigraDoc.Rendering/BarcodeRenderer.cs
index 34d8156..b261f69 100644
--- a/MigraDoc/code/MigraDoc.Rendering/MigraDoc.Rendering/BarcodeRenderer.cs
+++ b/MigraDoc/code/MigraDoc.Rendering/MigraDoc.Rendering/BarcodeRenderer.cs
@@ -108,6 +108,9 @@ internal override void Render()
case BarcodeType.Barcode39:
gfxBarcode = new Code3of9Standard();
break;
+ case BarcodeType.BarcodeEan13:
+ gfxBarcode = new Ean13();
+ break;
default:
break;
}
diff --git a/MigraDoc/code/MigraDoc.RtfRendering/MigraDoc.RtfRendering-WPF.csproj b/MigraDoc/code/MigraDoc.RtfRendering/MigraDoc.RtfRendering-WPF.csproj
index e32837f..eaf89a5 100644
--- a/MigraDoc/code/MigraDoc.RtfRendering/MigraDoc.RtfRendering-WPF.csproj
+++ b/MigraDoc/code/MigraDoc.RtfRendering/MigraDoc.RtfRendering-WPF.csproj
@@ -1,5 +1,5 @@
-
+
Local
9.0.21022
@@ -29,7 +29,7 @@
true
3.5
- v3.0
+ v4.6.1
publish\
true
Disk
@@ -63,7 +63,8 @@
TRACE;DEBUG
- bin\Debug\MigraDoc.RtfRendering-WPF.XML
+
+
true
4096
false
@@ -76,6 +77,7 @@
full
prompt
AllRules.ruleset
+ false
bin\Release\
@@ -98,6 +100,7 @@
none
prompt
AllRules.ruleset
+ false
@@ -109,6 +112,7 @@
System.Drawing
+
System.XML
@@ -307,4 +311,4 @@
-
+
\ No newline at end of file
diff --git a/PDFsharp/code/PdfSharp.Charting/PdfSharp.Charting-WPF.csproj b/PDFsharp/code/PdfSharp.Charting/PdfSharp.Charting-WPF.csproj
index 475c0ec..a875b55 100644
--- a/PDFsharp/code/PdfSharp.Charting/PdfSharp.Charting-WPF.csproj
+++ b/PDFsharp/code/PdfSharp.Charting/PdfSharp.Charting-WPF.csproj
@@ -1,5 +1,5 @@
-
+
Local
9.0.30729
@@ -28,7 +28,7 @@
true
3.5
- v3.0
+ v4.6.1
publish\
true
Disk
@@ -52,6 +52,7 @@
+
bin\Debug\
@@ -61,7 +62,8 @@
TRACE;DEBUG
- bin\Debug\PdfSharp.Charting-WPF.XML
+
+
true
4096
false
@@ -75,6 +77,7 @@
full
prompt
AllRules.ruleset
+ false
bin\Release\
@@ -98,6 +101,7 @@
none
prompt
AllRules.ruleset
+ false
@@ -417,4 +421,4 @@
-
+
\ No newline at end of file
diff --git a/PDFsharp/code/PdfSharp/PdfSharp-WPF.csproj b/PDFsharp/code/PdfSharp/PdfSharp-WPF.csproj
index 157f929..7cf986d 100644
--- a/PDFsharp/code/PdfSharp/PdfSharp-WPF.csproj
+++ b/PDFsharp/code/PdfSharp/PdfSharp-WPF.csproj
@@ -1,5 +1,5 @@
-
+
Debug
AnyCPU
@@ -10,7 +10,7 @@
Properties
PdfSharp
PdfSharp-WPF
- v3.0
+ v4.6.1
512
true
StrongnameKey.snk
@@ -41,6 +41,7 @@
1.0.0.%2a
false
true
+
true
@@ -51,8 +52,10 @@
prompt
4
true
- bin\Debug\PdfSharp-WPF.XML
+
+
AllRules.ruleset
+ false
pdbonly
@@ -64,6 +67,7 @@
true
AllRules.ruleset
bin\Release\PdfSharp-WPF.xml
+ false
@@ -93,6 +97,7 @@
+
diff --git a/PDFsharp/code/PdfSharp/PdfSharp.Drawing.BarCodes/BarCode.cs b/PDFsharp/code/PdfSharp/PdfSharp.Drawing.BarCodes/BarCode.cs
index b102179..79b483e 100644
--- a/PDFsharp/code/PdfSharp/PdfSharp.Drawing.BarCodes/BarCode.cs
+++ b/PDFsharp/code/PdfSharp/PdfSharp.Drawing.BarCodes/BarCode.cs
@@ -66,6 +66,9 @@ public static BarCode FromType(CodeType type, string text, XSize size, CodeDirec
case CodeType.Code3of9Standard:
return new Code3of9Standard(text, size, direction);
+ case CodeType.Ean13:
+ return new Ean13(text, size, direction);
+
default:
#if !SILVERLIGHT
throw new InvalidEnumArgumentException("type", (int)type, typeof(CodeType));
diff --git a/PDFsharp/code/PdfSharp/PdfSharp.Drawing.BarCodes/Code128.cs b/PDFsharp/code/PdfSharp/PdfSharp.Drawing.BarCodes/Code128.cs
index 18c3ad6..e47576f 100644
--- a/PDFsharp/code/PdfSharp/PdfSharp.Drawing.BarCodes/Code128.cs
+++ b/PDFsharp/code/PdfSharp/PdfSharp.Drawing.BarCodes/Code128.cs
@@ -42,7 +42,117 @@ private Code128Type Code128Code
///
/// A static place holder for the patterns to draw the code 128 barcode
///
- public static Dictionary Patterns;
+ public static readonly Dictionary Patterns = new Dictionary
+ {
+ { 0, new Byte[] { 2, 1, 2, 2, 2, 2 } },
+ { 1, new Byte[] { 2, 2, 2, 1, 2, 2 } },
+ { 2, new Byte[] { 2, 2, 2, 2, 2, 1 } },
+ { 3, new Byte[] { 1, 2, 1, 2, 2, 3 } },
+ { 4, new Byte[] { 1, 2, 1, 3, 2, 2 } },
+ { 5, new Byte[] { 1, 3, 1, 2, 2, 2 } },
+ { 6, new Byte[] { 1, 2, 2, 2, 1, 3 } },
+ { 7, new Byte[] { 1, 2, 2, 3, 1, 2 } },
+ { 8, new Byte[] { 1, 3, 2, 2, 1, 2 } },
+ { 9, new Byte[] { 2, 2, 1, 2, 1, 3 } },
+ { 10, new Byte[] { 2, 2, 1, 3, 1, 2 } },
+ { 11, new Byte[] { 2, 3, 1, 2, 1, 2 } },
+ { 12, new Byte[] { 1, 1, 2, 2, 3, 2 } },
+ { 13, new Byte[] { 1, 2, 2, 1, 3, 2 } },
+ { 14, new Byte[] { 1, 2, 2, 2, 3, 1 } },
+ { 15, new Byte[] { 1, 1, 3, 2, 2, 2 } },
+ { 16, new Byte[] { 1, 2, 3, 1, 2, 2 } },
+ { 17, new Byte[] { 1, 2, 3, 2, 2, 1 } },
+ { 18, new Byte[] { 2, 2, 3, 2, 1, 1 } },
+ { 19, new Byte[] { 2, 2, 1, 1, 3, 2 } },
+ { 20, new Byte[] { 2, 2, 1, 2, 3, 1 } },
+ { 21, new Byte[] { 2, 1, 3, 2, 1, 2 } },
+ { 22, new Byte[] { 2, 2, 3, 1, 1, 2 } },
+ { 23, new Byte[] { 3, 1, 2, 1, 3, 1 } },
+ { 24, new Byte[] { 3, 1, 1, 2, 2, 2 } },
+ { 25, new Byte[] { 3, 2, 1, 1, 2, 2 } },
+ { 26, new Byte[] { 3, 2, 1, 2, 2, 1 } },
+ { 27, new Byte[] { 3, 1, 2, 2, 1, 2 } },
+ { 28, new Byte[] { 3, 2, 2, 1, 1, 2 } },
+ { 29, new Byte[] { 3, 2, 2, 2, 1, 1 } },
+ { 30, new Byte[] { 2, 1, 2, 1, 2, 3 } },
+ { 31, new Byte[] { 2, 1, 2, 3, 2, 1 } },
+ { 32, new Byte[] { 2, 3, 2, 1, 2, 1 } },
+ { 33, new Byte[] { 1, 1, 1, 3, 2, 3 } },
+ { 34, new Byte[] { 1, 3, 1, 1, 2, 3 } },
+ { 35, new Byte[] { 1, 3, 1, 3, 2, 1 } },
+ { 36, new Byte[] { 1, 1, 2, 3, 1, 3 } },
+ { 37, new Byte[] { 1, 3, 2, 1, 1, 3 } },
+ { 38, new Byte[] { 1, 3, 2, 3, 1, 1 } },
+ { 39, new Byte[] { 2, 1, 1, 3, 1, 3 } },
+ { 40, new Byte[] { 2, 3, 1, 1, 1, 3 } },
+ { 41, new Byte[] { 2, 3, 1, 3, 1, 1 } },
+ { 42, new Byte[] { 1, 1, 2, 1, 3, 3 } },
+ { 43, new Byte[] { 1, 1, 2, 3, 3, 1 } },
+ { 44, new Byte[] { 1, 3, 2, 1, 3, 1 } },
+ { 45, new Byte[] { 1, 1, 3, 1, 2, 3 } },
+ { 46, new Byte[] { 1, 1, 3, 3, 2, 1 } },
+ { 47, new Byte[] { 1, 3, 3, 1, 2, 1 } },
+ { 48, new Byte[] { 3, 1, 3, 1, 2, 1 } },
+ { 49, new Byte[] { 2, 1, 1, 3, 3, 1 } },
+ { 50, new Byte[] { 2, 3, 1, 1, 3, 1 } },
+ { 51, new Byte[] { 2, 1, 3, 1, 1, 3 } },
+ { 52, new Byte[] { 2, 1, 3, 3, 1, 1 } },
+ { 53, new Byte[] { 2, 1, 3, 1, 3, 1 } },
+ { 54, new Byte[] { 3, 1, 1, 1, 2, 3 } },
+ { 55, new Byte[] { 3, 1, 1, 3, 2, 1 } },
+ { 56, new Byte[] { 3, 3, 1, 1, 2, 1 } },
+ { 57, new Byte[] { 3, 1, 2, 1, 1, 3 } },
+ { 58, new Byte[] { 3, 1, 2, 3, 1, 1 } },
+ { 59, new Byte[] { 3, 3, 2, 1, 1, 1 } },
+ { 60, new Byte[] { 3, 1, 4, 1, 1, 1 } },
+ { 61, new Byte[] { 2, 2, 1, 4, 1, 1 } },
+ { 62, new Byte[] { 4, 3, 1, 1, 1, 1 } },
+ { 63, new Byte[] { 1, 1, 1, 2, 2, 4 } },
+ { 64, new Byte[] { 1, 1, 1, 4, 2, 2 } },
+ { 65, new Byte[] { 1, 2, 1, 1, 2, 4 } },
+ { 66, new Byte[] { 1, 2, 1, 4, 2, 1 } },
+ { 67, new Byte[] { 1, 4, 1, 1, 2, 2 } },
+ { 68, new Byte[] { 1, 4, 1, 2, 2, 1 } },
+ { 69, new Byte[] { 1, 1, 2, 2, 1, 4 } },
+ { 70, new Byte[] { 1, 1, 2, 4, 1, 2 } },
+ { 71, new Byte[] { 1, 2, 2, 1, 1, 4 } },
+ { 72, new Byte[] { 1, 2, 2, 4, 1, 1 } },
+ { 73, new Byte[] { 1, 4, 2, 1, 1, 2 } },
+ { 74, new Byte[] { 1, 4, 2, 2, 1, 1 } },
+ { 75, new Byte[] { 2, 4, 1, 2, 1, 1 } },
+ { 76, new Byte[] { 2, 2, 1, 1, 1, 4 } },
+ { 77, new Byte[] { 4, 1, 3, 1, 1, 1 } },
+ { 78, new Byte[] { 2, 4, 1, 1, 1, 2 } },
+ { 79, new Byte[] { 1, 3, 4, 1, 1, 1 } },
+ { 80, new Byte[] { 1, 1, 1, 2, 4, 2 } },
+ { 81, new Byte[] { 1, 2, 1, 1, 4, 2 } },
+ { 82, new Byte[] { 1, 2, 1, 2, 4, 1 } },
+ { 83, new Byte[] { 1, 1, 4, 2, 1, 2 } },
+ { 84, new Byte[] { 1, 2, 4, 1, 1, 2 } },
+ { 85, new Byte[] { 1, 2, 4, 2, 1, 1 } },
+ { 86, new Byte[] { 4, 1, 1, 2, 1, 2 } },
+ { 87, new Byte[] { 4, 2, 1, 1, 1, 2 } },
+ { 88, new Byte[] { 4, 2, 1, 2, 1, 1 } },
+ { 89, new Byte[] { 2, 1, 2, 1, 4, 1 } },
+ { 90, new Byte[] { 2, 1, 4, 1, 2, 1 } },
+ { 91, new Byte[] { 4, 1, 2, 1, 2, 1 } },
+ { 92, new Byte[] { 1, 1, 1, 1, 4, 3 } },
+ { 93, new Byte[] { 1, 1, 1, 3, 4, 1 } },
+ { 94, new Byte[] { 1, 3, 1, 1, 4, 1 } },
+ { 95, new Byte[] { 1, 1, 4, 1, 1, 3 } },
+ { 96, new Byte[] { 1, 1, 4, 3, 1, 1 } },
+ { 97, new Byte[] { 4, 1, 1, 1, 1, 3 } },
+ { 98, new Byte[] { 4, 1, 1, 3, 1, 1 } },
+ { 99, new Byte[] { 1, 1, 3, 1, 4, 1 } },
+ { 100, new Byte[] { 1, 1, 4, 1, 3, 1 } },
+ { 101, new Byte[] { 3, 1, 1, 1, 4, 1 } },
+ { 102, new Byte[] { 4, 1, 1, 1, 3, 1 } },
+ { 103, new Byte[] { 2, 1, 1, 4, 1, 2 } },
+ { 104, new Byte[] { 2, 1, 1, 2, 1, 4 } },
+ { 105, new Byte[] { 2, 1, 1, 2, 3, 2 } },
+ { 106, new Byte[] { 2, 3, 3, 1, 1, 1, 2 } }
+ };
+
#endregion
#endregion
#region Methods
@@ -318,117 +428,6 @@ protected override void CheckCode(String text)
public Code128()
: base("", XSize.Empty, CodeDirection.LeftToRight)
{
- if (Patterns == null)
- {
- Patterns = new Dictionary();
- Patterns.Add(0, new Byte[] { 2, 1, 2, 2, 2, 2 });
- Patterns.Add(1, new Byte[] { 2, 2, 2, 1, 2, 2 });
- Patterns.Add(2, new Byte[] { 2, 2, 2, 2, 2, 1 });
- Patterns.Add(3, new Byte[] { 1, 2, 1, 2, 2, 3 });
- Patterns.Add(4, new Byte[] { 1, 2, 1, 3, 2, 2 });
- Patterns.Add(5, new Byte[] { 1, 3, 1, 2, 2, 2 });
- Patterns.Add(6, new Byte[] { 1, 2, 2, 2, 1, 3 });
- Patterns.Add(7, new Byte[] { 1, 2, 2, 3, 1, 2 });
- Patterns.Add(8, new Byte[] { 1, 3, 2, 2, 1, 2 });
- Patterns.Add(9, new Byte[] { 2, 2, 1, 2, 1, 3 });
- Patterns.Add(10, new Byte[] { 2, 2, 1, 3, 1, 2 });
- Patterns.Add(11, new Byte[] { 2, 3, 1, 2, 1, 2 });
- Patterns.Add(12, new Byte[] { 1, 1, 2, 2, 3, 2 });
- Patterns.Add(13, new Byte[] { 1, 2, 2, 1, 3, 2 });
- Patterns.Add(14, new Byte[] { 1, 2, 2, 2, 3, 1 });
- Patterns.Add(15, new Byte[] { 1, 1, 3, 2, 2, 2 });
- Patterns.Add(16, new Byte[] { 1, 2, 3, 1, 2, 2 });
- Patterns.Add(17, new Byte[] { 1, 2, 3, 2, 2, 1 });
- Patterns.Add(18, new Byte[] { 2, 2, 3, 2, 1, 1 });
- Patterns.Add(19, new Byte[] { 2, 2, 1, 1, 3, 2 });
- Patterns.Add(20, new Byte[] { 2, 2, 1, 2, 3, 1 });
- Patterns.Add(21, new Byte[] { 2, 1, 3, 2, 1, 2 });
- Patterns.Add(22, new Byte[] { 2, 2, 3, 1, 1, 2 });
- Patterns.Add(23, new Byte[] { 3, 1, 2, 1, 3, 1 });
- Patterns.Add(24, new Byte[] { 3, 1, 1, 2, 2, 2 });
- Patterns.Add(25, new Byte[] { 3, 2, 1, 1, 2, 2 });
- Patterns.Add(26, new Byte[] { 3, 2, 1, 2, 2, 1 });
- Patterns.Add(27, new Byte[] { 3, 1, 2, 2, 1, 2 });
- Patterns.Add(28, new Byte[] { 3, 2, 2, 1, 1, 2 });
- Patterns.Add(29, new Byte[] { 3, 2, 2, 2, 1, 1 });
- Patterns.Add(30, new Byte[] { 2, 1, 2, 1, 2, 3 });
- Patterns.Add(31, new Byte[] { 2, 1, 2, 3, 2, 1 });
- Patterns.Add(32, new Byte[] { 2, 3, 2, 1, 2, 1 });
- Patterns.Add(33, new Byte[] { 1, 1, 1, 3, 2, 3 });
- Patterns.Add(34, new Byte[] { 1, 3, 1, 1, 2, 3 });
- Patterns.Add(35, new Byte[] { 1, 3, 1, 3, 2, 1 });
- Patterns.Add(36, new Byte[] { 1, 1, 2, 3, 1, 3 });
- Patterns.Add(37, new Byte[] { 1, 3, 2, 1, 1, 3 });
- Patterns.Add(38, new Byte[] { 1, 3, 2, 3, 1, 1 });
- Patterns.Add(39, new Byte[] { 2, 1, 1, 3, 1, 3 });
- Patterns.Add(40, new Byte[] { 2, 3, 1, 1, 1, 3 });
- Patterns.Add(41, new Byte[] { 2, 3, 1, 3, 1, 1 });
- Patterns.Add(42, new Byte[] { 1, 1, 2, 1, 3, 3 });
- Patterns.Add(43, new Byte[] { 1, 1, 2, 3, 3, 1 });
- Patterns.Add(44, new Byte[] { 1, 3, 2, 1, 3, 1 });
- Patterns.Add(45, new Byte[] { 1, 1, 3, 1, 2, 3 });
- Patterns.Add(46, new Byte[] { 1, 1, 3, 3, 2, 1 });
- Patterns.Add(47, new Byte[] { 1, 3, 3, 1, 2, 1 });
- Patterns.Add(48, new Byte[] { 3, 1, 3, 1, 2, 1 });
- Patterns.Add(49, new Byte[] { 2, 1, 1, 3, 3, 1 });
- Patterns.Add(50, new Byte[] { 2, 3, 1, 1, 3, 1 });
- Patterns.Add(51, new Byte[] { 2, 1, 3, 1, 1, 3 });
- Patterns.Add(52, new Byte[] { 2, 1, 3, 3, 1, 1 });
- Patterns.Add(53, new Byte[] { 2, 1, 3, 1, 3, 1 });
- Patterns.Add(54, new Byte[] { 3, 1, 1, 1, 2, 3 });
- Patterns.Add(55, new Byte[] { 3, 1, 1, 3, 2, 1 });
- Patterns.Add(56, new Byte[] { 3, 3, 1, 1, 2, 1 });
- Patterns.Add(57, new Byte[] { 3, 1, 2, 1, 1, 3 });
- Patterns.Add(58, new Byte[] { 3, 1, 2, 3, 1, 1 });
- Patterns.Add(59, new Byte[] { 3, 3, 2, 1, 1, 1 });
- Patterns.Add(60, new Byte[] { 3, 1, 4, 1, 1, 1 });
- Patterns.Add(61, new Byte[] { 2, 2, 1, 4, 1, 1 });
- Patterns.Add(62, new Byte[] { 4, 3, 1, 1, 1, 1 });
- Patterns.Add(63, new Byte[] { 1, 1, 1, 2, 2, 4 });
- Patterns.Add(64, new Byte[] { 1, 1, 1, 4, 2, 2 });
- Patterns.Add(65, new Byte[] { 1, 2, 1, 1, 2, 4 });
- Patterns.Add(66, new Byte[] { 1, 2, 1, 4, 2, 1 });
- Patterns.Add(67, new Byte[] { 1, 4, 1, 1, 2, 2 });
- Patterns.Add(68, new Byte[] { 1, 4, 1, 2, 2, 1 });
- Patterns.Add(69, new Byte[] { 1, 1, 2, 2, 1, 4 });
- Patterns.Add(70, new Byte[] { 1, 1, 2, 4, 1, 2 });
- Patterns.Add(71, new Byte[] { 1, 2, 2, 1, 1, 4 });
- Patterns.Add(72, new Byte[] { 1, 2, 2, 4, 1, 1 });
- Patterns.Add(73, new Byte[] { 1, 4, 2, 1, 1, 2 });
- Patterns.Add(74, new Byte[] { 1, 4, 2, 2, 1, 1 });
- Patterns.Add(75, new Byte[] { 2, 4, 1, 2, 1, 1 });
- Patterns.Add(76, new Byte[] { 2, 2, 1, 1, 1, 4 });
- Patterns.Add(77, new Byte[] { 4, 1, 3, 1, 1, 1 });
- Patterns.Add(78, new Byte[] { 2, 4, 1, 1, 1, 2 });
- Patterns.Add(79, new Byte[] { 1, 3, 4, 1, 1, 1 });
- Patterns.Add(80, new Byte[] { 1, 1, 1, 2, 4, 2 });
- Patterns.Add(81, new Byte[] { 1, 2, 1, 1, 4, 2 });
- Patterns.Add(82, new Byte[] { 1, 2, 1, 2, 4, 1 });
- Patterns.Add(83, new Byte[] { 1, 1, 4, 2, 1, 2 });
- Patterns.Add(84, new Byte[] { 1, 2, 4, 1, 1, 2 });
- Patterns.Add(85, new Byte[] { 1, 2, 4, 2, 1, 1 });
- Patterns.Add(86, new Byte[] { 4, 1, 1, 2, 1, 2 });
- Patterns.Add(87, new Byte[] { 4, 2, 1, 1, 1, 2 });
- Patterns.Add(88, new Byte[] { 4, 2, 1, 2, 1, 1 });
- Patterns.Add(89, new Byte[] { 2, 1, 2, 1, 4, 1 });
- Patterns.Add(90, new Byte[] { 2, 1, 4, 1, 2, 1 });
- Patterns.Add(91, new Byte[] { 4, 1, 2, 1, 2, 1 });
- Patterns.Add(92, new Byte[] { 1, 1, 1, 1, 4, 3 });
- Patterns.Add(93, new Byte[] { 1, 1, 1, 3, 4, 1 });
- Patterns.Add(94, new Byte[] { 1, 3, 1, 1, 4, 1 });
- Patterns.Add(95, new Byte[] { 1, 1, 4, 1, 1, 3 });
- Patterns.Add(96, new Byte[] { 1, 1, 4, 3, 1, 1 });
- Patterns.Add(97, new Byte[] { 4, 1, 1, 1, 1, 3 });
- Patterns.Add(98, new Byte[] { 4, 1, 1, 3, 1, 1 });
- Patterns.Add(99, new Byte[] { 1, 1, 3, 1, 4, 1 });
- Patterns.Add(100, new Byte[] { 1, 1, 4, 1, 3, 1 });
- Patterns.Add(101, new Byte[] { 3, 1, 1, 1, 4, 1 });
- Patterns.Add(102, new Byte[] { 4, 1, 1, 1, 3, 1 });
- Patterns.Add(103, new Byte[] { 2, 1, 1, 4, 1, 2 });
- Patterns.Add(104, new Byte[] { 2, 1, 1, 2, 1, 4 });
- Patterns.Add(105, new Byte[] { 2, 1, 1, 2, 3, 2 });
- Patterns.Add(106, new Byte[] { 2, 3, 3, 1, 1, 1, 2 });
- }
this.code128Code = Code128Type.B;
}
///
diff --git a/PDFsharp/code/PdfSharp/PdfSharp.Drawing.BarCodes/Ean13.cs b/PDFsharp/code/PdfSharp/PdfSharp.Drawing.BarCodes/Ean13.cs
new file mode 100644
index 0000000..62e1362
--- /dev/null
+++ b/PDFsharp/code/PdfSharp/PdfSharp.Drawing.BarCodes/Ean13.cs
@@ -0,0 +1,357 @@
+#region PDFsharp - A .NET library for processing PDF
+//
+// Authors:
+// Sven Rymenants (mailto:sven.rymenants@gmail.com)
+//
+// http://www.pdfsharp.com / http://forum.pdfsharp.de/viewtopic.php?f=2&t=1524
+//
+// 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.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using PdfSharp.Drawing;
+
+namespace PdfSharp.Drawing.BarCodes
+{
+ ///
+ /// Implementation of the EAN13 bar code.
+ ///
+ public class Ean13 : BarCode
+ {
+ private XRect m_leftBlock = new XRect();
+ private XRect m_rightBlock = new XRect();
+
+ ///
+ /// Initializes a new instance of EAN13.
+ ///
+ public Ean13()
+ : base("", XSize.Empty, CodeDirection.LeftToRight)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of EAN13.
+ ///
+ public Ean13(string code)
+ : base(code, XSize.Empty, CodeDirection.LeftToRight)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of EAN13.
+ ///
+ public Ean13(string code, XSize size)
+ : base(code, size, CodeDirection.LeftToRight)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of EAN13.
+ ///
+ public Ean13(string code, XSize size, CodeDirection direction)
+ : base(code, size, direction)
+ {
+ }
+
+ static bool[] Quite = new bool[] { false, false, false, false, false, false, false, false, false };
+ static bool[] Leading = new bool[] { true, false, true };
+ static bool[] Separator = new bool[] { false, true, false, true, false };
+
+ static bool[][] OddLeftLines = new bool[][]
+ {
+ new bool[] { false, false, false, true, true, false, true },
+ new bool[] { false, false, true, true, false, false, true },
+ new bool[] { false, false, true, false, false, true, true },
+ new bool[] { false, true, true, true, true, false, true },
+ new bool[] { false, true, false, false, false, true, true },
+ new bool[] { false, true, true, false, false, false, true },
+ new bool[] { false, true, false, true, true, true, true },
+ new bool[] { false, true, true, true, false, true, true },
+ new bool[] { false, true, true, false, true, true, true },
+ new bool[] { false, false, false, true, false, true, true }
+ };
+
+ static bool[][] EvenLeftLines = new bool[][]
+ {
+ new bool[] { false, true, false, false, true, true, true },
+ new bool[] { false, true, true, false, false, true, true },
+ new bool[] { false, false, true, true, false, true, true },
+ new bool[] { false, true, false, false, false, false, true },
+ new bool[] { false, false, true, true, true, false, true },
+ new bool[] { false, true, true, true, false, false, true },
+ new bool[] { false, false, false, false, true, false, true },
+ new bool[] { false, false, true, false, false, false, true },
+ new bool[] { false, false, false, true, false, false, true },
+ new bool[] { false, false, true, false, true, true, true }
+ };
+
+ static bool[][] RightLines = new bool[][]
+ {
+ new bool[] { true, true, true, false, false, true, false},
+ new bool[] { true, true, false, false, true, true, false},
+ new bool[] { true, true, false, true, true, false, false},
+ new bool[] { true, false, false, false, false, true, false},
+ new bool[] { true, false, true, true, true, false, false},
+ new bool[] { true, false, false, true, true, true, false},
+ new bool[] { true, false, true, false, false, false, false},
+ new bool[] { true, false, false, false, true, false, false},
+ new bool[] { true, false, false, true, false, false, false},
+ new bool[] { true, true, true, false, true, false, false}
+ };
+
+ ///
+ /// Renders the bar code.
+ ///
+ protected internal override void Render(XGraphics gfx, XBrush brush, XFont font, XPoint position)
+ {
+ XGraphicsState state = gfx.Save();
+
+ BarCodeRenderInfo info = new BarCodeRenderInfo(gfx, brush, font, position);
+ InitRendering(info);
+ info.CurrPosInString = 0;
+ info.CurrPos = position - CodeBase.CalcDistance(AnchorType.TopLeft, this.anchor, this.size);
+
+ // EAN13 Barcode should be a total of 113 modules wide.
+ int numberOfBars = 12; // The length - country code
+ numberOfBars *= 7; // Each character has 7 bars
+ numberOfBars += 2 * (Quite.Length + Leading.Length);
+ numberOfBars += Separator.Length;
+ info.ThinBarWidth = ((double)this.Size.Width / (double)numberOfBars);
+
+ RenderStart(info);
+
+ m_leftBlock.x = info.CurrPos.x + info.ThinBarWidth / 2;
+ RenderLeft(info);
+ m_leftBlock.Width = info.CurrPos.x - m_leftBlock.x;
+
+ RenderSeparator(info);
+
+ m_rightBlock.x = info.CurrPos.x;
+ RenderRight(info);
+ m_rightBlock.Width = info.CurrPos.x - m_rightBlock.x - info.ThinBarWidth / 2;
+
+ RenderStop(info);
+
+ if (this.TextLocation == TextLocation.BelowEmbedded)
+ RenderText(info);
+
+ gfx.Restore(state);
+ }
+
+ private void RenderStart(BarCodeRenderInfo info)
+ {
+ RenderValue(info, Quite);
+ RenderValue(info, Leading);
+ }
+
+ private void RenderLeft(BarCodeRenderInfo info)
+ {
+ int country = (int)(this.text[0] - '0');
+ string text = this.text.Substring(1, 6);
+
+ switch (country)
+ {
+ case 0:
+ foreach (char ch in text)
+ RenderDigit(info, ch, OddLeftLines);
+ break;
+
+ case 1:
+ RenderDigit(info, text[0], OddLeftLines);
+ RenderDigit(info, text[1], OddLeftLines);
+ RenderDigit(info, text[2], EvenLeftLines);
+ RenderDigit(info, text[3], OddLeftLines);
+ RenderDigit(info, text[4], EvenLeftLines);
+ RenderDigit(info, text[5], EvenLeftLines);
+ break;
+
+ case 2:
+ RenderDigit(info, text[0], OddLeftLines);
+ RenderDigit(info, text[1], OddLeftLines);
+ RenderDigit(info, text[2], EvenLeftLines);
+ RenderDigit(info, text[3], EvenLeftLines);
+ RenderDigit(info, text[4], OddLeftLines);
+ RenderDigit(info, text[5], EvenLeftLines);
+ break;
+
+ case 3:
+ RenderDigit(info, text[0], OddLeftLines);
+ RenderDigit(info, text[1], OddLeftLines);
+ RenderDigit(info, text[2], EvenLeftLines);
+ RenderDigit(info, text[3], EvenLeftLines);
+ RenderDigit(info, text[4], EvenLeftLines);
+ RenderDigit(info, text[5], OddLeftLines);
+ break;
+
+ case 4:
+ RenderDigit(info, text[0], OddLeftLines);
+ RenderDigit(info, text[1], EvenLeftLines);
+ RenderDigit(info, text[2], OddLeftLines);
+ RenderDigit(info, text[3], OddLeftLines);
+ RenderDigit(info, text[4], EvenLeftLines);
+ RenderDigit(info, text[5], EvenLeftLines);
+ break;
+
+ case 5:
+ RenderDigit(info, text[0], OddLeftLines);
+ RenderDigit(info, text[1], EvenLeftLines);
+ RenderDigit(info, text[2], EvenLeftLines);
+ RenderDigit(info, text[3], OddLeftLines);
+ RenderDigit(info, text[4], OddLeftLines);
+ RenderDigit(info, text[5], EvenLeftLines);
+ break;
+
+ case 6:
+ RenderDigit(info, text[0], OddLeftLines);
+ RenderDigit(info, text[1], EvenLeftLines);
+ RenderDigit(info, text[2], EvenLeftLines);
+ RenderDigit(info, text[3], EvenLeftLines);
+ RenderDigit(info, text[4], OddLeftLines);
+ RenderDigit(info, text[5], OddLeftLines);
+ break;
+
+ case 7:
+ RenderDigit(info, text[0], OddLeftLines);
+ RenderDigit(info, text[1], EvenLeftLines);
+ RenderDigit(info, text[2], OddLeftLines);
+ RenderDigit(info, text[3], EvenLeftLines);
+ RenderDigit(info, text[4], OddLeftLines);
+ RenderDigit(info, text[5], EvenLeftLines);
+ break;
+
+ case 8:
+ RenderDigit(info, text[0], OddLeftLines);
+ RenderDigit(info, text[1], EvenLeftLines);
+ RenderDigit(info, text[2], OddLeftLines);
+ RenderDigit(info, text[3], EvenLeftLines);
+ RenderDigit(info, text[4], EvenLeftLines);
+ RenderDigit(info, text[5], OddLeftLines);
+ break;
+
+ case 9:
+ RenderDigit(info, text[0], OddLeftLines);
+ RenderDigit(info, text[1], EvenLeftLines);
+ RenderDigit(info, text[2], EvenLeftLines);
+ RenderDigit(info, text[3], OddLeftLines);
+ RenderDigit(info, text[4], EvenLeftLines);
+ RenderDigit(info, text[5], OddLeftLines);
+ break;
+ }
+ }
+
+ private void RenderDigit(BarCodeRenderInfo info, char digit, bool[][] lines)
+ {
+ int index = digit - '0';
+ RenderValue(info, lines[index]);
+ }
+
+ private void RenderSeparator(BarCodeRenderInfo info)
+ {
+ RenderValue(info, Separator);
+ }
+
+ private void RenderRight(BarCodeRenderInfo info)
+ {
+ string text = this.text.Substring(7);
+
+ if (this.text.Length == 12)
+ text += CalculateChecksumDigit(this.text);
+
+ foreach (char ch in text)
+ RenderDigit(info, ch, RightLines);
+ }
+
+ private void RenderStop(BarCodeRenderInfo info)
+ {
+ RenderValue(info, Leading);
+ RenderValue(info, Quite);
+ }
+
+ private void RenderValue(BarCodeRenderInfo info, bool[] value)
+ {
+ foreach (bool bar in value)
+ {
+ if (bar)
+ {
+ XRect rect = new XRect(info.CurrPos.X, info.CurrPos.Y, info.ThinBarWidth, Size.Height);
+ info.Gfx.DrawRectangle(info.Brush, rect);
+ }
+ info.CurrPos.X += info.ThinBarWidth;
+ }
+ }
+
+ private void RenderText(BarCodeRenderInfo info)
+ {
+ if (info.Font == null)
+ info.Font = new XFont("Courier New", Size.Height / 4);
+ XPoint center = info.Position + CodeBase.CalcDistance(this.anchor, AnchorType.TopLeft, this.size);
+ XSize textSize = info.Gfx.MeasureString(this.text, info.Font);
+
+ double height = textSize.height;
+ double y = info.Position.y + Size.Height - textSize.height;
+
+ m_leftBlock.Height = height;
+ m_leftBlock.y = y;
+
+ m_rightBlock.Height = height;
+ m_rightBlock.y = y;
+
+ XPoint pos = new XPoint(info.Position.x, y);
+ info.Gfx.DrawString(this.text.Substring(0, 1), info.Font, info.Brush, new XRect(pos, Size), XStringFormats.TopLeft);
+
+ info.Gfx.DrawRectangle(XBrushes.White, m_leftBlock);
+ info.Gfx.DrawString(this.text.Substring(1, 6), info.Font, info.Brush, m_leftBlock, XStringFormats.TopCenter);
+
+ info.Gfx.DrawRectangle(XBrushes.White, m_rightBlock);
+
+ string text = this.text.Substring(7);
+ if (this.text.Length == 12)
+ text += CalculateChecksumDigit(this.text);
+
+ info.Gfx.DrawString(text, info.Font, info.Brush, m_rightBlock, XStringFormats.TopCenter);
+ }
+
+ private string CalculateChecksumDigit(string text)
+ {
+ bool odd = false;
+ int sum = 0;
+ foreach (char ch in text)
+ {
+ sum += (ch - '0') * (odd ? 3 : 1);
+ odd = !odd;
+ }
+ int result = (10 - (sum % 10)) % 10;
+ return result.ToString();
+ }
+
+ /// Validates the text string to be coded
+ /// String - The text string to be coded
+ protected override void CheckCode(string text)
+ {
+ if (text == null) throw new ArgumentNullException("Parameter text (string) can not be null");
+ if (text.Length != 12) throw new ArgumentException("Parameter text (string) can not have more or less than 12 characters");
+ }
+ }
+}
+
diff --git a/PDFsharp/code/PdfSharp/PdfSharp.Drawing.BarCodes/enums/CodeType.cs b/PDFsharp/code/PdfSharp/PdfSharp.Drawing.BarCodes/enums/CodeType.cs
index 3e9817e..5b66d04 100644
--- a/PDFsharp/code/PdfSharp/PdfSharp.Drawing.BarCodes/enums/CodeType.cs
+++ b/PDFsharp/code/PdfSharp/PdfSharp.Drawing.BarCodes/enums/CodeType.cs
@@ -53,5 +53,10 @@ public enum CodeType
/// The data matrix code.
///
DataMatrix,
+
+ ///
+ /// The standard ean13 barcode.
+ ///
+ Ean13,
}
}
diff --git a/PdfSharpMigraDocTestApp/App.config b/PdfSharpMigraDocTestApp/App.config
index 8e15646..bae5d6d 100644
--- a/PdfSharpMigraDocTestApp/App.config
+++ b/PdfSharpMigraDocTestApp/App.config
@@ -1,6 +1,6 @@
-
+
-
+
-
\ No newline at end of file
+
diff --git a/PdfSharpMigraDocTestApp/PdfSharpMigraDocTestApp.csproj b/PdfSharpMigraDocTestApp/PdfSharpMigraDocTestApp.csproj
index 6c5c7d5..870ca20 100644
--- a/PdfSharpMigraDocTestApp/PdfSharpMigraDocTestApp.csproj
+++ b/PdfSharpMigraDocTestApp/PdfSharpMigraDocTestApp.csproj
@@ -1,5 +1,5 @@
-
+
Debug
@@ -9,8 +9,9 @@
Properties
PdfSharpMigraDocTestApp
PdfSharpMigraDocTestApp
- v4.5
+ v4.6.1
512
+
AnyCPU
@@ -47,7 +48,9 @@
-
+
+ Designer
+
diff --git a/README.md b/README.md
index 932b4a7..6dbeede 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,7 @@ Changes made:
- Some refactoring in the barcode (text) renderer
- Extended MigraDoc DocumentObjectModel with AddBarcode methodes
- Applied patch for faster table rendering from http://www.pakeha_by.my-webs.org/MigraDocFastTableRender.html and http://forum.pdfsharp.net/viewtopic.php?f=2&t=679 (pakeha_by)
+- Add ean13 barcode from http://forum.pdfsharp.de/viewtopic.php?f=2&t=1524
- ...