Convert from HTML to PDF in ASP.NET Core with a Free 3rd Party Library

Html to Pdf Conversion is now available for .NET Core. SelectPdf offers a Community Edition (FREE) of the powerful Html To Pdf Converter for .NET Core that can be found in the full featured pdf library.

C# (1.6 MB)
4.3 Star
2,050 times
Add to favorites
E-mail Twitter Digg Facebook

Solution explorer

@model SelectPdf.Samples.Pages.ConvertUrlToPdfModel
    Layout = "~/Pages/_Layout.cshtml";
    ViewData["Title"] = "SelectPdf Free Html To Pdf Converter for .NET Core - Convert from Url to Pdf - C# / ASP.NET Core MVC6";
    ViewData["Description"] = "SelectPdf Convert from Url to Pdf Sample for C# ASP.NET MVC. Pdf Library for .NET with full sample code in C# and VB.NET.";
    ViewData["Keywords"] = "convert from url to pdf, pdf library, sample code, html to pdf, pdf converter";

<form method="post">
    <article class="post type-post status-publish format-standard hentry">
        <header class="entry-header">
            <h1 class="entry-title">SelectPdf Free Html To Pdf Converter for .NET Core - Convert from Html to Pdf - C# / ASP.NET Core MVC6 Sample</h1>
        <!-- .entry-header -->

        <div class="entry-content">
                This sample shows how to use SelectPdf html to pdf converter to convert an url to pdf, also setting a few properties.
                Url:<br />
                <input type="text" style="width: 90%;" value="" asp-for="TxtUrl" />
            <div class="col2">
                Pdf Page Size:<br />
                <select asp-for="DdlPageSize" asp-items="Model.PageSizes"></select>
                <br />
                <br />
                Pdf Page Orientation:<br />
                <select asp-for="DdlPageOrientation" asp-items="Model.PageOrientations"></select><br />
                <br />
            <div class="col2">
                Web Page Width:<br />
                <input type="text" style="width: 50px;" value="1024" asp-for="TxtWidth" /> px<br />
                <br />
                Web Page Height:<br />
                <input type="text" style="width: 50px;" value="" asp-for="TxtHeight" /> px<br />
                (leave empty to auto detect)<br />
                <br />

            <div class="col-clear"></div>
                <input type="submit" name="BtnConvert" value="Create PDF" class="mybutton" />
        <!-- .entry-content -->