Skip to content

Commit 4024567

Browse files
committed
Merge branch 'develop' into devsecops
2 parents 3b03c75 + 5126390 commit 4024567

File tree

5 files changed

+36
-35
lines changed

5 files changed

+36
-35
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ results.
112112
| FIPS SHA3 example | [C#](https://kb.itextpdf.com/home/it7kb/examples/fips-sha3-examples-for-itext-core-8-0-0) |
113113
| <br> | |
114114
| **SVG** | |
115-
| Convert SVG to a PDF | [C#](https://github.com/itext/itext-publications-samples-dotnet/blob/develop/itext/itext.samples/itext/samples/sandbox/svg/ConvertSvgToPdf.cs) |
116-
| Convert SVG to a PDF using layout | [C#](https://github.com/itext/itext-publications-samples-dotnet/blob/develop/itext/itext.samples/itext/samples/sandbox/svg/ConvertSvgToLayoutImage.cs) |
117-
| Convert SVG as string to PDF | [C#](https://github.com/itext/itext-publications-samples-dotnet/blob/develop/itext/itext.samples/itext/samples/sandbox/svg/ConvertSvgStringToPdf.cs) |
118-
| Convert SVG to a PdfPage | [C#](https://github.com/itext/itext-publications-samples-dotnet/blob/develop/itext/itext.samples/itext/samples/sandbox/svg/ConvertSvgToPdfPage.cs) |
119-
| Convert SVG as XObject | [C#](https://github.com/itext/itext-publications-samples-dotnet/blob/develop/itext/itext.samples/itext/samples/sandbox/svg/ConvertSvgToXObject.cs) |
120-
| Convert SVG to a PDF with pdfCalligraph | [C#](https://github.com/itext/itext-publications-samples-dotnet/blob/develop/itext/itext.samples/itext/samples/sandbox/svg/ConvertSvgToPdfWithPdfCalligraph.cs) |
115+
| Convert SVG to a PDF | [C#](https://github.com/itext/itext-publications-samples-dotnet/blob/master/itext/itext.samples/itext/samples/sandbox/svg/ConvertSvgToPdf.cs) |
116+
| Convert SVG to a PDF using layout | [C#](https://github.com/itext/itext-publications-samples-dotnet/blob/master/itext/itext.samples/itext/samples/sandbox/svg/ConvertSvgToLayoutImage.cs) |
117+
| Convert SVG as string to PDF | [C#](https://github.com/itext/itext-publications-samples-dotnet/blob/master/itext/itext.samples/itext/samples/sandbox/svg/ConvertSvgStringToPdf.cs) |
118+
| Convert SVG to a PdfPage | [C#](https://github.com/itext/itext-publications-samples-dotnet/blob/master/itext/itext.samples/itext/samples/sandbox/svg/ConvertSvgToPdfPage.cs) |
119+
| Convert SVG as XObject | [C#](https://github.com/itext/itext-publications-samples-dotnet/blob/master/itext/itext.samples/itext/samples/sandbox/svg/ConvertSvgToXObject.cs) |
120+
| Convert SVG to a PDF with pdfCalligraph | [C#](https://github.com/itext/itext-publications-samples-dotnet/blob/master/itext/itext.samples/itext/samples/sandbox/svg/ConvertSvgToPdfWithPdfCalligraph.cs) |
121121
| <br> | |
122122
| **Convert HTML and CSS to PDF** | [Link to repo](https://github.com/itext/i7j-pdfhtml) |
123123
| Convert simple HTML doc to PDF | [C#](https://kb.itextpdf.com/home/it7kb/ebooks/itext-7-converting-html-to-pdf-with-pdfhtml) |

itext.tests/itext.pdfa.tests/itext/pdfa/PdfAFontTest.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ You should have received a copy of the GNU Affero General Public License
3434
using iText.Layout.Element;
3535
using iText.Pdfa.Exceptions;
3636
using iText.Test;
37-
using iText.Test.Attributes;
3837
using iText.Test.Pdfa;
3938

4039
namespace iText.Pdfa {
@@ -325,8 +324,6 @@ public virtual void GlyphLineWithUndefinedGlyphsTest() {
325324
}
326325

327326
[NUnit.Framework.Test]
328-
[LogMessage(iText.IO.Logs.IoLogMessageConstant.COULD_NOT_FIND_GLYPH_WITH_CODE, Count = 6)]
329-
[NUnit.Framework.Ignore("DEVSIX-9125")]
330327
public virtual void PdfArrayWithUndefinedGlyphsTest() {
331328
String outPdf = DESTINATION_FOLDER + "pdfArrayWithUndefinedGlyphs.pdf";
332329
PdfWriter writer = new PdfWriter(outPdf, new WriterProperties().SetPdfVersion(PdfVersion.PDF_2_0));
@@ -341,10 +338,8 @@ public virtual void PdfArrayWithUndefinedGlyphsTest() {
341338
pdfArray.Add(new PdfString("ABC"));
342339
pdfArray.Add(new PdfNumber(1));
343340
pdfArray.Add(new PdfString("\u898B\u7A4D\u3082\u308A"));
344-
Exception e = NUnit.Framework.Assert.Catch(typeof(PdfAConformanceException), () => canvas.ShowText(pdfArray
345-
));
346-
NUnit.Framework.Assert.AreEqual(PdfaExceptionMessageConstant.EMBEDDED_FONTS_SHALL_DEFINE_ALL_REFERENCED_GLYPHS
347-
, e.Message);
341+
// PdfCanvas#showText(PdfArray) doesn't contain any checks.
342+
NUnit.Framework.Assert.DoesNotThrow(() => canvas.ShowText(pdfArray));
348343
}
349344

350345
[NUnit.Framework.Test]

itext.tests/itext.pdfua.tests/itext/pdfua/checkers/PdfUACanvasTextTest.cs

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ public static IList<String> TextRepresentation() {
5656
public virtual void PuaValueInLayoutTest() {
5757
String filename = "puaValueInLayoutTest";
5858
UaValidationTestFramework framework = new UaValidationTestFramework(DESTINATION_FOLDER, false);
59-
framework.AddSuppliers(new _Generator_75());
59+
framework.AddSuppliers(new _Generator_73());
6060
framework.AssertBothFail(filename, PdfUAExceptionMessageConstants.PUA_CONTENT_WITHOUT_ALT, PdfUAConformance
6161
.PDF_UA_2);
6262
}
6363

64-
private sealed class _Generator_75 : UaValidationTestFramework.Generator<IBlockElement> {
65-
public _Generator_75() {
64+
private sealed class _Generator_73 : UaValidationTestFramework.Generator<IBlockElement> {
65+
public _Generator_73() {
6666
}
6767

6868
public IBlockElement Generate() {
@@ -90,8 +90,7 @@ public virtual void PuaValueWithoutAttributesTest(String textRepresentation) {
9090
canvas.EndText();
9191
}
9292
);
93-
framework.AssertBothFail(filename, PdfUAExceptionMessageConstants.PUA_CONTENT_WITHOUT_ALT, PdfUAConformance
94-
.PDF_UA_2);
93+
AssertResult(false, textRepresentation, filename, framework);
9594
}
9695

9796
[NUnit.Framework.TestCaseSource("TextRepresentation")]
@@ -116,7 +115,7 @@ public virtual void PuaValueWithAltOnTagTest(String textRepresentation) {
116115
canvas.EndText();
117116
}
118117
);
119-
framework.AssertBothValid(filename, PdfUAConformance.PDF_UA_2);
118+
AssertResult(true, textRepresentation, filename, framework);
120119
}
121120

122121
[NUnit.Framework.TestCaseSource("TextRepresentation")]
@@ -141,7 +140,7 @@ public virtual void PuaValueWithActualTextOnTagTest(String textRepresentation) {
141140
canvas.EndText();
142141
}
143142
);
144-
framework.AssertBothValid(filename, PdfUAConformance.PDF_UA_2);
143+
AssertResult(true, textRepresentation, filename, framework);
145144
}
146145

147146
[NUnit.Framework.TestCaseSource("TextRepresentation")]
@@ -165,7 +164,7 @@ public virtual void PuaValueWithAltOnCanvasTest(String textRepresentation) {
165164
canvas.EndText();
166165
}
167166
);
168-
framework.AssertBothValid(filename, PdfUAConformance.PDF_UA_2);
167+
AssertResult(true, textRepresentation, filename, framework);
169168
}
170169

171170
[NUnit.Framework.TestCaseSource("TextRepresentation")]
@@ -189,7 +188,7 @@ public virtual void PuaValueWithActualTextOnCanvasTest(String textRepresentation
189188
canvas.EndText();
190189
}
191190
);
192-
framework.AssertBothValid(filename, PdfUAConformance.PDF_UA_2);
191+
AssertResult(true, textRepresentation, filename, framework);
193192
}
194193

195194
[NUnit.Framework.TestCaseSource("TextRepresentation")]
@@ -227,8 +226,25 @@ public virtual void PuaValueOnTwoPagesTest(String textRepresentation) {
227226
canvasOnPageTwo.EndText();
228227
}
229228
);
230-
framework.AssertBothFail(filename, PdfUAExceptionMessageConstants.PUA_CONTENT_WITHOUT_ALT, PdfUAConformance
231-
.PDF_UA_2);
229+
AssertResult(false, textRepresentation, filename, framework);
230+
}
231+
232+
private void AssertResult(bool expectedValid, String textRepresentation, String filename, UaValidationTestFramework
233+
framework) {
234+
if (expectedValid) {
235+
framework.AssertBothValid(filename, PdfUAConformance.PDF_UA_2);
236+
}
237+
else {
238+
if ("array".Equals(textRepresentation)) {
239+
// In case of "array" PdfCanvas#showText(PdfArray) is used. In this method we don't have this check, because
240+
// of the complications regarding not symbolic fonts.
241+
framework.AssertOnlyVeraPdfFail(filename, PdfUAConformance.PDF_UA_2);
242+
}
243+
else {
244+
framework.AssertBothFail(filename, PdfUAExceptionMessageConstants.PUA_CONTENT_WITHOUT_ALT, PdfUAConformance
245+
.PDF_UA_2);
246+
}
247+
}
232248
}
233249

234250
private void AddPuaTextToCanvas(PdfCanvas canvas, String textRepresentation, PdfFont font) {

itext/itext.kernel/itext/kernel/pdf/canvas/PdfCanvas.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ You should have received a copy of the GNU Affero General Public License
2222
*/
2323
using System;
2424
using System.Collections.Generic;
25-
using System.Text;
2625
using iText.Commons.Datastructures;
2726
using iText.IO.Font;
2827
using iText.IO.Font.Otf;
@@ -818,15 +817,6 @@ public virtual iText.Kernel.Pdf.Canvas.PdfCanvas ShowText(PdfArray textArray) {
818817
throw new PdfException(KernelExceptionMessageConstant.FONT_AND_SIZE_MUST_BE_SET_BEFORE_WRITING_ANY_TEXT, currentGs
819818
);
820819
}
821-
// Take text part to process
822-
StringBuilder decodedText = new StringBuilder();
823-
foreach (PdfObject obj in textArray) {
824-
if (obj is PdfString) {
825-
decodedText.Append(currentGs.GetFont().Decode((PdfString)obj));
826-
}
827-
}
828-
CheckTextOnAddition(decodedText.ToString());
829-
document.CheckIsoConformance(new FontValidationContext(decodedText.ToString(), currentGs.GetFont()));
830820
contentStream.GetOutputStream().WriteBytes(ByteUtils.GetIsoBytes("["));
831821
foreach (PdfObject obj in textArray) {
832822
if (obj.IsString()) {

port-hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3ccc99bd8391813f729cf2b6c656252687f17629
1+
0fef8dc531af794930e066df55b502a030365a56

0 commit comments

Comments
 (0)