All Projects → RickStrahl → Westwind.htmlpackager

RickStrahl / Westwind.htmlpackager

A small utility class used to package HTML content into a self contained HTML document both as a single file, or a folder with all dependencies copied to local.

Programming Languages

csharp
926 projects

Projects that are alternatives of or similar to Westwind.htmlpackager

svelte-credit-card
A svelte component to render a credit card 💳
Stars: ✭ 30 (+11.11%)
Mutual labels:  package, mit
Stock.indicators
Stock indicator technical analysis library package for .NET. Send in historical price quotes and get back desired technical indicators. Nothing more. It can be used in any market analysis software using standard OHLCV price quotes for equities, commodities, forex, cryptocurrencies, and others. We had private trading algorithms, machine learning, and charting systems in mind when originally creating this community library. Current indicators include: Accumulation/Distribution Line (ADL), Aroon Oscillator, Arnaud Legoux Moving Average (ALMA), Average Directional Index (ADX), Average True Range (ATR), Awesome Oscillator (AO), Balance of Power (BOP), Beta Coefficient, Bollinger Bands®, Chaikin Money Flow (CMF), Chaikin Oscillator, Chandelier Exit, Choppiness Index (CHOP), Commodity Channel Index (CCI), ConnorsRSI, Correlation Coefficient, Donchian Channels, Double Exponential Moving Average (DEMA), Elder-ray Index, Exponential Moving Average (EMA), Force Index, Fractal Chaos Bands (FCB), Gator Oscillator, Heikin-Ashi, Hull Moving Average (HMA), Ichimoku Cloud, Kaufman's Adaptive Moving Average (KAMA), KDJ Index, Keltner Channels, Momentum Oscillator, Money Flow Index (MFI), MESA Adaptive Moving Averages (MAMA), Moving Average Convergence/Divergence (MACD), Moving Average Envelopes, On-balance Volume (OBV), Parabolic SAR (stop and reverse), Percentage Volume Oscillator (PVO), Pivot Points and Rolling Pivot Points, Price Channels, Price (Comparative) Relative Strength (PRS), Price Momentum Oscillator (PMO), Rate of Change (ROC), Relative Strength Index (RSI), R-Squared (Coefficient of Determination), Simple Moving Average (SMA), Slope and Linear Regression, Smoothed Moving Average (SMMA), Standard Deviation, Stoller Average Range Channel (STARC) Bands, Stochastic Oscillator, Stochastic RSI, SuperTrend, Tillson T3 Moving Average, Triple Exponential Moving Average (TEMA), Triple EMA Oscillator (TRIX), True Strength Index (TSI), Ulcer Index, Ultimate Oscillator, Volume Simple Moving Average, Volume Weighted Average Price (VWAP), Vortex Indicator (VI), Weighted Moving Average (WMA), Williams %R, Williams Alligator, Williams Fractal, and Zig Zag.
Stars: ✭ 157 (+481.48%)
Mutual labels:  package, dotnet-core
Awesome Dotnet Core
.NET Core库、工具、框架和软件的中文收录大全。 内容包括:库、工具、框架、模板引擎、身份认证、数据库、ORM框架、图片处理、文本处理、机器学习、日志、代码分析、教程等。
Stars: ✭ 929 (+3340.74%)
Mutual labels:  dotnet-core
Carter
Carter is framework that is a thin layer of extension methods and functionality over ASP.NET Core allowing code to be more explicit and most importantly more enjoyable.
Stars: ✭ 875 (+3140.74%)
Mutual labels:  dotnet-core
Pose
Replace any .NET method (including static and non-virtual) with a delegate
Stars: ✭ 855 (+3066.67%)
Mutual labels:  dotnet-core
Mysqlconnector
Async MySQL Connector for .NET and .NET Core
Stars: ✭ 942 (+3388.89%)
Mutual labels:  dotnet-core
Stl.fusion
Get real-time UI updates in Blazor apps and 10-1000x faster API responses with a novel approach to distributed reactive computing. Fusion brings computed observables and automatic dependency tracking from Knockout.js/MobX/Vue to the next level by enabling a single dependency graph span multiple servers and clients, including Blazor apps running in browser.
Stars: ✭ 858 (+3077.78%)
Mutual labels:  dotnet-core
Tidymv
Tidy Model Visualisation for Generalised Additive Models
Stars: ✭ 25 (-7.41%)
Mutual labels:  package
Laravel Tabler
Laravel Package for integrating Tabler template and this package is Laravel Mix friendly.
Stars: ✭ 20 (-25.93%)
Mutual labels:  package
Autotrader
The sample of BTC FX trading software for bitFlyer.
Stars: ✭ 9 (-66.67%)
Mutual labels:  dotnet-core
Awesome Microservices Netcore
💎 A collection of awesome training series, articles, videos, books, courses, sample projects, and tools for Microservices in .NET Core
Stars: ✭ 865 (+3103.7%)
Mutual labels:  dotnet-core
Weixinmpsdk
微信全平台 SDK Senparc.Weixin for C#,支持 .NET Framework 及 .NET Core、.NET 6.0。已支持微信公众号、小程序、小游戏、企业号、企业微信、开放平台、微信支付、JSSDK、微信周边等全平台。 WeChat SDK for C#.
Stars: ✭ 7,098 (+26188.89%)
Mutual labels:  dotnet-core
Cs.2click
🔊 A Better Audio Router for a Modular System.
Stars: ✭ 7 (-74.07%)
Mutual labels:  package
Swipeformore
Manage Cydia packages via swipe.
Stars: ✭ 11 (-59.26%)
Mutual labels:  package
Lettuceencrypt
Free, automatic HTTPS certificate generation for ASP.NET Core web apps
Stars: ✭ 939 (+3377.78%)
Mutual labels:  dotnet-core
Atom Annotations
Atom package that shows annotations (e.g. for overriden methods interface implementations) in your PHP source code.
Stars: ✭ 14 (-48.15%)
Mutual labels:  package
Warc
Golang WARC (Web ARChive) Library
Stars: ✭ 25 (-7.41%)
Mutual labels:  package
Atom Modular Snippets
:atom: A modular solution to snippets in @Atom.
Stars: ✭ 8 (-70.37%)
Mutual labels:  package
Convertpcltocore
17 Steps to Convert your PCL to .NET Standard
Stars: ✭ 10 (-62.96%)
Mutual labels:  dotnet-core
Rocket.chat
The communications platform that puts data protection first.
Stars: ✭ 31,251 (+115644.44%)
Mutual labels:  mit

