IronPdf / Iron-Pdf-Documentation

ReadTheDocs Build Files for IronPDF C#/.Net PDF Library http://ironpdf.com
8 stars 2 forks source link

Failed to convert Html file to Pdf #24

Open sunnykoundal opened 2 years ago

sunnykoundal commented 2 years ago

Hi IronPdf team,

There is totally failure of converting a HTML file to PDF where I have complex table tag with colspan and rowspan, It is rendering exact view but controls like checkbox and input tags contradict with each other. It converts checkbox to text field and text fields to checkboxes. you can find the HTML file here:

https://github.com/sunnykoundal/Public-Files/blob/main/ChainOfCustodyPdf.html

C# code:

` C# code inside controller written down:

        var templateFilePath = Server.MapPath("~/HtmlTemplate/ChainOfCustodyPdf.html");

        // Instantiate Renderer
        var Renderer = new IronPdf.ChromePdfRenderer();

        Renderer.RenderingOptions.CreatePdfFormsFromHtml = true;
        Renderer.RenderingOptions.PrintHtmlBackgrounds = true;
        Renderer.RenderingOptions.GrayScale = true;
        Renderer.RenderingOptions.Title = "Chain Of Custody";
        Renderer.RenderingOptions.MarginTop = 0;
        Renderer.RenderingOptions.MarginRight = 5;
        Renderer.RenderingOptions.MarginBottom = 0;
        Renderer.RenderingOptions.MarginLeft = 5;

        Renderer.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Screen;
        Renderer.RenderingOptions.Zoom = 100;
        Renderer.RenderingOptions.CreatePdfFormsFromHtml = true;

        Renderer.RenderingOptions.PaperOrientation = IronPdf.Rendering.PdfPaperOrientation.Landscape;

        // Create a PDF from an existing HTML file using C#
        var pdf = Renderer.RenderHtmlFileAsPdfAsync(templateFilePath);
        //var pdf = Renderer.StaticRenderHTMLFileAsPdf(templateFilePath, PdfPrintOptions);

        // Export to a file or Stream
        pdf.Result.SaveAs(Server.MapPath("~/OtherDocuments/COC-Sample.Pdf"));`