DinkToPdf icon indicating copy to clipboard operation
DinkToPdf copied to clipboard

Convert a byte array

Open Casimodo72 opened this issue 5 years ago • 0 comments

Could the following be added/changed in DinkToPdf.ObjectSettings? Property RawContent in order to feed the converter also with a byte array instead of a string. In my scenario the input is already a byte array with utf-8 encoding.

I've added that to my custom build of DinkToPdf. See https://github.com/Casimodo72/Casimodo.Lib/blob/master/src/Casimodo.Lib.Web.Pdf.AppService/Controllers/PdfController.cs But it would be nice to have that officially in the sources so that I can use DinkToPdf's NuGet package instead of my custom build.

public byte[] RawContent { get; set; }

public byte[] GetContent()
{
    if (RawContent != null)
        return RawContent;

    if (HtmlContent == null)
    {
        return new byte[0];
    }

    return Encoding.UTF8.GetBytes(HtmlContent);
}

Casimodo72 avatar Feb 07 '19 10:02 Casimodo72