|
| 1 | +/* |
| 2 | + This file is part of the iText (R) project. |
| 3 | + Copyright (c) 1998-2024 Apryse Group NV |
| 4 | + Authors: Apryse Software. |
| 5 | +
|
| 6 | + This program is offered under a commercial and under the AGPL license. |
| 7 | + For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. |
| 8 | +
|
| 9 | + AGPL licensing: |
| 10 | + This program is free software: you can redistribute it and/or modify |
| 11 | + it under the terms of the GNU Affero General Public License as published by |
| 12 | + the Free Software Foundation, either version 3 of the License, or |
| 13 | + (at your option) any later version. |
| 14 | +
|
| 15 | + This program is distributed in the hope that it will be useful, |
| 16 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | + GNU Affero General Public License for more details. |
| 19 | +
|
| 20 | + You should have received a copy of the GNU Affero General Public License |
| 21 | + along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 22 | + */ |
| 23 | +package com.itextpdf.html2pdf.css; |
| 24 | + |
| 25 | +import com.itextpdf.html2pdf.HtmlConverter; |
| 26 | +import com.itextpdf.kernel.utils.CompareTool; |
| 27 | +import com.itextpdf.test.ExtendedITextTest; |
| 28 | +import com.itextpdf.test.annotations.type.IntegrationTest; |
| 29 | + |
| 30 | +import java.io.File; |
| 31 | +import java.io.IOException; |
| 32 | +import org.junit.Assert; |
| 33 | +import org.junit.BeforeClass; |
| 34 | +import org.junit.Test; |
| 35 | +import org.junit.experimental.categories.Category; |
| 36 | + |
| 37 | +@Category(IntegrationTest.class) |
| 38 | +public class FontFamilyTest extends ExtendedITextTest { |
| 39 | + public static final String SOURCE_FOLDER = "./src/test/resources/com/itextpdf/html2pdf/css/FontFamilyTest/"; |
| 40 | + public static final String DESTINATION_FOLDER = "./target/test/com/itextpdf/html2pdf/css/FontFamilyTest/"; |
| 41 | + |
| 42 | + @BeforeClass |
| 43 | + public static void beforeClass() { |
| 44 | + createDestinationFolder(DESTINATION_FOLDER); |
| 45 | + } |
| 46 | + @Test |
| 47 | + public void hugeFontFamilyForDosAttackTest() throws IOException, InterruptedException { |
| 48 | + String htmlPath = SOURCE_FOLDER + "hugeFontFamilyForDosAttackTest.html"; |
| 49 | + String pdfPath = DESTINATION_FOLDER + "hugeFontFamilyForDosAttackTest.pdf"; |
| 50 | + String cmpPdfPath = SOURCE_FOLDER + "cmp_hugeFontFamilyForDosAttackTest.pdf"; |
| 51 | + |
| 52 | + HtmlConverter.convertToPdf(new File(htmlPath), new File(pdfPath)); |
| 53 | + Assert.assertNull(new CompareTool().compareByContent(pdfPath, cmpPdfPath, DESTINATION_FOLDER, "diff_")); |
| 54 | + } |
| 55 | +} |
0 commit comments