DinkToPdf VS PDF.js

Compare DinkToPdf vs PDF.js and see what are their differences.

DinkToPdf

C# .NET Core wrapper for wkhtmltopdf library that uses Webkit engine to convert HTML pages to PDF. (by rdvojmoc)
Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
DinkToPdf PDF.js
4 83
1,037 46,263
- 1.6%
0.0 9.9
about 4 years ago 2 days ago
C# JavaScript
MIT License Apache License 2.0
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

DinkToPdf

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); } } }

PDF.js

Posts with mentions or reviews of PDF.js. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-03-28.
  • Building W-9 Crafter
    4 projects | dev.to | 28 Mar 2024
    I first started building the app in the browser, using PDF.js and Download.js to take a PDF and edit it, and then download it to your computer.
  • Parsing PDFs in Node.js
    5 projects | dev.to | 12 Mar 2024
    pdf2json is a module that transforms PDF files from binary to JSON format, using pdf.js for its core functionality. It also incorporates support for interactive form elements, enhancing its utility in processing and interpreting PDF content.
  • Is it possible to port Edge's PDF Editor to other browsers or make your own custom one?
    1 project | /r/learnprogramming | 4 Dec 2023
    Why not PDF.js?
  • How to Write a Cold Email
    1 project | news.ycombinator.com | 17 Nov 2023
    I'd think opening a PDF in your browser would be at the same risk-level you associate with going to any random URL. On Firefox at least, I'm pretty sure the built-in PDF viewer is simply JS parsing and rendering the PDF anyway -- nothing with elevated permissions:

    https://mozilla.github.io/pdf.js/

  • Firefox 119 unleashes PDF prowess and Sync sorcery
    1 project | news.ycombinator.com | 28 Oct 2023
    The PDF features are actually an extension, just one built in as Firefox's default pdf viewer.

    It's called pdf.js https://github.com/mozilla/pdf.js/

    You can actually use this pdf viewer in another browser like Chrome if you'd like, there's a demo URL on there.

  • PDF Chat with Node.js, OpenAI and ModelFusion
    2 projects | dev.to | 3 Sep 2023
    We use Mozilla's PDF.js via the pdfjs-dist NPM module to load pages from a PDF file. The loadPdfPages function reads the PDF file and extracts its content. It returns an array where each object contains the page number and the text of that page.
  • Ask HN: Best toolkit to build custom pdf viewer?
    1 project | news.ycombinator.com | 16 Aug 2023
  • Microsoft faces antitrust scrutiny from the EU over Teams, Office 365
    5 projects | news.ycombinator.com | 19 Jul 2023
    The problem is that there simply wasn't a better option at the time.

    Ogg Vorbis was a novelty at best, and it was the only decently widely adopted open source competitor for any of the items listed that was available at the time.

    HTML5 was only just published when Chrome launched. So Flash was at that point the only option available to show a video in the browser (sure, downloading a RealPlayer file was always an option, but it was clunky, creators didn't like people being able to save stuff locally, and was also not open source). Chrome in fact arguably accelerated the process of getting web video open sourced: Google bought On2 in 2010 to get the rights to VP8 (the only decent H.264 competitor available at that point) so they could immediately open source it. The plan was in fact to remove H.264 from Chrome entirely once VP8/VP9 adoption ramped up[1], but that didn’t end up happening.

    Flash was integrated into Chrome because people were going to use it anyway, and having Google distribute it at least let them both sandbox it and roll out automatic updates (a massive vector for malware at the time was ads pretending to be Flash updates, which worked because people were just that used to constant Flash security patches, most of which required a full reboot to apply; Chrome fixed both of those issues). Apple are the ones who ultimately dealt the death blow to Flash, and it was really just because Adobe could not optimize it for phone CPUs no matter what they tried (even the few Android releases of Flash that we got were practically unusable). That also further accelerated the adoption of open source HTML5 technologies.

    PDF is an open source format, and has been since 2008. While I don't know if pressure from Google is what did it, that wouldn’t surprise me. Regardless, the Chrome PDF reader, PDFium, is open source[2] and Mozilla's equivalent project from 2011, PDF.js, is also open source.[3] Both of these projects replaced the distinctly closed source Adobe Reader plugin that was formerly mandatory for viewing PDFs in the browser.

    Chrome is directly responsible for eliminating a lot of proprietary software from mainstream use and replacing it with high-quality open source tools. While they've caused problems in other areas of browser development that are worthy of criticism, Chrome's track record when it comes to open sourcing their tech has been very good.

    [1]: https://blog.chromium.org/2011/01/html-video-codec-support-i...

    [2]: https://github.com/chromium/pdfium

    [3]: https://github.com/mozilla/pdf.js

  • How do Fix this issue while trying to save an edited PDF? (text gets really small and is rotated)(i'm using nightly)
    1 project | /r/firefox | 1 Jun 2023
    Firefox Nightly is an unstable test version. You should report PDF issues to this GitHub repository.
  • Firefox PDF Pen Editor: Disable Pen "Autocorrect" Feature
    1 project | /r/firefox | 17 May 2023
    Open this page and click on New Issue to ask the developers of the PDF viewer: mozilla/pdf.js repository. Please post a link to your question here.

What are some alternatives?

When comparing DinkToPdf and PDF.js you can also consider the following projects:

WKHTMLToPDF - Convert HTML to PDF using Webkit (QtWebKit)

jsPDF - Client-side JavaScript PDF generation for everyone.

PuppeteerSharp - Headless Chrome .NET API

pdfmake - Client/server side PDF printing in pure JavaScript

gotenberg - A developer-friendly API for converting numerous document formats into PDF files, and more!

PDFKit - A JavaScript PDF generation library for Node and the browser

Report-From-DocX-HTML-To-PDF-Converter - .NET Core library to create custom reports based on Word docx or HTML documents and convert to PDF

Papa Parse - Fast and powerful CSV (delimited text) parser that gracefully handles large files and malformed input

scryber.core - Scryber.Core is a dotnet html to pdf engine written entirely in C# for creating beautiful flexible, flowing documents from html templates including css styles, data binding, svg drawing and encryption

diff2html - Pretty diff to html javascript library (diff2html)

go-wkhtmltopdf - Go bindings for wkhtmltopdf and high-level HTML to PDF conversion interface

pdf-lib - Create and modify PDF documents in any JavaScript environment