HtmlToPdf2AZ 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package HtmlToPdf2AZ --version 1.0.0                
NuGet\Install-Package HtmlToPdf2AZ -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HtmlToPdf2AZ" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HtmlToPdf2AZ --version 1.0.0                
#r "nuget: HtmlToPdf2AZ, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install HtmlToPdf2AZ as a Cake Addin
#addin nuget:?package=HtmlToPdf2AZ&version=1.0.0

// Install HtmlToPdf2AZ as a Cake Tool
#tool nuget:?package=HtmlToPdf2AZ&version=1.0.0                

HtmlToPdf2AZ

HtmlToPdf2AZ is a simple library for generating PDFs from html or from url.

Main methods

  • GetPDFFromHTML: use that method to convert an HTML to Stream PDF
  • GetPDFFromURL: use that method to convert an url content to Stream PDF

Example of use

		static void Main(string[] args)
        {
            var pdf = new HtmlToPdf2AZ.PdfTools();
            string outputFile = @"C:\myfile.pdf";
            string outputFile2 = @"C:\mifile2.pdf";
            var res = pdf.GetPDFFromHTML("<p style='font-size:20px;'>Hello world</p>",
                headerTemplate: "<div class=\"header\" style=\"padding: 10px; -webkit-print-color-adjust: exact; background-color: red; colour: white; width: 100%; text-align: left; font-size: 12px;\">Header goes here<br /><br /><br /> Page <span class=\"pageNumber\"></span> of <span class=\"totalPages\" ></span></div>",
                footerTemplate: "<div class=\"footer\" style=\"padding: 10px; -webkit-print-color-adjust: exact; background-color: blue; colour: white; width: 100%; text-align: right; font-size: 12px;\">Here goes the footer<br /><br /><br /> Page <span class=\"pageNumber\"></span> of <span class=\"totalPages\ "></span></div>",
                marginOptions: new Tools.Models.MarginOptions("50"),
                paperFormat: Tools.Models.PaperFormat.A4).Result;
            var res2 = pdf.GetPDFFromURL("https://www.google.es",
                headerTemplate: "<div class=\"header\" style=\"padding: 0 !important; edge: 0; -webkit-print-color-adjust: exact; background-color: red; colour: white; width: 100%; text-align: left; font-size: 12px;\">header of John<br /> Page <span class=\"pageNumber\"></span> of <span class=\"totalPages\"></span></div> ",
                footerTemplate: "<div class=\"footer\" style=\"padding: 0 !important; edge: 0; -webkit-print-color-adjust: exact; background-color: blue; colour: white; width: 100%; text-align: right; font-size: 12px;\">footer of John<br /> Page <span class=\"pageNumber\"></span> of <span class=\"totalPages\"></span></div> ",
                marginOptions: new Tools.Models.MarginOptions("50"),
                paperFormat: Tools.Models.PaperFormat.A4).Result;
            SaveFileStream(outputFile, res);
            SaveFileStream(outputFile2, res2);
        }
        private static void SaveFileStream(string path, Stream stream)
        {
            var fileStream = new FileStream(path, FileMode.Create, FileAccess.Write);
            stream.CopyTo(fileStream);
            fileStream.Dispose();
        }

License

MIT

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 2,206 7/22/2022
1.0.0 443 7/21/2022