diff --git a/Mairegger.Printing/Content/DirectPrintContent.cs b/Mairegger.Printing/Content/DirectPrintContent.cs
index 01ac92e5..ff40dfb0 100644
--- a/Mairegger.Printing/Content/DirectPrintContent.cs
+++ b/Mairegger.Printing/Content/DirectPrintContent.cs
@@ -16,9 +16,37 @@ namespace Mairegger.Printing.Content
{
using System.Windows;
- public abstract class DirectPrintContent : IPrintContent
+ ///
+ ///
+ /// A print content that can be positionized freely on the page.
+ ///
+ ///
+ /// By returning an instance of this class from a
+ ///
+ /// or following
+ /// behaviors apply:
+ ///
+ ///
+ /// Method
+ /// Behavior
+ ///
+ /// -
+ ///
+ ///
+ ///
+ /// The object is printed on the current page.
+ ///
+ /// -
+ ///
+ ///
+ ///
+ /// The item can be printed on any page that is desired.
+ ///
+ ///
+ ///
+ public class DirectPrintContent : IDirectPrintContent
{
- public abstract UIElement Content { get; }
+ public virtual UIElement Content { get; set; }
public Point Position { get; set; }
}
diff --git a/Mairegger.Printing/Content/IDirectPrintContent.cs b/Mairegger.Printing/Content/IDirectPrintContent.cs
new file mode 100644
index 00000000..424916c2
--- /dev/null
+++ b/Mairegger.Printing/Content/IDirectPrintContent.cs
@@ -0,0 +1,26 @@
+// Copyright 2017 Michael Mairegger
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+namespace Mairegger.Printing.Content
+{
+ using System.Windows;
+
+ public interface IDirectPrintContent : IPrintContent
+ {
+ ///
+ /// Gets the position where the should be printed.
+ ///
+ Point Position { get; }
+ }
+}
\ No newline at end of file
diff --git a/Mairegger.Printing/Content/IPrintContent.cs b/Mairegger.Printing/Content/IPrintContent.cs
index b40378d5..82af9b2b 100644
--- a/Mairegger.Printing/Content/IPrintContent.cs
+++ b/Mairegger.Printing/Content/IPrintContent.cs
@@ -15,7 +15,6 @@
namespace Mairegger.Printing.Content
{
using System.Windows;
- using Mairegger.Printing.PrintProcessor;
///
/// Interface that provides the line-data for the
diff --git a/Mairegger.Printing/Internal/InternalPrintProcessor.cs b/Mairegger.Printing/Internal/InternalPrintProcessor.cs
index bb1f231b..ea708100 100644
--- a/Mairegger.Printing/Internal/InternalPrintProcessor.cs
+++ b/Mairegger.Printing/Internal/InternalPrintProcessor.cs
@@ -79,6 +79,14 @@ public FixedDocument CreateFixedDocument(PrintProcessorCollection collection)
{
AddPageNumbers(currentPage);
}
+
+ for (int i = currentPage,
+ j = 1;
+ i < FixedDocument.Pages.Count;
+ i++, j++)
+ {
+ AddCustomPositionizedContent(FixedDocument.Pages[i], _printProcessor.GetCustomPageContent(j));
+ }
}
if (!collection.IndividualPageNumbers)
@@ -103,6 +111,15 @@ private static void PositionizeUiElement(PageContent pageContent, UIElement fram
pageContent.Child.Children.Add(frameworkElement);
}
+ private static void AddCustomPositionizedContent(PageContent page, IEnumerable customContent)
+ {
+ foreach (var content in customContent)
+ {
+ PositionizeUiElement(page, content.Content, content.Position);
+ }
+ }
+
+
private void AddBackground(PageContent pageContent, bool isLastpage)
{
if (!_printProcessor.PrintDefinition.IsToPrint(PrintAppendixes.Background, CurrentPageNumber, isLastpage))
@@ -176,7 +193,7 @@ private void AddLineItem(IPrintContent item, bool isLast)
{
AddLineItem((IPageBreakAware)item, isLast);
}
- else if (item is DirectPrintContent directPrintContent)
+ else if (item is IDirectPrintContent directPrintContent)
{
var position = new Point(directPrintContent.Position.X + _pageHelper.PrintingDimension.Margin.Left, directPrintContent.Position.Y + _pageHelper.PrintingDimension.Margin.Top);
PositionizeUiElement(_pageHelper.PageContent, item.Content, position);
diff --git a/Mairegger.Printing/Mairegger.Printing.csproj b/Mairegger.Printing/Mairegger.Printing.csproj
index 456e55c9..71bf5a98 100644
--- a/Mairegger.Printing/Mairegger.Printing.csproj
+++ b/Mairegger.Printing/Mairegger.Printing.csproj
@@ -74,6 +74,7 @@
+
diff --git a/Mairegger.Printing/PrintProcessor/IPrintProcessor.cs b/Mairegger.Printing/PrintProcessor/IPrintProcessor.cs
index 426bff24..4a525f65 100644
--- a/Mairegger.Printing/PrintProcessor/IPrintProcessor.cs
+++ b/Mairegger.Printing/PrintProcessor/IPrintProcessor.cs
@@ -128,5 +128,13 @@ public interface IPrintProcessor : IPrintProcessorPrinter
///
/// A collection containing the print contents
IEnumerable ItemCollection();
+
+
+ ///
+ /// Returns a list of to allow custom positionizing element on the page.
+ ///
+ /// The current page number. The numbering starts with 1.
+ ///
+ IEnumerable GetCustomPageContent(int pageNumber);
}
}
\ No newline at end of file
diff --git a/Mairegger.Printing/PrintProcessor/PrintProcessor.cs b/Mairegger.Printing/PrintProcessor/PrintProcessor.cs
index fb428721..ccab7bbf 100644
--- a/Mairegger.Printing/PrintProcessor/PrintProcessor.cs
+++ b/Mairegger.Printing/PrintProcessor/PrintProcessor.cs
@@ -95,6 +95,11 @@ public static bool PrintDocument(IPrintDialog printDialog, PrintProcessorCollect
return true;
}
+ public virtual IEnumerable GetCustomPageContent(int pageNumber)
+ {
+ yield break;
+ }
+
///
/// Sets the global configuration of the . This action is applied before each print.
///