forked from pipeline-foundation/itext7-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into devsecops
- Loading branch information
Showing
24 changed files
with
555 additions
and
49 deletions.
There are no files selected for viewing
392 changes: 392 additions & 0 deletions
392
itext.tests/itext.forms.tests/itext/forms/form/element/FixedPositionTest.cs
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file added
BIN
+27.7 KB
....tests/resources/itext/forms/form/element/FixedPositionTest/cmp_interactiveMarginLeft.pdf
Binary file not shown.
Binary file added
BIN
+18.4 KB
...tests/resources/itext/forms/form/element/FixedPositionTest/cmp_interactiveOutOfBounds.pdf
Binary file not shown.
Binary file added
BIN
+18.4 KB
....tests/resources/itext/forms/form/element/FixedPositionTest/cmp_interactive_fixed_pos.pdf
Binary file not shown.
Binary file added
BIN
+21.5 KB
...esources/itext/forms/form/element/FixedPositionTest/cmp_interactive_fixed_pos_on_page.pdf
Binary file not shown.
Binary file added
BIN
+28.2 KB
.../itext.forms.tests/resources/itext/forms/form/element/FixedPositionTest/cmp_marginTop.pdf
Binary file not shown.
Binary file added
BIN
+9.35 KB
...ms.tests/resources/itext/forms/form/element/FixedPositionTest/cmp_ni_setFixedPosition.pdf
Binary file not shown.
Binary file added
BIN
+13.3 KB
...ts/resources/itext/forms/form/element/FixedPositionTest/cmp_ni_setFixedPositionOnPage.pdf
Binary file not shown.
Binary file added
BIN
+27.6 KB
...ts/itext.forms.tests/resources/itext/forms/form/element/FixedPositionTest/cmp_padding.pdf
Binary file not shown.
Binary file added
BIN
+27.6 KB
...ests/itext.forms.tests/resources/itext/forms/form/element/FixedPositionTest/cmp_width.pdf
Binary file not shown.
47 changes: 47 additions & 0 deletions
47
itext.tests/itext.kernel.tests/itext/kernel/xmp/impl/XMPNodeTest.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,47 @@ | ||
/* | ||
This file is part of the iText (R) project. | ||
Copyright (c) 1998-2024 Apryse Group NV | ||
Authors: Apryse Software. | ||
This program is offered under a commercial and under the AGPL license. | ||
For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. | ||
AGPL licensing: | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
using System; | ||
using iText.Kernel.XMP.Options; | ||
using iText.Test; | ||
|
||
namespace iText.Kernel.XMP.Impl | ||
{ | ||
[NUnit.Framework.Category("UnitTest")] | ||
public class XMPNodeTest : ExtendedITextTest | ||
{ | ||
[NUnit.Framework.Test] | ||
public virtual void XmpNodeTreeUnmodifiableChildrenTest() { | ||
XMPNode node = new XMPNode("rdf:RDF", "idk", new PropertyOptions()); | ||
node.AddChild(new XMPNode("rdf:Description", "idk", new PropertyOptions())); | ||
var a = node.GetUnmodifiableChildren().GetEnumerator(); | ||
while (a.MoveNext()) | ||
{ | ||
//Modifying original tree after getting an iterator on unmodifiable collection | ||
//If we wouldn't create a copy of original children we would get System.InvalidOperationException | ||
NUnit.Framework.Assert.DoesNotThrow(() => | ||
node.AddChild(new XMPNode("rdf:Description1", "idk", new PropertyOptions()))); | ||
} | ||
} | ||
|
||
} | ||
} |
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
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
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
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
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
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
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
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
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
73 changes: 73 additions & 0 deletions
73
itext/itext.forms/itext/forms/util/FormFieldRendererUtil.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,73 @@ | ||
/* | ||
This file is part of the iText (R) project. | ||
Copyright (c) 1998-2024 Apryse Group NV | ||
Authors: Apryse Software. | ||
This program is offered under a commercial and under the AGPL license. | ||
For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. | ||
AGPL licensing: | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
using System; | ||
using System.Collections.Generic; | ||
using iText.Layout; | ||
using iText.Layout.Properties; | ||
|
||
namespace iText.Forms.Util { | ||
/// <summary>Utility class for centralized logic related to form field rendering.</summary> | ||
public sealed class FormFieldRendererUtil { | ||
//These properties are related to the outer box of the element. | ||
private static readonly int[] PROPERTIES_THAT_IMPACT_LAYOUT = new int[] { Property.MARGIN_TOP, Property.MARGIN_BOTTOM | ||
, Property.MARGIN_LEFT, Property.MARGIN_RIGHT, Property.WIDTH, Property.BOTTOM, Property.LEFT, Property | ||
.POSITION }; | ||
|
||
/// <summary> | ||
/// Creates a new instance of | ||
/// <see cref="FormFieldRendererUtil"/>. | ||
/// </summary> | ||
private FormFieldRendererUtil() { | ||
} | ||
|
||
// empty constructor | ||
/// <summary>Removes properties that impact the lay outing of interactive form fields.</summary> | ||
/// <param name="modelElement">The model element to remove the properties from.</param> | ||
/// <returns>A map containing the removed properties.</returns> | ||
public static IDictionary<int, Object> RemoveProperties(IPropertyContainer modelElement) { | ||
IDictionary<int, Object> properties = new Dictionary<int, Object>(PROPERTIES_THAT_IMPACT_LAYOUT.Length); | ||
foreach (int i in PROPERTIES_THAT_IMPACT_LAYOUT) { | ||
properties.Put(i, modelElement.GetOwnProperty<Object>(i)); | ||
modelElement.DeleteOwnProperty(i); | ||
} | ||
return properties; | ||
} | ||
|
||
/// <summary> | ||
/// Reapplies the properties | ||
/// <see cref="iText.Layout.IPropertyContainer"/>. | ||
/// </summary> | ||
/// <param name="modelElement">The model element to reapply the properties to.</param> | ||
/// <param name="properties">The properties to reapply.</param> | ||
public static void ReapplyProperties(IPropertyContainer modelElement, IDictionary<int, Object> properties) { | ||
foreach (KeyValuePair<int, Object> integerObjectEntry in properties) { | ||
if (integerObjectEntry.Value != null) { | ||
modelElement.SetProperty(integerObjectEntry.Key, integerObjectEntry.Value); | ||
} | ||
else { | ||
modelElement.DeleteOwnProperty(integerObjectEntry.Key); | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.