Westwind.HtmlPackager

HtmlPackager is a tiny standalone Windows Exe or .NET component that allows you to package content from a URL as a self-contained, local HTML file or package of files that can be saved and viewed offline.

The packager can create:

  • A single, large self-contained HTML File
  • An HTML file with external, local assets
  • A Zip package of the latter file and folder assets

This library is provided as a .NET Library, a small Windows .NET 4.5 Cosole executable and a cross-platform .NET SDK Tool:

The packager works with:

  • Web Urls
  • Local HTML Files

There are two packaging modes:

  • Package to a single file
    All related resources are downloaded and embedded into the HTML content. CSS is embedded as text while images, scripts and url resources are embedded as base64 data links. The result is one very large HTML document that contains all resources embedded.

  • HTML file plus loose Resource Files
    Produces an HTML file plus all CSS, Script, images, fonts as loose files stored in the same folder as the HTML. An option also allows packaging the folder as a Zip file.

.NET Library

The .NET library allows embedding of the packaging functionality into your own applicaitons. It is very small and self-contained and can be easily added to another project with two source files, or you can use NuGet to include the binaries. The library has an external dependency on HtmlAgilityPack for HTML parsing.

Supported .NET Targets:

  • .NET 4.5+
  • .NET Standard 2.0

Standalone Command Line Tools

There are a also a small Windows .NET 4.5 Cosole executable and as a cross-platform .NET SDK Tool that allow you to run this tool from the command line.

HtmlPackager Windows Console Application

The HTML Packager is available as a self contained Windows Console application (ILMerged single file EXE) in HtmlPackager.exe which you can download and copy as needed.

Alternately you can also use the Chocolatey package:

choco install HtmlPackager

Cross Platform .NET SDK Global Tool

You can also install the cross-platform the dotnet-htmlpackager Nuget package that installs as a .NET SDK Global tool that can be globally executed as htmlpackager once installed on Windows, Mac and Linux as long as you have the .NET SDK 2.1 or later installed.

To install the tool:

dotnet tool install -g dotnet-htmlpackager

To uninstall

dotnet tool uninstall -g dotnet-htmlpackager

Command Line Options

The tool allows for a number of command line options to determine how output is returned from a URL.

Syntax:
-------
HtmlPackager <sourceUrl> -o <outputFile> [-x|-z] -d

Commands:
---------
HELP || /?          This help display           

Options:
--------
sourceUrl           Source Url or local file to an HTML document
-o <outputFile>     Output HTML file or Zip file (-z)
                    (if output file is not provided output is sent to StdOut)                                       
-x                  Create external dependencies in folder of HTML document
-z                  Create zip file with all dependencies included in zip
-d                  Display generated HTML page or Zip file

Examples

The following are a few examples you can try to capture output.

Create a single self-contained HTML document from a URL and display in your browser:

HtmlPackager  https://markdownmonster.west-wind.com  -o c:\temp\mm-output.html -d

Create an HTML file from a URL with all dependencies stored as loose files in the output file's folder (-x) and display in your browser (-d):

HtmlPackager  https://weblog.west-wind.com -o c:\temp\west-wind.html -x -d

Create a self-contained HTML file from a local HTML file:

HtmlPackager  %userprofile%\Documents\myapp\somePage.html -o %TEMP%\app_saved.html

Note that environment variables in paths are autoexpanded - use whatever syntax is appropriate for your OS.

Package to a Zip file:

HtmlPackager  https://github.com -o c:\temp\github-home.zip -z -d

.NET Library and C# Source Code

The packager is also avalailable as a NuGet package you can add to your project.

Installation via NuGet

You can install this library from NuGet:

install-package Westwind.HtmlPackager

or

dotnet add package Westwind.HtmlPackager

Usage

The following are various usage examples for packaging HTML from files or Web URLs into the two package formats.

Capture HTML File to embedded HTML as String

The following captures the HTML to a single file string from a local file on disk:

var inputFile = Path.Combine(Path.GetTempPath(), "_MarkdownMonster_Preview.html");
var packager = new HtmlPackager();
string packaged = packager.PackageHtml(inputFile);

string outputFile = InputFile.Replace(".html", "_PACKAGED.html");

File.WriteAllText(outputFile, packaged);

Console.WriteLine(packaged);

Capture HTML File to embedded HTML as File

var inputFile = Path.Combine(Path.GetTempPath(), "_MarkdownMonster_Preview.html");
string outputFile = InputFile.Replace(".html", "_PACKAGED.html");

var packager = new HtmlPackager();
string packaged = packager.PackageHtmlToFile(inputFile,outputFile);


// display html in browser
Utils.GoUrl(outputFile);

Capture Web Url to single File

var packager = new HtmlPackager();
string packaged = packager.PackageHtml("https://west-wind.com");

string outputFile = InputFile.Replace(".html", "_PACKAGED.html");
File.WriteAllText(outputFile, packaged);

ShellUtils.GoUrl(outputFile);

Capture File to HTML File + Loose Resources

var packager = new HtmlPackager();
string outputFile = @"c:\temp\GeneratedHtml\Output.html";
bool result = packager.PackageHtmlToFolder(@"c:\temp\tmpFiles\_MarkdownMonster_Preview.html", outputFile,
    null, true);
Assert.IsTrue(result);

// Display html in browser
Utils.GoUrl(outputFile);

Capture Web Url to HTML File + Loose Resources

var packager = new HtmlPackager();
string outputFile = @"c:\temp\GeneratedHtml\Output.html";
bool result = packager.PackageHtmlToFolder("http://west-wind.com/", outputFile, null, true);

ShellUtils.GoUrl(outputFile);

License

The Westwind.HtmlPackager library is license under the MIT License and there's no charge to use, integrate or modify the code for this project. You are free to use it in personal, commercial, government and any other type of application.

All source code is copyright West Wind Technologies, regardless of changes made to them. Any source code modifications must leave the original copyright code headers intact.

It's free as in free beer, but if this saved you some time and you're overflowing with gratitude you can buy me a beer:

Make a Donation with PayPal

Warranty Disclaimer: No Warranty!

IN NO EVENT SHALL THE AUTHOR, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS PROGRAM AND DOCUMENTATION, BE LIABLE FOR ANY COMMERCIAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM INCLUDING, BUT NOT LIMITED TO, LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR LOSSES SUSTAINED BY THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS, EVEN IF YOU OR OTHER PARTIES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].