-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for rendering
areas
in PDF templates
Introduce the concept of `areas` that can be rendered in designated positions within a PDF template, ignoring margin rules. Implement new exceptions to handle incomplete area configurations and unsupported child controls within content controls. Update generator and template processing to measure, arrange, and render these `areas`, with new unit tests verifying the functionality.
- Loading branch information
Showing
10 changed files
with
457 additions
and
36 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
source/X39.Solutions.PdfTemplate/Exceptions/AreaIncompleteException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
namespace X39.Solutions.PdfTemplate.Exceptions; | ||
|
||
/// <summary> | ||
/// Represents an exception that is thrown when an area is incomplete in a PDF template. | ||
/// </summary> | ||
public class AreaIncompleteException : Exception | ||
{ | ||
/// <summary> | ||
/// Gets the line number where the exception occurred. | ||
/// </summary> | ||
public int Line { get; } | ||
|
||
/// <summary> | ||
/// Gets the column number associated with the exception. | ||
/// </summary> | ||
/// <remarks> | ||
/// The Column property indicates the specific column where the incomplete area | ||
/// was encountered during the parsing or processing operation. | ||
/// </remarks> | ||
public int Column { get; } | ||
|
||
/// <summary> | ||
/// Represents an exception that is thrown when an area is found to be incomplete. | ||
/// </summary> | ||
internal AreaIncompleteException(int line, int column, string message) : base(message) | ||
{ | ||
Line = line; | ||
Column = column; | ||
} | ||
} |
15 changes: 0 additions & 15 deletions
15
source/X39.Solutions.PdfTemplate/Exceptions/ContentControlDoesNotSupportChild.cs
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
source/X39.Solutions.PdfTemplate/Exceptions/ContentControlDoesNotSupportChildrenException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
namespace X39.Solutions.PdfTemplate.Exceptions; | ||
|
||
/// <summary> | ||
/// Exception thrown when an attempt is made to add child controls to a content control | ||
/// that does not support children. | ||
/// </summary> | ||
/// <remarks> | ||
/// This exception provides details about the location in the template where the | ||
/// unsupported children were encountered, including the line and column numbers. | ||
/// </remarks> | ||
public class ContentControlDoesNotSupportChildrenException : Exception | ||
{ | ||
/// <summary> | ||
/// Gets the line number where the exception occurred. | ||
/// </summary> | ||
public int Line { get; } | ||
|
||
/// <summary> | ||
/// Gets the column number where the exception occurred. | ||
/// </summary> | ||
/// <remarks> | ||
/// This property holds the column number which can help in identifying | ||
/// the exact location in the document or template that caused the exception. | ||
/// </remarks> | ||
public int Column { get; } | ||
|
||
/// <summary> | ||
/// Represents an exception that is thrown when a content control | ||
/// does not support the inclusion of child controls. | ||
/// </summary> | ||
/// <remarks> | ||
/// This exception provides information about the line and column | ||
/// where the issue occurred, aiding in debugging and error tracking. | ||
/// </remarks> | ||
internal ContentControlDoesNotSupportChildrenException(int line, int column, string message) : base(message) | ||
{ | ||
Line = line; | ||
Column = column; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...Solutions.PdfTemplate/Exceptions/ContentControlDoesNotSupportTheProvidedChildException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
namespace X39.Solutions.PdfTemplate.Exceptions; | ||
|
||
/// <summary> | ||
/// Represents an exception that is thrown when a content control | ||
/// does not support the provided child control type. | ||
/// </summary> | ||
/// <remarks> | ||
/// This exception is specifically used within the context of PDF template processing | ||
/// where content controls have strict type constraints on the child controls they can contain. | ||
/// </remarks> | ||
/// <example> | ||
/// An instance of this exception may be thrown during the creation of a control hierarchy | ||
/// when a child control that does not match the expected type is added to a content control. | ||
/// </example> | ||
/// <seealso cref="X39.Solutions.PdfTemplate.Abstraction.IContentControl"/> | ||
[PublicAPI] | ||
public class ContentControlDoesNotSupportTheProvidedChildException : Exception | ||
{ | ||
/// <summary> | ||
/// Gets the line number where the exception occurred. | ||
/// </summary> | ||
public int Line { get; } | ||
|
||
/// <summary> | ||
/// Gets the column number where the exception occurred. | ||
/// </summary> | ||
public int Column { get; } | ||
|
||
/// <summary> | ||
/// Gets the type of the unsupported child control. | ||
/// </summary> | ||
public Type Type { get; } | ||
|
||
/// <summary> | ||
/// Exception thrown when a content control does not support the provided child type. | ||
/// This exception is used to indicate that an attempt was made to add a child control to a content control, | ||
/// but the content control does not support adding children of the specified type. | ||
/// </summary> | ||
/// <param name="line">The line number in the source where the error occurred.</param> | ||
/// <param name="column">The column number in the source where the error occurred.</param> | ||
/// <param name="type">The type of the child control that caused the exception.</param> | ||
/// <param name="message">The message of the exception.</param> | ||
internal ContentControlDoesNotSupportTheProvidedChildException(int line, int column, Type type, string message) : base(message) | ||
{ | ||
Line = line; | ||
Column = column; | ||
Type = type; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.