Explorar o código

Replaced ImagePlaceholder.png with SVG Path

Marcin Ziąbek hai 1 ano
pai
achega
919493011d

+ 4 - 7
Source/QuestPDF/Elements/Placeholder.cs

@@ -7,15 +7,12 @@ namespace QuestPDF.Elements
     internal sealed class Placeholder : IComponent
     {
         public string Text { get; set; }
-        private static readonly byte[] ImageData;
-
-        static Placeholder()
-        {
-            ImageData = Helpers.Helpers.LoadEmbeddedResource("QuestPDF.Resources.ImagePlaceholder.png");
-        }
 
         public void Compose(IContainer container)
         {
+            const float imageSvgSize = 24f;
+            const string imageSvgPath = "M8.5,13.5L11,16.5L14.5,12L19,18H5M21,19V5C21,3.89 20.1,3 19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19Z";
+            
             container
                 .Background(Colors.Grey.Lighten2)
                 .Padding(5)
@@ -24,7 +21,7 @@ namespace QuestPDF.Elements
                 .Element(x =>
                 {
                     if (string.IsNullOrWhiteSpace(Text))
-                        x.MaxHeight(32).Image(ImageData).FitArea();
+                        x.Height(imageSvgSize).Width(imageSvgSize).SvgPath(imageSvgPath, Colors.White);
                     
                     else
                         x.Text(Text).FontSize(14);

BIN=BIN
Source/QuestPDF/Resources/ImagePlaceholder.png