Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to convert Html file to Pdf #24

Open
sunnykoundal opened this issue Sep 9, 2022 · 0 comments
Open

Failed to convert Html file to Pdf #24

sunnykoundal opened this issue Sep 9, 2022 · 0 comments

Comments

@sunnykoundal
Copy link

sunnykoundal commented Sep 9, 2022

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"));`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant