Skip to content

Commit ed48848

Browse files
committed
Fix processing base url as file url. Major refactoring. Add new tests.
DEVSIX-1668 Autoported commit. Original commit hash: [788b72c]
1 parent e81fa5f commit ed48848

37 files changed

+529
-73
lines changed

itext.tests/itext.html2pdf.tests/itext/html2pdf/ResourceResolverTest.cs

Lines changed: 266 additions & 39 deletions
Large diffs are not rendered by default.

itext.tests/itext.html2pdf.tests/itext/html2pdf/css/PageRuleTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ private void RunTest(String name, ConverterProperties converterProperties, bool
819819
converterProperties = new ConverterProperties();
820820
}
821821
if (converterProperties.GetBaseUri() == null) {
822-
converterProperties.SetBaseUri(new FileInfo(htmlPath).FullName);
822+
converterProperties.SetBaseUri(UrlUtil.GetFileUriString(htmlPath));
823823
}
824824
PdfDocument pdfDocument = new PdfDocument(new PdfWriter(outFile));
825825
if (isTagged) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<link rel="stylesheet" href="styles06.css">
5+
</head>
6+
<body>
7+
8+
<ul>
9+
<li>Coffee</li>
10+
<li style="list-style-type: decimal">Tea</li>
11+
<li>Coca Cola</li>
12+
</ul>
13+
14+
<ol>
15+
<li>Coffee</li>
16+
<li>Tea</li>
17+
<li>Coca Cola</li>
18+
</ol>
19+
20+
<dl>
21+
<li>Coffee</li>
22+
<li>Tea</li>
23+
<li>Coca Cola</li>
24+
</dl>
25+
26+
</body>
27+
</html>
28+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<base href="../"/>
5+
<link rel="stylesheet" href="%23r%e%2525s@o%25urces/styles06.css">
6+
</head>
7+
<body>
8+
9+
<ul>
10+
<li>Coffee</li>
11+
<li style="list-style-type: decimal">Tea</li>
12+
<li>Coca Cola</li>
13+
</ul>
14+
15+
<ol>
16+
<li>Coffee</li>
17+
<li>Tea</li>
18+
<li>Coca Cola</li>
19+
</ol>
20+
21+
<dl>
22+
<li>Coffee</li>
23+
<li>Tea</li>
24+
<li>Coca Cola</li>
25+
</dl>
26+
27+
</body>
28+
</html>
29+

0 commit comments

Comments
 (0)