Skip to content

Commit 9e9f932

Browse files
michaeldemeyiText-CI
authored andcommitted
Use ConverterProperties when converting SVG to PDF. RND-1108
Autoported commit. Original commit hash: [9f886072]
1 parent 38239c3 commit 9e9f932

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

itext/itext.html2pdf/itext/html2pdf/attach/impl/tags/ImgTagWorker.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ source product.
5656
using iText.Svg.Converter;
5757
using iText.Svg.Exceptions;
5858
using iText.Svg.Processors;
59+
using iText.Svg.Processors.Impl;
5960

6061
namespace iText.Html2pdf.Attach.Impl.Tags {
6162
/// <summary>
@@ -126,7 +127,10 @@ public ImgTagWorker(IElementNode element, ProcessorContext context) {
126127
/// <exception cref="System.IO.IOException"/>
127128
private void ProcessAsSvg(Stream stream, ProcessorContext context) {
128129
SvgProcessingUtil processingUtil = new SvgProcessingUtil();
129-
ISvgProcessorResult res = SvgConverter.ParseAndProcess(stream);
130+
SvgConverterProperties svgConverterProperties = new SvgConverterProperties();
131+
svgConverterProperties.SetBaseUri(context.GetBaseUri()).SetFontProvider(context.GetFontProvider()).SetMediaDeviceDescription
132+
(context.GetDeviceDescription());
133+
ISvgProcessorResult res = SvgConverter.ParseAndProcess(stream, svgConverterProperties);
130134
if (context.GetPdfDocument() != null) {
131135
image = processingUtil.CreateImageFromProcessingResult(res, context.GetPdfDocument());
132136
}

itext/itext.html2pdf/itext/html2pdf/attach/impl/tags/ObjectTagWorker.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ source product.
5454
using iText.Svg.Converter;
5555
using iText.Svg.Exceptions;
5656
using iText.Svg.Processors;
57+
using iText.Svg.Processors.Impl;
5758

5859
namespace iText.Html2pdf.Attach.Impl.Tags {
5960
/// <summary>
@@ -92,7 +93,10 @@ public ObjectTagWorker(IElementNode element, ProcessorContext context) {
9293
.DATA));
9394
if (svgStream != null) {
9495
try {
95-
res = SvgConverter.ParseAndProcess(svgStream);
96+
SvgConverterProperties svgConverterProperties = new SvgConverterProperties();
97+
svgConverterProperties.SetBaseUri(context.GetBaseUri()).SetFontProvider(context.GetFontProvider()).SetMediaDeviceDescription
98+
(context.GetDeviceDescription());
99+
res = SvgConverter.ParseAndProcess(svgStream, svgConverterProperties);
96100
}
97101
catch (SvgProcessingException spe) {
98102
LOGGER.Error(spe.Message);

port-hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
38a6a47e4b60216298f9fbb3a1b63e401cf6862e
1+
9f8860729080481729540c10bf75c6f22c01d0cb

0 commit comments

Comments
 (0)