DinkToPdf

C# .NET Core wrapper for wkhtmltopdf library that uses Webkit engine to convert HTML pages to PDF. (by rdvojmoc)

DinkToPdf Alternatives

Similar projects and alternatives to DinkToPdf

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a better DinkToPdf alternative or higher similarity.

DinkToPdf reviews and mentions

Posts with mentions or reviews of DinkToPdf. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-04-28.
  • How to generate PDF and HTML in 2023?
    3 projects | /r/csharp | 28 Apr 2023
    I used this package for a while to generate the PDF from HTML - https://github.com/rdvojmoc/DinkToPdf
  • Loving MudBlazor but need a fully-featured PDF viewer/annotator component like Syncfusion's
    2 projects | /r/Blazor | 15 Nov 2022
    This may not be applicable in your situation, but I'll leave this info here anyways. I used DinkToPdf https://github.com/rdvojmoc/DinkToPdf for a Blazor Server and a Blazor WASM OMS application. I created a 'Reports' controller, created two different controller action methods. One to create the HTML for the PDF and the other to actually generate the PDF.
  • Best free .NET core 5.0 HTML to PDF to use?
    5 projects | /r/dotnet | 27 Mar 2021
    The install instructions for DinkToPdf (see github) have a step about installing native binaries that your tutorial seems to be missing.
  • Azure Functions & wkhtmltopdf: Convert HTML to PDF
    2 projects | dev.to | 22 Mar 2021
    using Microsoft.Azure.WebJobs; using Microsoft.Azure.WebJobs.Extensions.Http; using Microsoft.Extensions.Logging; using DinkToPdf; using IPdfConverter = DinkToPdf.Contracts.IConverter; using Microsoft.WindowsAzure.Storage; using Microsoft.WindowsAzure.Storage.Blob; using System.Threading.Tasks; namespace Html2Pdf { public class Html2Pdf { // Read more about converter on: https://github.com/rdvojmoc/DinkToPdf // For our purposes we are going to use SynchronizedConverter IPdfConverter pdfConverter = new SynchronizedConverter(new PdfTools()); // A function to convert html content to pdf based on the configuration pased as arguments // Arguments: // HtmlContent: the html content to be converted // Width: the width of the pdf to be created. e.g. "8.5in", "21.59cm" etc. // Height: the height of the pdf to be created. e.g. "11in", "27.94cm" etc. // Margins: the margis around the content // DPI: The dpi is very important when you want to print the pdf. // Returns a byte array of the pdf which can be stored as a file private byte[] BuildPdf(string HtmlContent, string Width, string Height, MarginSettings Margins, int? DPI = 180) { // Call the Convert method of SynchronizedConverter "pdfConverter" return pdfConverter.Convert(new HtmlToPdfDocument() { // Set the html content Objects = { new ObjectSettings { HtmlContent = HtmlContent } }, // Set the configurations GlobalSettings = new GlobalSettings { // PaperKind.A4 can also be used instead of width & height PaperSize = new PechkinPaperSize(Width, Height), DPI = DPI, Margins = Margins } }); } // The name of the function [FunctionName("Html2Pdf")] // The first arugment tells that the functions can be triggerd by a POST HTTP request. // The second argument is mainly used for logging information, warnings or errors public async Task Run([HttpTrigger(AuthorizationLevel.Function, "POST")] Html2PdfRequest Request, ILogger Log) { // PDFByteArray is a byte array of pdf generated from the HtmlContent var PDFByteArray = BuildPdf(Request.HtmlContent, "8.5in", "11in", new MarginSettings(0, 0, 0, 0)); // The connection string of the Storage Account to which our PDF file will be uploaded // The connection string of the Storage Account to which our PDF file will be uploaded var StorageConnectionString = "DefaultEndpointsProtocol=https;AccountName=;AccountKey=;EndpointSuffix=core.windows.net"; // Generate an instance of CloudStorageAccount by parsing the connection string var StorageAccount = CloudStorageAccount.Parse(StorageConnectionString); // Create an instance of CloudBlobClient to connect to our storage account CloudBlobClient BlobClient = StorageAccount.CreateCloudBlobClient(); // Get the instance of CloudBlobContainer which points to a container name "pdf" // Replace your own container name CloudBlobContainer BlobContainer = BlobClient.GetContainerReference("pdf"); // Get the instance of the CloudBlockBlob to which the PDFByteArray will be uploaded CloudBlockBlob Blob = BlobContainer.GetBlockBlobReference(Request.PDFFileName); // Upload the pdf blob await Blob.UploadFromByteArrayAsync(PDFByteArray, 0, PDFByteArray.Length); } } }
  • A note from our sponsor - WorkOS
    workos.com | 28 Mar 2024
    The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning. Learn more →

Stats

Basic DinkToPdf repo stats
4
1,015
0.0
almost 4 years ago
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com