From 78a5af1692af697fbff0306542eb7837a8eb58aa Mon Sep 17 00:00:00 2001 From: Alexandr Pliushchou Date: Thu, 21 Nov 2024 18:19:04 +0000 Subject: [PATCH] Fix rotation and font size for annotations DEVSIX-8685 Autoported commit. Original commit hash: [6799b9f8e] Manual files: io/src/test/java/com/itextpdf/io/util/UrlUtilTest.java styled-xml-parser/src/test/java/com/itextpdf/styledxmlparser/resolver/resource/DefaultResourceRetrieverTest.java --- .../itext/forms/PdfChoiceFieldTest.cs | 17 +++ .../itext/forms/PdfPushButtonTest.cs | 62 ++++++++ .../itext/forms/fields/FieldsRotationTest.cs | 135 ++++++++++++++++++ .../cmp_setFontSizeChoiceField.pdf | Bin 0 -> 1644 bytes .../cmp_choiceFieldAutoSize01Test.pdf | Bin 2418 -> 2421 bytes .../cmp_pushButtonWithDisplay.pdf | Bin 0 -> 1676 bytes .../forms/XfdfReaderTest/cmp_xfdfCheckBox.pdf | Bin 6398 -> 6496 bytes .../cmp_filledRotated270TextFormField.pdf | Bin 0 -> 1681 bytes .../cmp_filledRotated90TextFormField.pdf | Bin 0 -> 1683 bytes .../cmp_rotatedButtonWithDisplayValue.pdf | Bin 0 -> 1702 bytes .../cmp_rotatedCheckBox.pdf | Bin 0 -> 3093 bytes .../cmp_rotatedChoiceBox.pdf | Bin 0 -> 1726 bytes .../cmp_rotatedComboBox.pdf | Bin 0 -> 1705 bytes .../rotated270TextFormField.pdf | Bin 0 -> 1611 bytes .../rotated90TextFormField.pdf | Bin 0 -> 1611 bytes .../itext/forms/fields/PdfFormAnnotation.cs | 63 ++++++-- port-hash | 2 +- 17 files changed, 269 insertions(+), 10 deletions(-) create mode 100644 itext.tests/itext.forms.tests/itext/forms/PdfPushButtonTest.cs create mode 100644 itext.tests/itext.forms.tests/resources/itext/forms/PdfChoiceFieldTest/cmp_setFontSizeChoiceField.pdf create mode 100644 itext.tests/itext.forms.tests/resources/itext/forms/PdfPushButtonTest/cmp_pushButtonWithDisplay.pdf create mode 100644 itext.tests/itext.forms.tests/resources/itext/forms/fields/FieldsRotationTest/cmp_filledRotated270TextFormField.pdf create mode 100644 itext.tests/itext.forms.tests/resources/itext/forms/fields/FieldsRotationTest/cmp_filledRotated90TextFormField.pdf create mode 100644 itext.tests/itext.forms.tests/resources/itext/forms/fields/FieldsRotationTest/cmp_rotatedButtonWithDisplayValue.pdf create mode 100644 itext.tests/itext.forms.tests/resources/itext/forms/fields/FieldsRotationTest/cmp_rotatedCheckBox.pdf create mode 100644 itext.tests/itext.forms.tests/resources/itext/forms/fields/FieldsRotationTest/cmp_rotatedChoiceBox.pdf create mode 100644 itext.tests/itext.forms.tests/resources/itext/forms/fields/FieldsRotationTest/cmp_rotatedComboBox.pdf create mode 100644 itext.tests/itext.forms.tests/resources/itext/forms/fields/FieldsRotationTest/rotated270TextFormField.pdf create mode 100644 itext.tests/itext.forms.tests/resources/itext/forms/fields/FieldsRotationTest/rotated90TextFormField.pdf diff --git a/itext.tests/itext.forms.tests/itext/forms/PdfChoiceFieldTest.cs b/itext.tests/itext.forms.tests/itext/forms/PdfChoiceFieldTest.cs index 364383b52e..189c503a6a 100644 --- a/itext.tests/itext.forms.tests/itext/forms/PdfChoiceFieldTest.cs +++ b/itext.tests/itext.forms.tests/itext/forms/PdfChoiceFieldTest.cs @@ -270,5 +270,22 @@ public virtual void LongOptionWrappedIntoTwoLinesTest() { NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, destinationFolder )); } + + [NUnit.Framework.Test] + public virtual void SetFontSizeChoiceFieldTest() { + String outPdf = destinationFolder + "setFontSizeChoiceField.pdf"; + String cmpPdf = sourceFolder + "cmp_setFontSizeChoiceField.pdf"; + using (PdfDocument doc = new PdfDocument(CompareTool.CreateTestPdfWriter(outPdf))) { + doc.AddNewPage(); + Rectangle rectangle = new Rectangle(150, 500, 200, 150); + PdfChoiceFormField choiceBoxField = new ChoiceFormFieldBuilder(doc, "choiceBox").SetPage(1).SetWidgetRectangle + (rectangle).SetOptions(new String[] { "option1", "option2", "option3" }).CreateList(); + choiceBoxField.SetFontSize(40); + PdfAcroForm acroForm = PdfAcroForm.GetAcroForm(doc, true); + acroForm.AddField(choiceBoxField); + } + NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, cmpPdf, destinationFolder, "diff_" + )); + } } } diff --git a/itext.tests/itext.forms.tests/itext/forms/PdfPushButtonTest.cs b/itext.tests/itext.forms.tests/itext/forms/PdfPushButtonTest.cs new file mode 100644 index 0000000000..3aebc2802e --- /dev/null +++ b/itext.tests/itext.forms.tests/itext/forms/PdfPushButtonTest.cs @@ -0,0 +1,62 @@ +/* +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 . +*/ +using System; +using iText.Forms.Fields; +using iText.Kernel.Geom; +using iText.Kernel.Pdf; +using iText.Kernel.Utils; +using iText.Test; + +namespace iText.Forms { + [NUnit.Framework.Category("IntegrationTest")] + public class PdfPushButtonTest : ExtendedITextTest { + public static readonly String DESTINATION_FOLDER = NUnit.Framework.TestContext.CurrentContext.TestDirectory + + "/test/itext/forms/PdfPushButtonTest/"; + + public static readonly String SOURCE_FOLDER = iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext + .CurrentContext.TestDirectory) + "/resources/itext/forms/PdfPushButtonTest/"; + + [NUnit.Framework.OneTimeSetUp] + public static void BeforeClass() { + CreateOrClearDestinationFolder(DESTINATION_FOLDER); + } + + [NUnit.Framework.Test] + public virtual void SetFontSizePushButtonWithDisplayTest() { + String outPdf = DESTINATION_FOLDER + "pushButtonWithDisplay.pdf"; + String cmpPdf = SOURCE_FOLDER + "cmp_pushButtonWithDisplay.pdf"; + using (PdfDocument doc = new PdfDocument(CompareTool.CreateTestPdfWriter(outPdf))) { + doc.AddNewPage(); + Rectangle rectangle = new Rectangle(150, 400, 400, 100); + PdfButtonFormField button = new PushButtonFormFieldBuilder(doc, "button").SetWidgetRectangle(rectangle).SetPage + (1).CreatePushButton(); + button.SetFontSize(50); + button.SetValue("value", "some display text"); + PdfAcroForm acroForm = PdfAcroForm.GetAcroForm(doc, true); + acroForm.AddField(button); + } + NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, cmpPdf, DESTINATION_FOLDER, "diff_" + )); + } + } +} diff --git a/itext.tests/itext.forms.tests/itext/forms/fields/FieldsRotationTest.cs b/itext.tests/itext.forms.tests/itext/forms/fields/FieldsRotationTest.cs index c3f2863c73..d7cb73df01 100644 --- a/itext.tests/itext.forms.tests/itext/forms/fields/FieldsRotationTest.cs +++ b/itext.tests/itext.forms.tests/itext/forms/fields/FieldsRotationTest.cs @@ -24,6 +24,7 @@ You should have received a copy of the GNU Affero General Public License using System.Collections.Generic; using iText.Commons.Utils; using iText.Forms; +using iText.Forms.Fields.Properties; using iText.Forms.Form.Element; using iText.Kernel.Colors; using iText.Kernel.Geom; @@ -99,6 +100,140 @@ private void FillForm(int[] pageRotation, int[] fieldRotation, bool ignorePageRo } } + [NUnit.Framework.Test] + public virtual void FillRotated90TextFormFieldTest() { + String inPdf = SOURCE_FOLDER + "rotated90TextFormField.pdf"; + String outPdf = DESTINATION_FOLDER + "filledRotated90TextFormField.pdf"; + String cmpPdf = SOURCE_FOLDER + "cmp_filledRotated90TextFormField.pdf"; + using (PdfDocument pdfDoc = new PdfDocument(new PdfReader(inPdf), CompareTool.CreateTestPdfWriter(outPdf)) + ) { + IDictionary fieldValues = new Dictionary(); + fieldValues.Put("textForm", "some text"); + FillAndFlattenForm(pdfDoc, fieldValues); + } + NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, cmpPdf, DESTINATION_FOLDER, "diff_" + )); + } + + [NUnit.Framework.Test] + public virtual void FillRotated270TextFormFieldTest() { + String inPdf = SOURCE_FOLDER + "rotated270TextFormField.pdf"; + String outPdf = DESTINATION_FOLDER + "filledRotated270TextFormField.pdf"; + String cmpPdf = SOURCE_FOLDER + "cmp_filledRotated270TextFormField.pdf"; + using (PdfDocument pdfDoc = new PdfDocument(new PdfReader(inPdf), CompareTool.CreateTestPdfWriter(outPdf)) + ) { + IDictionary fieldValues = new Dictionary(); + fieldValues.Put("textForm", "some text"); + FillAndFlattenForm(pdfDoc, fieldValues); + } + NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, cmpPdf, DESTINATION_FOLDER, "diff_" + )); + } + + [NUnit.Framework.Test] + public virtual void RotatedButtonWithDisplayValueTest() { + String outPdf = DESTINATION_FOLDER + "rotatedButtonWithDisplayValue.pdf"; + String cmpPdf = SOURCE_FOLDER + "cmp_rotatedButtonWithDisplayValue.pdf"; + using (PdfDocument doc = new PdfDocument(CompareTool.CreateTestPdfWriter(outPdf))) { + doc.AddNewPage(); + Rectangle rectangle = new Rectangle(150, 300, 150, 400); + PdfDictionary chars = new PdfDictionary(); + chars.Put(PdfName.R, new PdfNumber(90)); + PdfButtonFormField button = new PushButtonFormFieldBuilder(doc, "button").SetWidgetRectangle(rectangle).SetPage + (1).CreatePushButton(); + button.GetWidgets()[0].SetAppearanceCharacteristics(chars); + button.SetFontSize(0); + button.SetValue("value", "this text should take all space"); + PdfAcroForm acroForm = PdfAcroForm.GetAcroForm(doc, true); + acroForm.AddField(button); + } + NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, cmpPdf, DESTINATION_FOLDER, "diff_" + )); + } + + [NUnit.Framework.Test] + public virtual void RotatedCheckBoxTest() { + String outPdf = DESTINATION_FOLDER + "rotatedCheckBox.pdf"; + String cmpPdf = SOURCE_FOLDER + "cmp_rotatedCheckBox.pdf"; + using (PdfDocument doc = new PdfDocument(CompareTool.CreateTestPdfWriter(outPdf))) { + doc.AddNewPage(); + PdfAcroForm acroForm = PdfAcroForm.GetAcroForm(doc, true); + PdfDictionary chars = new PdfDictionary(); + chars.Put(PdfName.R, new PdfNumber(90)); + Rectangle rectangle1 = new Rectangle(0, 300, 100, 100); + PdfButtonFormField box1 = new CheckBoxFormFieldBuilder(doc, "checkBox1").SetPage(1).SetWidgetRectangle(rectangle1 + ).CreateCheckBox(); + box1.GetWidgets()[0].SetAppearanceCharacteristics(chars); + box1.SetCheckType(CheckBoxType.CHECK); + box1.SetValue("ON"); + box1.SetFontSize(0); + acroForm.AddField(box1); + Rectangle rectangle2 = new Rectangle(100, 300, 100, 100); + PdfButtonFormField box2 = new CheckBoxFormFieldBuilder(doc, "checkBox2").SetPage(1).SetWidgetRectangle(rectangle2 + ).CreateCheckBox(); + box2.GetWidgets()[0].SetAppearanceCharacteristics(chars); + box2.SetCheckType(CheckBoxType.STAR); + box2.SetValue("ON"); + box2.SetFontSize(0); + acroForm.AddField(box2); + } + NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, cmpPdf, DESTINATION_FOLDER, "diff_" + )); + } + + [NUnit.Framework.Test] + public virtual void RotatedChoiceBoxTest() { + String outPdf = DESTINATION_FOLDER + "rotatedChoiceBox.pdf"; + String cmpPdf = SOURCE_FOLDER + "cmp_rotatedChoiceBox.pdf"; + using (PdfDocument doc = new PdfDocument(CompareTool.CreateTestPdfWriter(outPdf))) { + doc.AddNewPage(); + Rectangle rectangle = new Rectangle(150, 500, 200, 150); + PdfDictionary chars = new PdfDictionary(); + chars.Put(PdfName.R, new PdfNumber(90)); + PdfChoiceFormField choiceBoxField = new ChoiceFormFieldBuilder(doc, "choiceBox").SetPage(1).SetWidgetRectangle + (rectangle).SetOptions(new String[] { "option1", "option2", "option3", "option4", "option5" }).CreateList + (); + choiceBoxField.GetWidgets()[0].SetAppearanceCharacteristics(chars); + choiceBoxField.SetFontSize(0); + PdfAcroForm acroForm = PdfAcroForm.GetAcroForm(doc, true); + acroForm.AddField(choiceBoxField); + } + NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, cmpPdf, DESTINATION_FOLDER, "diff_" + )); + } + + [NUnit.Framework.Test] + public virtual void RotatedComboBoxTest() { + String outPdf = DESTINATION_FOLDER + "rotatedComboBox.pdf"; + String cmpPdf = SOURCE_FOLDER + "cmp_rotatedComboBox.pdf"; + using (PdfDocument doc = new PdfDocument(CompareTool.CreateTestPdfWriter(outPdf))) { + doc.AddNewPage(); + Rectangle rectangle = new Rectangle(150, 500, 75, 150); + PdfDictionary chars = new PdfDictionary(); + chars.Put(PdfName.R, new PdfNumber(90)); + PdfChoiceFormField choiceBoxField = new ChoiceFormFieldBuilder(doc, "choiceBox").SetPage(1).SetWidgetRectangle + (rectangle).SetOptions(new String[] { "option1", "option2", "longOption", "option3", "option4", "option5" + }).CreateComboBox(); + choiceBoxField.GetWidgets()[0].SetAppearanceCharacteristics(chars); + choiceBoxField.SetValue("option1", true); + choiceBoxField.SetFontSize(0); + PdfAcroForm acroForm = PdfAcroForm.GetAcroForm(doc, true); + acroForm.AddField(choiceBoxField); + } + NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outPdf, cmpPdf, DESTINATION_FOLDER, "diff_" + )); + } + + private static void FillAndFlattenForm(PdfDocument document, IDictionary fields) { + PdfAcroForm form = PdfAcroForm.GetAcroForm(document, true); + form.SetNeedAppearances(true); + foreach (KeyValuePair field in fields) { + PdfFormField acroField = form.GetField(field.Key); + acroField.SetValue(field.Value); + } + form.FlattenFields(); + } + private String GenerateCaption(int pageRotation, int fieldRotation) { String caption = ", page rotation: " + pageRotation + ", field rotation: " + fieldRotation; for (int i = 0; i < 3; ++i) { diff --git a/itext.tests/itext.forms.tests/resources/itext/forms/PdfChoiceFieldTest/cmp_setFontSizeChoiceField.pdf b/itext.tests/itext.forms.tests/resources/itext/forms/PdfChoiceFieldTest/cmp_setFontSizeChoiceField.pdf new file mode 100644 index 0000000000000000000000000000000000000000..9c534de5dcbbd4fd9f4224c2378f50fd17457b74 GIT binary patch literal 1644 zcmc&#&u<$=6fO$ouxbT|9#Bu?gHs!n%*^iWFJxJA>~34pBrDqrAlrx8-C1WNXUE!I zS4l6>iw_(saXAxY1Obt5hJJ{*Rj{f?S1UUh~V96 zF{sIDk;s(R(c(=%do$`I>?5Y4;I0UZ0W}FS2|)%tEt8CJZx$5CQ-R+}qOmA&zZUMx zBotfnsE+prqh?bRX{1=0D|TKoDMW_72`@xPgfbHNzDUQ#K60APyvPJU)Q&!1y8`DW z1z(sJffSo%nrSMFe4rBVj&NJ1g-DAWsjIqpTSN&59s^Yb(>0O9bjXHh;Dhwir7Lnd z%R-Si8c?KumK%65Col#0nY8iyGH;HkJkXv=UEu;T-@G}|BLXp*yzBnpQP+MjKxtnB@ZuE9q ze(&yX9}R1*JN|w2Kx8>wIIN>5Iw533U5Q%L>^K+bP9|qlw6j-VadlQ)w|Fi*C@;P% zCJ#iBgdE>ap>at%hR&z0G*8a{FBPE*Kyg_H1zp8ewO`b)EoaaSir-G6d{D}4bc!e| zxq_(jE+CyQNLvL|4~i5?P&l;DOT+}CoQh!uEoWeX-CDL6(nlcW5rFHL`?X-yTYJqXK4BkxeQo>tjSsuueE027 zJC)(z>0DcXMXMykxi+7#Km1}{tJH@#pIxnf`s{fAS>?UqNoDxxlY<|w|8?!7k8l36 zcMyF!e*D$XubXg$+h)6_n z$hgj27RSWVSrF?njZNF;z|wWOL#-&Xh!r!7JA$z=Fm%og?lk{@1|xhgjU`gs1{SxJ pFk|IwFL@|H4lo_na$RhwZL#tEw$So|XGJL;N=*2;RB!Kk+CSg3({um; literal 0 HcmV?d00001 diff --git a/itext.tests/itext.forms.tests/resources/itext/forms/PdfFormFieldTest/cmp_choiceFieldAutoSize01Test.pdf b/itext.tests/itext.forms.tests/resources/itext/forms/PdfFormFieldTest/cmp_choiceFieldAutoSize01Test.pdf index 9f66295c4464c69739ae16952cefc8cae13fede9..565aed3477ba84b01980a6e7c7bcce14189ab362 100644 GIT binary patch delta 766 zcmew)^i^mB4tM%Hj}3^$#EGP8k!oK8(12fPu|NUj?BHsq{L`A znUUFHb1kzW6QjZ8^{lS-y%SGzF&Xl-y|3(&`I?Zs>*h`^E;*YHR(Xfxyy9z=fBYzu zJpMJoIYZ;;r~eCM%MbrcVMw=Vdm?doed7hO3Wgw8oo^1ak`Fou#!s0aZcw|psQTH8 zV?VU-@%(WNViEqQ0zQK6Nd{n34aN^Vv=i)XL>&-^0bhWoQxzwr3ndlMxNfB0SgH8x*k@=Z2# zdowdr1p^RJ$W!0~GYkwYEilE*jWEOv4S=EP&u-0VKDnFSy50iA91~L$bTLCi10xJE z69YqpSV>W0W=?7mmyM0Sr;9?gjd@D4g}H%Ys)41EnNgy-Wonv1lA&d)MT$vEs-aoGiJ_T+v1MACVX~QlsikRJl3AjOK}w>riGhK+ zp^1fATB513v5}=EP$1F5B00q{DcQ)(*wDbzB+1Cg*d)c!IL#o@IK?#Cz>YX4L<8MG sD<@2r=QLI@)D8A?3<&n{58)~^a}0Nhvc6951J delta 763 zcmew=^hsy~4rQi>*etnQC5Dr6mGi%R_pZY5@Zh^-#+tP zpB2Y#0jW!W{&~KzxKp@k&LLL6ld7AJ$}4T7;G_8j>s_WEwM>200A-s>v|ImJtn3G=wgOI!!g8+ zEzJ>PB}IvuIjKclHa7a6E(*~$hG}LgNr^_OMkW?1W`?Gg$;oMnmPV-tMrKCF21ZF1 zW@$;L#z{t|^%lk!rshV5=BXCumWC!4CW&b#CI*IyCgz5z$;rv4$%cvMCI-e9DTYZV zMy3`PMn=XaiAkoZ20%kh%u`I0%u)8UKPGBtQ2KzY%1bg_0a21y%7L`;KrKWKinwuMPsj9mAyKw;kv>Nq= diff --git a/itext.tests/itext.forms.tests/resources/itext/forms/PdfPushButtonTest/cmp_pushButtonWithDisplay.pdf b/itext.tests/itext.forms.tests/resources/itext/forms/PdfPushButtonTest/cmp_pushButtonWithDisplay.pdf new file mode 100644 index 0000000000000000000000000000000000000000..8b48f5a0d25b80175f99b6ae74dfdc1a1cc38e54 GIT binary patch literal 1676 zcmc&!&2Jk;6fbZ=OC)m01tg@oSaoEanc43}R)jygY1MoYg%|--?;83enaJ31KUHFW~*&Rd){L|WmgRAY_gd5c&_9?Om>h#yK-@!GR zV84%S%Q9@da}%JotuEPcEZsBF(z}Q2)nX=&IEvzIG-M}8@?*IU;hPAYQ46-WDM}+#Uz=WW@2?aWvo(cZ$JSN|69i<4L4aw-zP%@lf&<`$HyqgNGvGc$+5! zc?Y?ho0&{GJJOENUbq71IR&4YW`R^1b1srZ$gHc_X+h>9kvx$ZQdhO`4v%716USXe zk>y#)HT52DvJ`xfp1ZVoCdO&Vvq}Xj?4ud?Q3(a?Jb^G3zDSRdm&a3n z*(`PrtTV}mVz9s(3v39=Hj=6!1~ID`SYAmh@X`Y(oKeP`~!`Q-<{{;;yPvbMbf z&-cGCeq8#nbo$L|kDQfWF8;mt=>FsWSGNy8Tb=yGzZkI3Zx8Pc`VUtpkM8fEefr7Q zr;~RMPCvT!pgDPW|K2N;AOCvwdGqztm#%#K&ucGUo|5B~_cbVzYS8KFaq<;lp+1`1 zObWeF2PNk=$GB`Woy#`e1uZXObw&1)jZhfJWgFb6O!Pu7wh8@T@^hYW2Tbw8Po^v$ z@>K1`8x7R0P@Q_ZZWuOknaOQ43?qjV=IWe8ZbTd>3cavz5YHnKwV4@(fl2xSbpj)_ zg3xh1&(=dvXMsf=(>4f=Ldsn`A|c}}40L8#VF(_c8Mp=s2%~|^O*KdkWr4l<>@(=$ z8%bXvwP;{j3jyPme{IL_agYNHMj_u6Wwj{E|6LSXCRr+T=}_W&TA^@l&)5D136$Io literal 0 HcmV?d00001 diff --git a/itext.tests/itext.forms.tests/resources/itext/forms/XfdfReaderTest/cmp_xfdfCheckBox.pdf b/itext.tests/itext.forms.tests/resources/itext/forms/Xfdf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E( zM%1fn@l@)Z)K@1Z8QJBr`LKW>gdi&8>7)So5R_uB_61Q08Qn=q${3wVJ8?G!X~;kp za*&4t6rsem7y;idIV@FZRH5c-o>b@9fF`t{4ISu05Be~GA&g)Q6Fc~UDa>FF0r$pd z@QAdewz5;1hivD`XlrU4_=P|Chb`=24+l89Up2-rTay<{{ANj9E!mg!2Kkr}`I8tY!)o{2_rCY$``%2Y z(`;4IGPf$f{r>Y)3t<33;_q22D|Ray1Q z{`lpcA6b9+{a=>uc<{lCU(Oez(>jeL&Q+Xe+l3@uU^deQMJL@IdqV}0s3!;8P{Yh) zz@>P{?ub;U0Ha~o?y4*qrBY>D%D1-sJtcD^>OKO9n1GsIc0Y~w=V(4$Bks9O+oe>QIKsLhqZra5@*wt!j_3{^;1){RDi*q|2YgE zvNuGYMrIbO+FV^=oH9EAra9w20%pTw?@#y8O49vtLz6L?IT24^dfXZQGy3z&$q!|} zyii_vrCeU>s2mv>-s#(zcBk2M%L|fe@Tx6zkzK z3&dv_$9hlaFzU=>m}_Ou#X(OSbsmFWfuWhY5IS?1L;r&hjj?BQ=P~5y^L)N8n#VXF z_fqUPPen9Psks~1n_zpz4Jio}=E5h?7jB@CzzBxe<$^jKxj1yGL=KW%IfOb=1)k3k z!$^A6qnuC|aaTWF=}8azig_vs5g{BisJO&JI{IB#!7k;TFcwe-1D)hc${E46l`v!? zR00Z*3eQuBNI%fw+~<@cK?GttS9(b46c-bze~JKygu9Trx+jjY$0g@F+4UttGGIPe z5ILbMxZ+SjH*k>82=^#Ko(QO5RQifw$47#x+K#;*hY2VyG`pK5`ka~hwtLaLN{^C0 fT$SR=sG1w2`s|HiWw}W6V(btk)T&h0wp!M|gpA%( literal 0 HcmV?d00001 diff --git a/itext.tests/itext.forms.tests/resources/itext/forms/fields/FieldsRotationTest/cmp_filledRotated90TextFormField.pdf b/itext.tests/itext.forms.tests/resources/itext/forms/fields/FieldsRotationTest/cmp_filledRotated90TextFormField.pdf new file mode 100644 index 0000000000000000000000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 HcmV?d00001 diff --git a/itext.tests/itext.forms.tests/resources/itext/forms/fields/FieldsRotationTest/cmp_rotatedCheckBox.pdf b/itext.tests/itext.forms.tests/resources/itext/forms/fields/FieldsRotationTest/cmp_rotatedCheckBox.pdf new file mode 100644 index 0000000000000000000000000000000000000000..ac39977b261d224aba3c231df03b36516384196b GIT binary patch literal 3093 zcmc&$&1)M+6nAL?WlLyia&8BLh)pWZ$9@M%SYB00a4ZW+q@}hFqn%l26MNU}u8UJB z^w8W5J+_C^OX)@Q&nT3(haP$@ZT^tHSzFO6D;#VQIM3xeY_n6h!OSLgoRrJ_=Y<}ypctCYZFAh)~d0F z`^Y8mxrdBgt1ta*hajC0MBy@X| zZ0Cv|&-i}4H`6Ty$OF1r7)Nbz#%lX6Bg~+b5vuFD>D(duZ9;CZ;jLJlFVIV3apcQn zH5|(0Y=XQvk;tvl8mSJtt={1N_7Lr^w(j*FqR(ZL!hySM=qHFHsj4GU>o9qiN^~!Y zj}B4y(b^0vEktgEr?Lb7#h>xRpdChgW1giiGgEP;IA^Sc3MQ0a&SG|16NNIntO;jn z6so3|oEc3toH#wM6k|DAJw0fsIbHATNYj8Wggi6Uu!Mo~zuM zVBR~Y@TRq>dJjA!d`|l?@D|UKP!&5xRplq81v-Ti$0|3W@pdSpvo1L8uBwbr!GF3v zegbW{(2?%EU_H_!##ev;Fq|At>XVJ1(aE>J%XfnHUta9ie!O1$()O;tn>KX+`HAuU z-LK#GZZ$UjtKMeA^PZpV)~?<7?c}4{U)Lw==*r3mzus(=yIVdhESfF0(`_N=~8M!xaRFqR@Nodf{dP*%m1mL!nwpY%W@8d zEX}1~`ieMZEW}-aMYl`3)M6!{QiqjzFk%<{oFzQmmx;QdK4_zzI+wP?1n1l_B@x1M zsY4CJamAPhgxk!r32|*RuyxmUEMqLkV_gW72u8U}1=U@{625Ip12{`ZFlkvjXLPIw z#CHVf3F%Wy8bT+o8`y>rK+qR1V^U`#X#W2QM)*M##7JGk`nVs*Fun5ELHLD)^oL1Q f$?s8Bb&aadU!$}%<4Km63S*X~RVp8EceMWi*k5)> literal 0 HcmV?d00001 diff --git a/itext.tests/itext.forms.tests/resources/itext/forms/fields/FieldsRotationTest/cmp_rotatedChoiceBox.pdf b/itext.tests/itext.forms.tests/resources/itext/forms/fields/FieldsRotationTest/cmp_rotatedChoiceBox.pdf new file mode 100644 index 0000000000000000000000000000000000000000..6cfe1d69d9644384734b0d5e717914db0a33e053 GIT binary patch literal 1726 zcmc&!O^6&t6ppN?MsPtr_;V;&hRhge>!-W=N5+BKnRF7eKh4Y-g-Mg`pX%9OX1j*& zp0M$hi(tS@20R2r4Qym{QI86q7W5Dz9&*y7am9-W0q<7z&d<6Vy;_Iqn#cQIz4yKE zy^_ACf~!je!XPUi*K@gQd@vLn)c&YFKq;P4ojE~ZQWwn~%r<=w*r~JFJILGU=c_mn2rwIfpw|Tk)tRkND z%OKxk?b;@3}1PkTXn*sF1tP;59-9jH7bi-SD@?_#9LBqv!8C z!zZKPUjOyMg70<~79Hdu?dDe>-u$}!(Ye>&_~XTcdw)jzoBm!uy1O|3p6zdLMSJ~l zZ*hEZ@AfrkeCN~t{>$U<4qrKV=>zwhySF}hzcNmjzJ2h+!@pJ^-tNBo`0btWv;O9- zy`P``a@$?X-dYL|KOY`~-<9WHIP=q;#_059?WQbJM3q<(>Nq-vm~yI85P_*plZ46x zl9|m=Pun!(w2hd8#S>V9L<>*Y5EdhR(k5P%CVVUxT@zY5;b%PM4O2UoOP+f1fTePi zUTT3}EyTJOYQC2)-zO+U7V!*b`hmunN)4o2 z9wNl^EM`Smw^T1=T8NNugw&*zF|l_LB8-|Ur9?Nvz_JW0AlTAO6En5`|7YOBOG(6m vTux%ob1p`*xOU?An2>`Qrc$w8s&cth|G8Y0Ecep9kPgPGrIbqNH*Do^GVoZtBQ9;^l^t? zCZc)Bvr01LNAewNi;N?0n{3nCV6WL5boYnoaiw{$_W(WRSq=#wSJ9bH2&t)*s5#4? z z<0|eK{I$g#hC%WDB+5sH+Qt`%g2^>R(Yt_j`k-Efc9ul9o{utS%$eg4^5 zZ}#{6uiJnAQVL32rLFd$w3QEDeLs9R`|;bs_2c*7oxXhi=H$gst?n1crzdAG-@HEg z;Z>`v9sAFlJMr_A)3|%%`0MMB(9NGe{k3#$^8WMl%~d(dc&tI;RD*F}JPvHHWmqUi zOPgr`W$Hoc%H~*`Hq+a*8N}JZ>IMw*N<2bgC$HKdqcYJ;wb(Yy^NOGQfgG-VsTP^B zWXdyjY3_8;sBW9F!}Zv+8I3JsI8JOCaS$?>LJOwpn2d(Dqq}3W{i`2Q;y zu+fgpAi<-JEYX811v|O@G7Se(H$koc_yZgTO50o9} AjQ{`u literal 0 HcmV?d00001 diff --git a/itext.tests/itext.forms.tests/resources/itext/forms/fields/FieldsRotationTest/rotated270TextFormField.pdf b/itext.tests/itext.forms.tests/resources/itext/forms/fields/FieldsRotationTest/rotated270TextFormField.pdf new file mode 100644 index 0000000000000000000000000000000000000000..0c3e346b20a641a84c73bd7c2d64cae48f2df6c3 GIT binary patch literal 1611 zcmc&!zmFS56b`aZinaj>Dyk{4ViWmhW_QQ4i!2MDoy|qb-L33ZKyqB{kFnXvw`1*& zBZn?g(vT)s1q4DI5=ELw)F2AVP*CJQ0K^}FM9-VG9Xoe{mXW;PeR|)#_rCYNSM_^d zgYI&p`rGfnzA&1IAQ{~@S}ol1;ch4V7kJ4l!6b@=iER-kn<2t@stGC;R$Pyi$ zZL;vvsS-K%rlAr&5z9p28zP&iPmt4Y7b+Lwv9b87askd88on~EF4D=Y%gHjSilHvB zKf+y^DUqoH=}>)qAd)oPlZ&A)mbnZ$wmHInn1c^8OP9VV(P}}RL7pC;^AB`w zemD`EN;F^V1maxkT9I4cr~Qi6-6gOas&FbN8?3d#cA-v{%B%-0)OsJ7#Iz};HX+m` z{4%jF5pt=H4`lM+4t_3^c`Wi;8UXRnP*>&xxw~YSHU@_sf3SZPpj)-hRsROMBk}?Q z-m0Ug&_2@8AyH?R-z@~Xn#=hN9p2pPn6t@sFD!%y^x}Ony(3f_hxkecjZ3o$G(PKO zMf&o4EeK5j#U%|Iy5T@`zv8be=glvT0RYmbkCQNEzP_(jdl527Ry>b zK8kL`=xj;*#hXw4*%3j)<{JafBdCt!?p@(O%)P^RVu@MTRc-96HwTW)!!W@{3Gk*Lv zF}Smpi^{`vDssKnuJzEc<&14B5hf2Ki$tN52pXD{j7^7!HWcQVW5Dyk{4ViWmhW`E5rvMhXdHWwv#x3X6O$#F5eJ2o5ncCFoU z{o;Q1T?A!%fM)Hq+`@T2teeZj(9`yYd z-DO7ox8Hw#X1Iu;Ji2SN+qfIR*CC<=OoL7b_qz@3Q+Nm`P3(s_Tw;HM2tK$8egotY z@ClHuz41WCYD67^EJBb8A4bR+4;PWTKbQEuG?_|;!-kSe<>$q56W?w$I~_x2iN4&~ zB;ltsB@67&gpz$3=ZVC(WHwbFAl~Ves*vK?SbkNz1m_hEUzt{cbTaE|vMg8SNY^(Q z<6fRAnW+-#s|NT$CaKuVmm^)P<2i`i<`@T}03T#lE(2NSiz1d~yA5@QMS6U}Kh(7a zVk$S4Xu8%3#6_-aMP3z8`<1KM6|g6inB~(A*4kiuP^U`stPd#=A^%Zt+-CkfBIUwGDS0eN9flx)N*B1K z_m85xFgsh?e)j6)VE)(Q&$s`0T8nBswVl^%wVh$@;kV(F`8S_;KKXHY`O!~bo<2A| z+1r2f(aD38)351gU;O;t_wQP7efo>@@zvKZk3V`U>`Q+?eB+0UBeE>y#DKi10c}1z z47rYDIcS2`HVY=XdWW*-HkVzr*_uIpw){*J2svk?HuU10jZm1y^EOQ*9J-Z@!$B11 z{MbwGV0yVitzH1bT3+YWIi zal$;8OUom%v^kf|1yf?jQgX&^VNL{3Oeq*MqsaC=%O!TqNg^W0w3)CHk2%D)W043~ zFq>K2?)?85jPZ?Zk|VukU|;7s%vSYxn0_ch4lot 1) { exportValue = optionArray.Get(0).ToString(); displayValue = optionArray.Get(1).ToString(); + if (longestOption.Length < displayValue.Length) { + longestOption = displayValue; + } } } } @@ -857,6 +871,9 @@ protected internal virtual void DrawListFormFieldAndSaveAppearance() { existingItem.GetElement().SetProperty(Property.BACKGROUND, null); } } + float fontSize = GetFontSize(new PdfArray(rectangle), longestOption); + formFieldElement.SetProperty(Property.FONT_SIZE, UnitValue.CreatePointValue(fontSize)); + UpdateParentFontSize(fontSize); formFieldElement.SetProperty(Property.FONT, GetFont()); if (GetColor() != null) { formFieldElement.SetProperty(Property.FONT_COLOR, new TransparentColor(GetColor())); @@ -864,6 +881,9 @@ protected internal virtual void DrawListFormFieldAndSaveAppearance() { SetModelElementProperties(rectangle); PdfFormXObject xObject = new PdfFormXObject(new Rectangle(0, 0, rectangle.GetWidth(), rectangle.GetHeight( ))); + if (matrix != null) { + xObject.Put(PdfName.Matrix, matrix); + } iText.Layout.Canvas canvas = new iText.Layout.Canvas(xObject, this.GetDocument()); SetMetaInfoToCanvas(canvas); canvas.SetProperty(Property.APPEARANCE_STREAM_LAYOUT, true); @@ -880,6 +900,10 @@ protected internal virtual void DrawTextFormFieldAndSaveAppearance() { if (rectangle == null) { return; } + //Apply rotation + int fieldRotation = GetRotation(); + PdfArray matrix = GetRotationMatrix(fieldRotation, rectangle.GetHeight(), rectangle.GetWidth()); + rectangle = ApplyRotation(fieldRotation, rectangle); String value = parent.GetDisplayValue(); if (!(parent.IsMultiline() && formFieldElement is TextArea || !parent.IsMultiline() && formFieldElement is InputField)) { @@ -911,10 +935,6 @@ protected internal virtual void DrawTextFormFieldAndSaveAppearance() { if (GetColor() != null) { formFieldElement.SetProperty(Property.FONT_COLOR, new TransparentColor(GetColor())); } - // Rotation - int fieldRotation = GetRotation(); - PdfArray matrix = GetRotationMatrix(fieldRotation, rectangle.GetHeight(), rectangle.GetWidth()); - rectangle = ApplyRotation(fieldRotation, rectangle); SetModelElementProperties(rectangle); PdfFormXObject xObject = new PdfFormXObject(new Rectangle(0, 0, rectangle.GetWidth(), rectangle.GetHeight( ))); @@ -938,6 +958,10 @@ protected internal virtual void DrawComboBoxAndSaveAppearance() { if (!(formFieldElement is ComboBoxField)) { formFieldElement = new ComboBoxField(parent.GetPartialFieldName().ToUnicodeString()); } + //Apply rotation + int fieldRotation = GetRotation(); + PdfArray matrix = GetRotationMatrix(fieldRotation, rectangle.GetHeight(), rectangle.GetWidth()); + rectangle = ApplyRotation(fieldRotation, rectangle); ComboBoxField comboBoxField = (ComboBoxField)formFieldElement; PrepareComboBoxFieldWithCorrectOptionsAndValues(comboBoxField); comboBoxField.SetFont(GetFont()); @@ -960,6 +984,9 @@ protected internal virtual void DrawComboBoxAndSaveAppearance() { comboBoxField.SetTextAlignment(parent.GetJustification()); Rectangle pdfXobjectRectangle = new Rectangle(0, 0, rectangle.GetWidth(), rectangle.GetHeight()); PdfFormXObject xObject = new PdfFormXObject(pdfXobjectRectangle); + if (matrix != null) { + xObject.Put(PdfName.Matrix, matrix); + } iText.Layout.Canvas canvas = new iText.Layout.Canvas(xObject, GetDocument()); canvas.SetProperty(Property.APPEARANCE_STREAM_LAYOUT, true); SetMetaInfoToCanvas(canvas); @@ -1001,12 +1028,20 @@ protected internal virtual void DrawCheckBoxAndSaveAppearance(String onStateName if (rect == null) { return; } + //Apply rotation + int fieldRotation = GetRotation(); + PdfArray matrix = GetRotationMatrix(fieldRotation, rect.GetHeight(), rect.GetWidth()); + rect = ApplyRotation(fieldRotation, rect); ReconstructCheckBoxType(); CreateCheckBox(); + SetModelElementProperties(rect); bool wasChecked = true.Equals(formFieldElement.GetProperty(FormProperty.FORM_FIELD_CHECKED)); PdfDictionary normalAppearance = new PdfDictionary(); ((CheckBox)formFieldElement).SetChecked(false); PdfFormXObject xObjectOff = new PdfFormXObject(new Rectangle(0, 0, rect.GetWidth(), rect.GetHeight())); + if (matrix != null) { + xObjectOff.Put(PdfName.Matrix, matrix); + } iText.Layout.Canvas canvasOff = new iText.Layout.Canvas(xObjectOff, GetDocument()); SetMetaInfoToCanvas(canvasOff); canvasOff.Add(formFieldElement); @@ -1021,6 +1056,9 @@ protected internal virtual void DrawCheckBoxAndSaveAppearance(String onStateName } ((CheckBox)formFieldElement).SetChecked(true); PdfFormXObject xObject = new PdfFormXObject(new Rectangle(0, 0, rect.GetWidth(), rect.GetHeight())); + if (matrix != null) { + xObject.Put(PdfName.Matrix, matrix); + } iText.Layout.Canvas canvas = new iText.Layout.Canvas(xObject, this.GetDocument()); SetMetaInfoToCanvas(canvas); canvas.Add(formFieldElement); @@ -1031,6 +1069,9 @@ protected internal virtual void DrawCheckBoxAndSaveAppearance(String onStateName // to retrieve the checkbox type even if the appearance is not present. mk.Put(PdfName.CA, new PdfString(PdfCheckBoxRenderingStrategy.ZAPFDINGBATS_CHECKBOX_MAPPING.GetByKey(parent .checkType.GetValue()))); + if (fieldRotation != 0) { + mk.Put(PdfName.R, new PdfNumber(fieldRotation)); + } GetWidget().Put(PdfName.MK, mk); formFieldElement.SetInteractive(true); ((CheckBox)formFieldElement).SetChecked(wasChecked); @@ -1118,8 +1159,6 @@ internal virtual void CreateInputButton() { formFieldElement = new Button(parent.GetPartialFieldName().ToUnicodeString()); } ((Button)formFieldElement).SetFont(GetFont()); - ((Button)formFieldElement).SetFontSize(GetFontSize(GetPdfObject().GetAsArray(PdfName.Rect), parent.GetDisplayValue - ())); if (GetColor() != null) { ((Button)formFieldElement).SetFontColor(color); } @@ -1239,7 +1278,6 @@ private void CreateCheckBox() { formFieldElement = new CheckBox(""); } formFieldElement.SetProperty(Property.FONT_SIZE, UnitValue.CreatePointValue(GetFontSize())); - SetModelElementProperties(GetRect(GetPdfObject())); ((CheckBox)formFieldElement).SetPdfConformance(GetPdfConformance()); ((CheckBox)formFieldElement).SetCheckBoxType(parent.checkType.GetValue()); } @@ -1480,5 +1518,12 @@ private Rectangle ApplyRotation(int fieldRotation, Rectangle rectangle) { } return rectangle; } + + private void UpdateParentFontSize(float fontSize) { + if (parent != null) { + parent.UpdateFontAndFontSize(parent.GetFont(), fontSize); + parent.UpdateDefaultAppearance(); + } + } } } diff --git a/port-hash b/port-hash index e018d37b82..f77132cd6c 100644 --- a/port-hash +++ b/port-hash @@ -1 +1 @@ -40d73e9d7d6d3a88afc6d27275c504597b8a8c4e +6799b9f8eba4ba1c8c7d6398674d44ee972e39b2