Skip to content

About

Runnable C# samples for EvoPdf Next (.NET PDF library): quickstarts, every documentation sample and the ASP.NET Core demo

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

17 Commits

Folders and files

Repository files navigation

EvoPdf Next

EvoPdf Next Samples

Runnable C# samples and the complete demo application for EvoPdf Next, the .NET PDF library: HTML, Word, Excel, RTF and Markdown to PDF, PDF to text, search, images, PDF creation and editing, PDF/UA and PDF/A.

NuGet build Documentation Platforms Ask DeepWiki


Four kinds of samples

Folder What it is How to use it
quickstarts/ 27 minimal samples, one feature each, shared by one .NET 10 console project per platform dotnet run --project Quickstarts_<Platform>.csproj -- <SampleName>: the fastest way to see a feature work
docs-samples/ The 569 code samples of 112 documentation topics, verbatim, each file in its own language (C#, shell, Dockerfile, HTML, XML, YAML, JSON) and linked to its topic Copy into your project; read the topic for the explanation
demo/ The demo applications from the official download package: the ASP.NET Core demo that runs at evopdf.com with the source of every demo page, plus the console demo; one source tree each, a project per platform open the platform solution and run
classic-demo/ The Classic demo application on the Next engine: the ASP.NET Core demo of EvoPdf Classic (EvoPdf namespace) on the EvoPdf.HtmlToPdf.<Platform> packages, the Classic API rendered by the Chromium engine of EvoPdf Next; a project per platform open the platform solution and run; see classic-demo/README.md

All samples use the current API (EvoPdf.Next namespace, version 15.0) and read the license key from the EVOPDF_LICENSE_KEY environment variable; without it they run in demo mode (watermarked output).

Quickstarts

git clone https://github.com/EvoPdf/evopdf-next-samples
cd evopdf-next-samples/quickstarts
dotnet run --project Quickstarts_Windows.csproj -- HtmlToPdf.Basic https://www.evopdf.com   # or _Linux, _MacOS, _Windows.Arm64, ...
dotnet run --project Quickstarts_Windows.csproj                                             # lists the sample names

The samples (quickstarts/Samples/<Name>.cs) are shared by seven platform projects in the same folder (Quickstarts_<Platform>.csproj), one per NuGet package, each with its own obj/bin: the same layout as the demo applications. One project per platform keeps the build small: the package copies the native rendering runtimes into the output folder of every project that references it. Each sample file is self-contained; copy Run into your own project.

Every sample runs without arguments: the input documents (Files/: the Word, Excel, RTF, Markdown and PDF documents of the demo application, a Factur-X invoice with its HTML page, the signature fields page and the sample certificate of the demo) are copied next to the executable, and results are written to an output folder there. Pass your own file or URL as the argument to convert something else: Quickstarts.exe WordToPdf C:\docs\report.docx.

Project Shows
HtmlToPdf.Basic Convert a URL and an HTML string to PDF
HtmlToPdf.PageSetup The page layouts: A4 with the desktop layout of the page, a template at the page width, Save as PDF in Chrome, a receipt on one page, a page as wide as the browser window
HtmlToPdf.HeadersFooters HTML header and footer with page numbers
HtmlToPdf.DynamicContent Wait for JavaScript content: conversion delay and manual triggering
HtmlToPdf.RenderingModes The persistent renderer process: global settings, start before the first conversion, replacements and status
HtmlToPdf.Parallel Convert several URLs in parallel and merge them into one PDF
HtmlToPdf.Standards PDF/UA and PDF/A output
HtmlToPdf.Security Passwords, permissions and document metadata
HtmlToPdf.DigitalSignature PAdES digital signature with a visible appearance; B-B, or B-T with a timestamp server URL as second argument
HtmlToPdf.ElectronicInvoice Factur-X / ZUGFeRD electronic invoice: the invoice page from HTML with the invoice XML embedded, PDF/A-3 and PDF/UA-1
HtmlToImage HTML page to PNG screenshot
WordToPdf Word DOCX to PDF
ExcelToPdf Excel XLSX to PDF
RtfToPdf RTF to PDF
MarkdownToPdf Markdown to PDF
PdfProcessor.PdfToText Extract text from a PDF, original layout or reading order
PdfProcessor.FindText Search text in a PDF and print the position of every match
PdfProcessor.PdfToImage Render PDF pages to PNG images
PdfProcessor.ExtractImages Extract the images embedded in a PDF
PdfEditor.Stamp Stamp an existing PDF with an HTML template
PdfEditor.SignatureFields Signature fields where the HTML page marks each signer, then the first field signed
PdfDocument.MultipleHtml Several HTML documents rendered one after the other in one PDF with PdfDocument.AddHtml
PdfEditor.EditPages Insert a cover page with HTML content, rotate a page and add a bookmark in an existing PDF
PdfEditor.FillForm Create a PDF form from code, then fill it in an existing document; flatten as argument makes the fields static
PdfMerge.PageRanges Merge documents, a blank page and selected pages, with bookmarks for the parts
PdfSplit Extract pages by page ranges and split a PDF into single page documents
PdfRedactor.Redact Permanently remove a name, email addresses, phone numbers and IBANs from a PDF

Running the demo applications

  • ASP.NET Core demo: run it from Visual Studio (open the platform solution, set EvoPdf_Next_AspNetDemo_<Platform> as startup project, F5) or from the CLI in its project folder (dotnet run --project EvoPdf_Next_AspNetDemo_<Platform>.csproj), or publish it (dotnet publish -c Release -o publish) and run from the publish folder. Starting the executable from bin does not work: a build does not copy wwwroot there, so styles, images and the demo input files are not found. Details in demo/README.md.
  • Console demo: runs straight from the build output; EvoPdf_Next_ConsoleDemo_<Platform> /outFileName:output.pdf https://www.evopdf.com. Run it without arguments to see all the options.
  • Quickstarts: Quickstarts.exe <SampleName> [input] from the build output (quickstarts/bin/<Platform>/...), or dotnet run --project Quickstarts_<Platform>.csproj -- <SampleName>; the input documents ship with the build.

Solutions, one per platform

Solution Package Runs on
EvoPdf.Next.Samples.Windows.sln EvoPdf.Next.Windows Windows x64
EvoPdf.Next.Samples.Windows.Arm64.sln EvoPdf.Next.Windows.Arm64 Windows ARM64
EvoPdf.Next.Samples.Linux.sln EvoPdf.Next.Linux Linux x64
EvoPdf.Next.Samples.Linux.Arm64.sln EvoPdf.Next.Linux.Arm64 Linux ARM64
EvoPdf.Next.Samples.MacOS.sln EvoPdf.Next.MacOS macOS (Apple Silicon)
EvoPdf.Next.Samples.MultiPlatform.sln EvoPdf.Next Windows x64 + Linux x64
EvoPdf.Next.Samples.MultiPlatform.Arm64.sln EvoPdf.Next.Windows.Arm64 + EvoPdf.Next.Linux.Arm64 Windows ARM64 + Linux ARM64

Each solution holds the quickstarts, the ASP.NET Core demo, the console demo and the Classic demo on the Next engine of its platform; the Classic demo references the EvoPdf.HtmlToPdf.<Platform> packages of the same platform. The CI builds all seven on Windows, Linux and macOS runners. On Linux install the system packages first.

Documentation samples

Documentation topic Samples
Access a HTML Page Using GET and POST HTTP Methods 1
Add a Digital Signature to Generated PDF Document 2
Add Attachments to Generated PDF 3
Add Bookmarks and Open Action to Generated PDF 3
Add Cookies to HTML Page Request 1
Add Excel Workbooks to PDF Documents 2
Add File Attachments to Existing PDF 3
Add Header and Footer to PDF from Multiple HTML 3
Add HTML as Image to Existing PDF 2
Add HTML in Header and Footer Using Browser Mode 3
Add HTML in Header and Footer with Page Numbers 5
Add HTML Stamp with Page Numbering to Existing PDF 8
Add HTML Stamp with Page Numbering to Generated PDF 4
Add HTML to Existing PDF 3
Add HTTP Headers to HTML Page Request 1
Add Images to Existing PDF 1
Add Link Annotations to Existing PDF 2
Add Markdown Content to PDF Documents 3
Add Pages of Other PDF Documents to Existing PDF 2
Add Polylines, Polygons and Paths to Existing PDF 1
Add RTF Documents to PDF Documents 3
Add Shapes to Existing PDF 1
Add Signature Fields from HTML Elements 1
Add Text Annotations to Existing PDF 2
Add Text to Existing PDF 4
Add Word Documents to PDF Documents 3
Add, Insert, Move, Rotate and Remove PDF Pages 5
Apply Redaction Annotations in PDF 3
Auto Create Hierarchical Bookmarks 3
Auto Create Table of Contents 10
Avoid Page Breaks Inside HTML Elements Using CSS 2
Build and Publish Demo Applications 33
Convert a HTML Page to PDF in Same Session 2
Convert Excel XLSX to PDF 19
Convert HTML Pages with Authentication 2
Convert HTML through a Proxy Server 1
Convert HTML with SVG to PDF 1
Convert HTML with Web Fonts to PDF 1
Convert Internal Links from HTML to PDF 1
Convert Markdown to PDF 14
Convert Multiple HTML Pages to PDF in Parallel 1
Convert Multiple HTML to a Single PDF 1
Convert PDF Pages to Images 27
Convert PDF to Text 20
Convert RTF to PDF 24
Convert RTF to PDF with Document Headers and Footers 3
Convert the Current HTML Page to PDF 1
Convert Word DOCX to PDF 17
Convert Word to PDF with Document Fonts 4
Convert Word to PDF with Document Headers and Footers 3
Convert Word to PDF with Outline, Open Action and Attachments 5
Create Electronic Invoices from Word 1
Create Factur-X, ZUGFeRD and XRechnung Electronic Invoices 1
Create PDF Documents 11
Create PDF Documents with File Attachments 4
Create PDF Documents with Gradient Fills 3
Create PDF Documents with HTML as Image 4
Create PDF Documents with HTML Content 5
Create PDF Documents with Images 5
Create PDF Documents with Link Annotations 3
Create PDF Documents with Pages of Other PDF Documents 2
Create PDF Documents with Polylines, Polygons and Paths 2
Create PDF Documents with Shapes 2
Create PDF Documents with Text 10
Create PDF Documents with Text Annotations 3
Create PDF Forms from Code 3
Create PDF Forms from HTML Forms 2
Create PDF/UA and PDF/A Compliant Documents 1
Create PDF/UA and PDF/A Documents 2
Digitally Sign Existing PDF 3
EvoPdf Next for .NET Overview 3
EvoPdf Next for .NET Overview 3
Extract Images from PDF 24
Fill, Flatten and Edit PDF Forms 4
Getting Started with EvoPdf Next for .NET on Linux 9
Getting Started with EvoPdf Next for .NET on macOS 5
Getting Started with EvoPdf Next for .NET on Windows 5
HTML to Image Converter Overview 1
HTML To PDF Converter Options 2
HTML to PDF Converter Overview 1
HTML to PDF Page Setup and Scaling 15
HTML to PDF Rendering Modes and the Persistent Rendering Engine 3
Insert Page Breaks in PDF Using CSS in HTML 2
Licensing for EvoPdf Next 1
Merge PDF Documents 4
Migrate HTML to PDF Page Setup and Headers from EvoPdf Classic 15
Publish EvoPdf Next ASP.NET Demo to Docker on Linux 14
Publish EvoPdf Next ASP.NET Demo to Docker on Windows 9
Redact Areas and Pages of PDF 3
Redact Text and Personal Data in PDF 4
Repeat HTML Table Header and Footer in PDF Pages 2
Retrieve HTML Element Positions in PDF 2
Retrieve HTML to PDF Conversion Information 2
Search for Text in PDF 18
Select Conversion Triggering Mode 6
Select HTML Elements to Convert to Image 1
Select HTML Elements to Convert to PDF 1
Select HTML Elements to Exclude from Image 1
Select HTML Elements to Exclude from PDF 1
Select Media Type for Screen or Print 2
Set PDF Viewer Preferences for the Generated PDF Document 2
Set Permissions and Password of the Generated PDF Document 2
Split PDF Documents 3
Using EvoPdf Next for .NET in Amazon ECS on AWS Fargate 9
Using EvoPdf Next for .NET in AWS Elastic Beanstalk on Linux 4
Using EvoPdf Next for .NET in AWS Elastic Beanstalk on Windows 2
Using EvoPdf Next for .NET in AWS Lambda 7
Using EvoPdf Next for .NET in Azure Container Apps 7
Using EvoPdf Next for .NET in Azure Functions on Linux 14
Using EvoPdf Next for .NET in Google Cloud Run 7
Using EvoPdf Next for .NET in Kubernetes 7
Using EvoPdf Next for .NET on Azure App Service for Linux 5

Related

License

The samples are MIT licensed. EvoPdf Next is commercial software with a free, time-unlimited evaluation. The demo applications contain public evaluation keys intended only to run the demos without watermarks.

About

Runnable C# samples for EvoPdf Next (.NET PDF library): quickstarts, every documentation sample and the ASP.NET Core demo

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages