|
@@ -1,5 +1,6 @@
|
|
|
using System;
|
|
using System;
|
|
|
using QuestPDF.Drawing;
|
|
using QuestPDF.Drawing;
|
|
|
|
|
+using QuestPDF.Drawing.Exceptions;
|
|
|
using QuestPDF.Elements;
|
|
using QuestPDF.Elements;
|
|
|
using QuestPDF.Helpers;
|
|
using QuestPDF.Helpers;
|
|
|
using QuestPDF.Infrastructure;
|
|
using QuestPDF.Infrastructure;
|
|
@@ -209,6 +210,9 @@ namespace QuestPDF.Fluent
|
|
|
/// </remarks>
|
|
/// </remarks>
|
|
|
public IContainer Background()
|
|
public IContainer Background()
|
|
|
{
|
|
{
|
|
|
|
|
+ if (Page.Background != Empty.Instance)
|
|
|
|
|
+ throw new DocumentComposeException("The 'Page.Background' layer has already been defined. Please call this method only once.");
|
|
|
|
|
+
|
|
|
var container = new Container();
|
|
var container = new Container();
|
|
|
Page.Background = container;
|
|
Page.Background = container;
|
|
|
return container;
|
|
return container;
|
|
@@ -222,6 +226,9 @@ namespace QuestPDF.Fluent
|
|
|
/// </remarks>
|
|
/// </remarks>
|
|
|
public IContainer Foreground()
|
|
public IContainer Foreground()
|
|
|
{
|
|
{
|
|
|
|
|
+ if (Page.Foreground != Empty.Instance)
|
|
|
|
|
+ throw new DocumentComposeException("The 'Page.Foreground' layer has already been defined. Please call this method only once.");
|
|
|
|
|
+
|
|
|
var container = new Container();
|
|
var container = new Container();
|
|
|
Page.Foreground = container;
|
|
Page.Foreground = container;
|
|
|
return container;
|
|
return container;
|
|
@@ -235,6 +242,9 @@ namespace QuestPDF.Fluent
|
|
|
/// </remarks>
|
|
/// </remarks>
|
|
|
public IContainer Header()
|
|
public IContainer Header()
|
|
|
{
|
|
{
|
|
|
|
|
+ if (Page.Header != Empty.Instance)
|
|
|
|
|
+ throw new DocumentComposeException("The 'Page.Header' layer has already been defined. Please call this method only once.");
|
|
|
|
|
+
|
|
|
var container = new Container();
|
|
var container = new Container();
|
|
|
Page.Header = container;
|
|
Page.Header = container;
|
|
|
return container;
|
|
return container;
|
|
@@ -248,6 +258,9 @@ namespace QuestPDF.Fluent
|
|
|
/// </remarks>
|
|
/// </remarks>
|
|
|
public IContainer Content()
|
|
public IContainer Content()
|
|
|
{
|
|
{
|
|
|
|
|
+ if (Page.Content != Empty.Instance)
|
|
|
|
|
+ throw new DocumentComposeException("The 'Page.Content' layer has already been defined. Please call this method only once.");
|
|
|
|
|
+
|
|
|
var container = new Container();
|
|
var container = new Container();
|
|
|
Page.Content = container;
|
|
Page.Content = container;
|
|
|
return container;
|
|
return container;
|
|
@@ -261,6 +274,9 @@ namespace QuestPDF.Fluent
|
|
|
/// </remarks>
|
|
/// </remarks>
|
|
|
public IContainer Footer()
|
|
public IContainer Footer()
|
|
|
{
|
|
{
|
|
|
|
|
+ if (Page.Footer != Empty.Instance)
|
|
|
|
|
+ throw new DocumentComposeException("The 'Page.Footer' layer has already been defined. Please call this method only once.");
|
|
|
|
|
+
|
|
|
var container = new Container();
|
|
var container = new Container();
|
|
|
Page.Footer = container;
|
|
Page.Footer = container;
|
|
|
return container;
|
|
return container;
|