DinkToPdf return empty bytes Array using HtmlToPdfDocument convert

81 views Asked by At

I have a problem with HtmlToPdfDocument convert function from library DinkToPdf , always return empty bytes array using below code

Iam using .net framework

Any ideas why that would be?

PdfConvertor convertor = new PdfConvertor()
                {
                    OutputPdfFile = outputPath,
                    PageContent = htmlContent,
                     PageName = recurrentInvoice.BillNumber,
                    IsChild = true
                };
                var doc = new HtmlToPdfDocument()
                {
                    GlobalSettings =
                                {
                                    ColorMode = DinkToPdf.ColorMode.Color,
                                    Orientation = convertor.IsChild ? Orientation.Landscape : Orientation.Portrait,
                                    PaperSize = DinkToPdf.PaperKind.A4,
                           
                                    Out = convertor.OutputPdfFile+"\\"+convertor.PageName+".pdf",
                                },
                    Objects =
                                {
                                    new ObjectSettings()
                                        {
                                            PagesCount = true,
                                            HtmlContent = convertor.PageContent,//htmlDoc.DocumentNode.OuterHtml,
                                            WebSettings = {  DefaultEncoding = "utf-8",},
                                        }
                                }
                };

               var doc2 = _converter.Convert(doc);
0

There are 0 answers