diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..9335d30d9 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,131 @@ +name: Build, Package & Publish + +on: [push, pull_request, workflow_dispatch] + +env: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + NuGetDirectory: ${{ github.workspace }}/nuget + +defaults: + run: + shell: pwsh + +jobs: + build: + name: ${{ matrix.platform.name }} ${{ matrix.dotnet.name }} + runs-on: ${{ matrix.platform.os }} + permissions: + id-token: write + + strategy: + fail-fast: false + matrix: + platform: + - { name: Windows x64, os: windows-2025-vs2026 } + - { name: Ubuntu x64, os: ubuntu-24.04 } + - { name: macOS arm64, os: macos-15 } + dotnet: + - { name: .NET 8, version: '8.0.x' } + - { name: .NET 9, version: '9.0.x' } + - { name: .NET 10, version: '10.0.x' } + + steps: + - name: Checkout HTML Renderer + uses: actions/checkout@v7 + + - name: Setup .NET ${{ matrix.dotnet.version }} SDK + id: setup-dotnet + uses: actions/setup-dotnet@v6 + with: + dotnet-version: ${{ matrix.dotnet.version }} + - name: Enforce SDK Version + run: dotnet new globaljson --sdk-version ${{ steps.setup-dotnet.outputs.dotnet-version }} --force + - name: Verify SDK Installation + run: dotnet --info + + - name: Select build target + id: build-target + run: | + # HtmlRenderer.WinUI/HtmlRenderer.Demo.WinUI (Windows App SDK/Win2D, MSIX PRI generation via + # native makepri.exe/makeappx.exe) can only build on Windows - unlike the WinForms/WPF adapters, + # which cross-compile cleanly everywhere via EnableWindowsTargeting's reference-assembly story, + # there is no non-Windows equivalent for those native tools at all. Non-Windows runners build a + # solution filter excluding just those two projects; everything else still builds and tests + # identically on every OS. + $target = $IsWindows ? "Source/HtmlRenderer.sln" : "Source/HtmlRenderer.CrossPlatform.slnf" + echo "path=$target" >> $env:GITHUB_OUTPUT + + - name: Restore Dependencies + run: dotnet restore ${{ steps.build-target.outputs.path }} + + - name: Build + run: dotnet build ${{ steps.build-target.outputs.path }} --configuration Release --no-restore + + - name: Run Tests + if: runner.os == 'Windows' + run: dotnet test Source/HtmlRenderer.sln --configuration Release --no-build --logger trx --results-directory ${{ github.workspace }}/TestResults + env: + PDF_OUTPUT_DIRECTORY: ${{ github.workspace }}/pdf-artifacts/${{ matrix.platform.name }}-${{ matrix.dotnet.name }} + HTML_RENDERER_REGRESSION_OUTPUT_DIRECTORY: ${{ github.workspace }}/image-regression/${{ matrix.platform.name }}-${{ matrix.dotnet.name }} + + - name: Run Tests + if: runner.os != 'Windows' + run: | + $failed = $false + Get-ChildItem -Path Source/Test -Recurse -Filter *.Test.csproj | ForEach-Object { + dotnet test $_.FullName --configuration Release --no-build --logger trx --results-directory ${{ github.workspace }}/TestResults + if ($LASTEXITCODE -ne 0) { $failed = $true } + } + if ($failed) { exit 1 } + env: + PDF_OUTPUT_DIRECTORY: ${{ github.workspace }}/pdf-artifacts/${{ matrix.platform.name }}-${{ matrix.dotnet.name }} + + - name: Create HtmlRenderer.Core NuGet package + run: dotnet pack Source/HtmlRenderer/HtmlRenderer.csproj --configuration Release --include-symbols -p:SymbolPackageFormat=snupkg --no-build --verbosity normal --output ${{ env.NuGetDirectory }} + + - name: Create HtmlRenderer.PdfSharp NuGet package + run: dotnet pack Source/HtmlRenderer.PdfSharp/HtmlRenderer.PdfSharp.csproj --configuration Release --include-symbols -p:SymbolPackageFormat=snupkg --no-build --verbosity normal --output ${{ env.NuGetDirectory }} + + - name: Create HtmlRenderer.WinForms NuGet package + run: dotnet pack Source/HtmlRenderer.WinForms/HtmlRenderer.WinForms.csproj --configuration Release --include-symbols -p:SymbolPackageFormat=snupkg --no-build --verbosity normal --output ${{ env.NuGetDirectory }} + + - name: Create HtmlRenderer.WPF NuGet package + run: dotnet pack Source/HtmlRenderer.WPF/HtmlRenderer.WPF.csproj --configuration Release --include-symbols -p:SymbolPackageFormat=snupkg --no-build --verbosity normal --output ${{ env.NuGetDirectory }} + + - name: Upload NuGet package artifacts + uses: actions/upload-artifact@v7 + with: + name: "HTML Renderer (${{ matrix.platform.name }} ${{ matrix.dotnet.name }})" + path: ${{ env.NuGetDirectory }}/*.*nupkg + + - name: Upload PDF artifacts + if: always() + uses: actions/upload-artifact@v7 + with: + name: "PDF artifacts (${{ matrix.platform.name }} ${{ matrix.dotnet.name }})" + path: ${{ github.workspace }}/pdf-artifacts/**/*.pdf + if-no-files-found: ignore + + - name: Upload image regression artifacts + if: always() + uses: actions/upload-artifact@v7 + with: + name: "Image regression artifacts (${{ matrix.platform.name }} ${{ matrix.dotnet.name }})" + path: ${{ github.workspace }}/image-regression/**/*.png + if-no-files-found: ignore + + - name: NuGet Login + if: startsWith(github.ref, 'refs/tags/') && matrix.dotnet.name == '.NET 8' && runner.os == 'Windows' + uses: NuGet/login@v1 + id: login + with: + user: eXpl0it3r + + - name: NuGet Push + if: startsWith(github.ref, 'refs/tags/') && matrix.dotnet.name == '.NET 8' && runner.os == 'Windows' + run: | + foreach ($file in (Get-ChildItem ${{ env.NuGetDirectory }} -Recurse -Include *.*nupkg)) { + dotnet nuget push $file --skip-duplicate --api-key ${{steps.login.outputs.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json + } diff --git a/.gitignore b/.gitignore index ce3a150ad..aa314ccc9 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,9 @@ # mstest test results TestResults +# Rider +.idea/ + ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. @@ -36,6 +39,7 @@ x64/ *.vspscc *.vssscc .builds +.vs/ # Visual C++ cache files ipch/ diff --git a/Build/0 full.bat b/Build/0 full.bat deleted file mode 100644 index cd285a2bf..000000000 --- a/Build/0 full.bat +++ /dev/null @@ -1,57 +0,0 @@ -@echo off - -CD %~dp0 - - -echo. -echo. -echo - DELETE RELEASE FOLDER.. -rmdir Release /s /q - -echo. -echo. -echo - RUN LIBS BUILD... -echo. -CALL "1 build libs.bat" - -echo. -echo. -echo - RUN DEMO BUILD... -echo. -CALL "2 build demo.bat" - -echo. -echo. -set /p ask=- Builds complete, continue? (y/n) -if %ask%==n goto end - -echo. -echo. -echo - RUN ARCHIVE... -echo. -CALL "3 archive.bat" - -echo. -echo. -echo - RUN NUGET PACK... -echo. -CALL "4 pack nuget.bat" - - -echo. -echo. -echo - REMOVE FILES... -rmdir Release\Source /s /q -rmdir Release\Core /s /q -rmdir Release\WinForms /s /q -rmdir Release\WPF /s /q -rmdir Release\Mono /s /q -rmdir Release\PdfSharp /s /q -del "Release\*.exe" - - -:end -echo. -echo. -echo - FINISHED -pause \ No newline at end of file diff --git a/Build/1 build libs.bat b/Build/1 build libs.bat deleted file mode 100644 index 55b848afd..000000000 --- a/Build/1 build libs.bat +++ /dev/null @@ -1,103 +0,0 @@ -@echo off - -CD %~dp0 - -echo Set params... -set verb=/verbosity:minimal - -set msbuild=C:\Windows\Microsoft.Net\Framework\v4.0.30319\MSBuild.exe - -set c_proj=..\Source\HtmlRenderer\HtmlRenderer.csproj -set wf_proj=..\Source\HtmlRenderer.WinForms\HtmlRenderer.WinForms.csproj -set wpf_proj=..\Source\HtmlRenderer.WPF\HtmlRenderer.WPF.csproj -set pdfs_proj=..\Source\HtmlRenderer.PdfSharp\HtmlRenderer.PdfSharp.csproj - -set c_rel=Release\Core -set wf_rel=Release\WinForms -set wpf_rel=Release\WPF -set mono_rel=Release\Mono -set pdfs_rel=Release\PdfSharp - -set c_out=..\..\Build\%c_rel% -set wf_out=..\..\Build\%wf_rel% -set wpf_out=..\..\Build\%wpf_rel% -set mono_out=..\..\Build\%mono_rel% -set pdfs_out=..\..\Build\%pdfs_rel% - -set t_20=Configuration=Release;TargetFrameworkVersion=v2.0 -set t_30=Configuration=Release;TargetFrameworkVersion=v3.0 -set t_35=Configuration=Release;TargetFrameworkVersion=v3.5;TargetFrameworkProfile=client -set t_40=Configuration=Release;TargetFrameworkVersion=v4.0;TargetFrameworkProfile=client -set t_45=Configuration=Release;TargetFrameworkVersion=v4.5 - -set t_mono_20=%t_20%;DefineConstants=MONO -set t_mono_35=%t_35%;DefineConstants=MONO -set t_mono_40=%t_40%;DefineConstants=MONO -set t_mono_45=%t_45%;DefineConstants=MONO - - -echo. -echo. -echo - BUILD Core... -echo. -%msbuild% %c_proj% /t:rebuild /p:%t_20%;OutputPath=%c_out%\NET20 %verb% -%msbuild% %c_proj% /t:rebuild /p:%t_30%;OutputPath=%c_out%\NET30 %verb% -%msbuild% %c_proj% /t:rebuild /p:%t_35%;OutputPath=%c_out%\NET35 %verb% -%msbuild% %c_proj% /t:rebuild /p:%t_40%;OutputPath=%c_out%\NET40 %verb% -%msbuild% %c_proj% /t:rebuild /p:%t_45%;OutputPath=%c_out%\NET45 %verb% - -echo. -echo. -echo - BUILD WinForms... -echo. -%msbuild% %wf_proj% /t:rebuild /p:%t_20%;OutputPath=%wf_out%_t\NET20 %verb% -%msbuild% %wf_proj% /t:rebuild /p:%t_35%;OutputPath=%wf_out%_t\NET35 %verb% -%msbuild% %wf_proj% /t:rebuild /p:%t_40%;OutputPath=%wf_out%_t\NET40 %verb% -%msbuild% %wf_proj% /t:rebuild /p:%t_45%;OutputPath=%wf_out%_t\NET45 %verb% -xcopy %wf_rel%_t\NET20\HtmlRenderer.WinForms.* %wf_rel%\NET20 /I -xcopy %wf_rel%_t\NET35\HtmlRenderer.WinForms.* %wf_rel%\NET35 /I -xcopy %wf_rel%_t\NET40\HtmlRenderer.WinForms.* %wf_rel%\NET40 /I -xcopy %wf_rel%_t\NET45\HtmlRenderer.WinForms.* %wf_rel%\NET45 /I -rmdir %wf_rel%_t /s /q - -echo. -echo. -echo - BUILD WPF... -echo. -%msbuild% %wpf_proj% /t:rebuild /p:%t_30%;OutputPath=%wpf_out%_t\NET30 %verb% -%msbuild% %wpf_proj% /t:rebuild /p:%t_35%;OutputPath=%wpf_out%_t\NET35 %verb% -%msbuild% %wpf_proj% /t:rebuild /p:%t_40%;OutputPath=%wpf_out%_t\NET40 %verb% -%msbuild% %wpf_proj% /t:rebuild /p:%t_45%;OutputPath=%wpf_out%_t\NET45 %verb% -xcopy %wpf_rel%_t\NET30\HtmlRenderer.WPF.* %wpf_rel%\NET30 /I -xcopy %wpf_rel%_t\NET35\HtmlRenderer.WPF.* %wpf_rel%\NET35 /I -xcopy %wpf_rel%_t\NET40\HtmlRenderer.WPF.* %wpf_rel%\NET40 /I -xcopy %wpf_rel%_t\NET45\HtmlRenderer.WPF.* %wpf_rel%\NET45 /I -rmdir %wpf_rel%_t /s /q - -echo. -echo. -echo - BUILD Mono... -echo. -%msbuild% %wf_proj% /t:rebuild /p:%t_mono_20%;OutputPath=%mono_out%_t\NET20 %verb% -%msbuild% %wf_proj% /t:rebuild /p:%t_mono_35%;OutputPath=%mono_out%_t\NET35 %verb% -%msbuild% %wf_proj% /t:rebuild /p:%t_mono_40%;OutputPath=%mono_out%_t\NET40 %verb% -%msbuild% %wf_proj% /t:rebuild /p:%t_mono_45%;OutputPath=%mono_out%_t\NET45 %verb% -xcopy %mono_rel%_t\NET20\HtmlRenderer.WinForms.* %mono_rel%\NET20 /I -xcopy %mono_rel%_t\NET35\HtmlRenderer.WinForms.* %mono_rel%\NET35 /I -xcopy %mono_rel%_t\NET40\HtmlRenderer.WinForms.* %mono_rel%\NET40 /I -xcopy %mono_rel%_t\NET45\HtmlRenderer.WinForms.* %mono_rel%\NET45 /I -rmdir %mono_rel%_t /s /q - -echo. -echo. -echo - BUILD PdfSharp... -echo. -%msbuild% %pdfs_proj% /t:rebuild /p:%t_20%;OutputPath=%pdfs_out%_t\NET20 %verb% -%msbuild% %pdfs_proj% /t:rebuild /p:%t_35%;OutputPath=%pdfs_out%_t\NET35 %verb% -%msbuild% %pdfs_proj% /t:rebuild /p:%t_40%;OutputPath=%pdfs_out%_t\NET40 %verb% -%msbuild% %pdfs_proj% /t:rebuild /p:%t_45%;OutputPath=%pdfs_out%_t\NET45 %verb% -xcopy %pdfs_rel%_t\NET20\HtmlRenderer.PdfSharp.* %pdfs_rel%\NET20 /I -xcopy %pdfs_rel%_t\NET35\HtmlRenderer.PdfSharp.* %pdfs_rel%\NET35 /I -xcopy %pdfs_rel%_t\NET40\HtmlRenderer.PdfSharp.* %pdfs_rel%\NET40 /I -xcopy %pdfs_rel%_t\NET45\HtmlRenderer.PdfSharp.* %pdfs_rel%\NET45 /I -rmdir %pdfs_rel%_t /s /q \ No newline at end of file diff --git a/Build/2 build demo.bat b/Build/2 build demo.bat deleted file mode 100644 index 61310b3f7..000000000 --- a/Build/2 build demo.bat +++ /dev/null @@ -1,36 +0,0 @@ -@echo off - -CD %~dp0 - -set verb=/verbosity:minimal -set msbuild=C:\Windows\Microsoft.Net\Framework\v4.0.30319\MSBuild.exe - -set t_20=Configuration=Release;TargetFrameworkVersion=v2.0 -set t_40=Configuration=Release;TargetFrameworkVersion=v4.0;TargetFrameworkProfile=client -set t_mono_20=%t_20%;DefineConstants=MONO - -echo. -echo. -echo - BUILD WinForms... -echo. -%msbuild% ..\Source\Demo\WinForms\HtmlRenderer.Demo.WinForms.csproj /t:rebuild /p:%t_20%;OutputPath=..\..\..\Build\Release\Demo\WinForms %verb% - -echo. -echo. -echo - BUILD Mono... -echo. - -%msbuild% ..\Source\Demo\WinForms\HtmlRenderer.Demo.WinForms.csproj /t:rebuild /p:%t_mono_20%;OutputPath=..\..\..\Build\Release\Demo\Mono %verb% - -echo. -echo. -echo - BUILD WPF... -echo. -%msbuild% ..\Source\Demo\WPF\HtmlRenderer.Demo.WPF.csproj /t:rebuild /p:%t_40%;OutputPath=..\..\..\Build\Release\Demo\WPF %verb% - -echo. -echo - Handle outputs... -copy Release\Demo\WinForms\HtmlRendererWinFormsDemo.exe "Release\HtmlRenderer WinForms Demo.exe" -copy Release\Demo\Mono\HtmlRendererWinFormsDemo.exe "Release\HtmlRenderer Mono Demo.exe" -copy Release\Demo\WPF\HtmlRendererWpfDemo.exe "Release\HtmlRenderer WPF Demo.exe" -rmdir Release\Demo /s /q diff --git a/Build/3 archive.bat b/Build/3 archive.bat deleted file mode 100644 index 033aac66a..000000000 --- a/Build/3 archive.bat +++ /dev/null @@ -1,24 +0,0 @@ -@echo off - -CD %~dp0 - -echo. -echo - Get version... -for /f %%i in ('getVer.exe ..\Source\SharedAssemblyInfo.cs') do set version=%%i -echo Version: %version% - -echo. -echo. -echo - Git clone... -echo. -"C:\Program Files (x86)\Git\bin\git.exe" clone -q --branch=v1.5 https://github.com/ArthurHub/HTML-Renderer.git Release\git -xcopy Release\git\Source Release\Source /I /E -rmdir Release\git /s /q - -echo. -echo. -echo - Create archive... -echo. -cd Release -..\7za.exe a "HtmlRenderer %version%.zip" ** -cd.. diff --git a/Build/4 pack nuget.bat b/Build/4 pack nuget.bat deleted file mode 100644 index d934fd303..000000000 --- a/Build/4 pack nuget.bat +++ /dev/null @@ -1,18 +0,0 @@ -@echo off - -CD %~dp0 - -echo. -echo - Get version... -for /f %%i in ('getVer.exe ..\Source\SharedAssemblyInfo.cs') do set version=%%i -echo Version: %version% - -echo. -echo. -echo - Pack NuGets... -echo. -nuget.exe pack NuGet\HtmlRenderer.Core.nuspec -Version %version% -OutputDirectory Release -nuget.exe pack NuGet\HtmlRenderer.WinForms.nuspec -Version %version% -OutputDirectory Release -nuget.exe pack NuGet\HtmlRenderer.WPF.nuspec -Version %version% -OutputDirectory Release -nuget.exe pack NuGet\HtmlRenderer.Mono.nuspec -Version %version% -OutputDirectory Release -nuget.exe pack NuGet\HtmlRenderer.PdfSharp.nuspec -Version %version% -OutputDirectory Release \ No newline at end of file diff --git a/Build/7za.exe b/Build/7za.exe deleted file mode 100644 index 7f6bf86bc..000000000 Binary files a/Build/7za.exe and /dev/null differ diff --git a/Build/NuGet.exe b/Build/NuGet.exe deleted file mode 100644 index 3ffdd33c6..000000000 Binary files a/Build/NuGet.exe and /dev/null differ diff --git a/Build/NuGet/HtmlRenderer.Core.nuspec b/Build/NuGet/HtmlRenderer.Core.nuspec deleted file mode 100644 index 25e8783ea..000000000 --- a/Build/NuGet/HtmlRenderer.Core.nuspec +++ /dev/null @@ -1,38 +0,0 @@ - - - - HtmlRenderer.Core - 0.0.0.1 - HTML Renderer Core - Arthur Teplitzki - Arthur Teplitzki - https://htmlrenderer.codeplex.com/license - https://htmlrenderer.codeplex.com/ - https://github.com/ArthurHub/HTML-Renderer/blob/master/html.ico?raw=true - false - - Cross framework (WinForms/WPF/PDF/Metro/Mono/etc.), Multipurpose (UI Controls / Image generation / PDF generation / etc.), 100% managed (C#), High performance HTML Rendering library. - - - Cross framework (WinForms/WPF/PDF/Metro/Mono/etc.), Multipurpose (UI Controls / Image generation / PDF generation / etc.), 100% managed (C#), High performance HTML Rendering library. - - The Core assembly of HTML Renderer does not bound to any rendering framework (WinForms/WPF/PDF/etc.). - Can be used to create framework specific renderer using adapter extensibility object model. - For existing implementations see: HtmlRenderer.WinForms, HtmlRenderer.WPF and HtmlRenderer.PdfSharp. - - See http://htmlrenderer.codeplex.com/releases. - html render renderer draw core - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Build/NuGet/HtmlRenderer.Mono.nuspec b/Build/NuGet/HtmlRenderer.Mono.nuspec deleted file mode 100644 index 11840a00c..000000000 --- a/Build/NuGet/HtmlRenderer.Mono.nuspec +++ /dev/null @@ -1,56 +0,0 @@ - - - - HtmlRenderer.Mono - 0.0.0.1 - HTML Renderer for Mono - Arthur Teplitzki - Arthur Teplitzki - https://htmlrenderer.codeplex.com/license - https://htmlrenderer.codeplex.com/ - https://github.com/ArthurHub/HTML-Renderer/blob/master/html.ico?raw=true - false - - Multipurpose (UI Controls / Image generation), 100% managed (C#), High performance HTML Rendering library for Mono. - - - Multipurpose (UI Controls / Image generation), 100% managed (C#), High performance HTML Rendering library for Mono. - - HTML UI in .NET Mono applications using controls or static rendering. - - Features and Benefits: - --- - * Controls: HtmlPanel, HtmlLabel, HtmlToolTip. - * Create images from HTML snippets. - * 100% managed code and no external dependencies, no ActiveX, no MSHTML. - * Extensive HTML 4.01 and CSS level 2 specifications support. - * Support separating CSS from HTML by loading stylesheet code separately. - * Support text selection, copy-paste and context menu. - * Handles "real world" malformed HTML, it doesn't have to be XHTML. - * Supports .NET 2.0 or higher including Client Profile. - * Lightweight, only two DLLs (~300K). - * High performance and low memory footprint. - * Extendable and configurable. - - See http://htmlrenderer.codeplex.com/releases. - html render renderer draw control winforms mono - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Build/NuGet/HtmlRenderer.Mono.readme.txt b/Build/NuGet/HtmlRenderer.Mono.readme.txt deleted file mode 100644 index 81bc1c0d2..000000000 --- a/Build/NuGet/HtmlRenderer.Mono.readme.txt +++ /dev/null @@ -1,50 +0,0 @@ - -********** Welcome to the HTML Renderer WinForms library! ***************************************** - -This library provides the rich formatting power of HTML in Mono .NET applications using -simple controls or static rendering code. -For more info see HTML Renderer on CodePlex: http://htmlrenderer.codeplex.com - -********** DEMO APPLICATION *********************************************************************** - -HTML Renderer Demo application showcases HTML Renderer capabilities, use it to explore and learn -on the library: http://htmlrenderer.codeplex.com/wikipage?title=Demo%20application - -********** FEEDBACK / RELEASE NOTES *************************************************************** - -If you have problems, wish to report a bug, or have a suggestion please start a thread on -HTML Renderer discussions page: http://htmlrenderer.codeplex.com/discussions - -For full release notes and all versions see: http://htmlrenderer.codeplex.com/releases - -********** QUICK START **************************************************************************** - -For more Quick Start see: https://htmlrenderer.codeplex.com/wikipage?title=Quick%20start - -*************************************************************************************************** -********** Quick Start: Use HTML panel control on WinForms form - -public partial class Form1 : Form -{ - public Form1() - { - InitializeComponent(); - - TheArtOfDev.HtmlRenderer.WinForms.HtmlPanel htmlPanel = new TheArtOfDev.HtmlRenderer.WinForms.HtmlPanel(); - htmlPanel.Text = "

Hello World

This is html rendered text

"; - htmlPanel.Dock = DockStyle.Fill; - Controls.Add(htmlPanel); - } -} - -*************************************************************************************************** -********** Quick Start: Create image from HTML snippet - -class Program -{ - private static void Main(string[] args) - { - Image image = TheArtOfDev.HtmlRenderer.WinForms.HtmlRender.RenderToImageGdiPlus("

Hello World

This is html rendered text

"); - image.Save("image.png", ImageFormat.Png); - } -} diff --git a/Build/NuGet/HtmlRenderer.PdfSharp.nuspec b/Build/NuGet/HtmlRenderer.PdfSharp.nuspec deleted file mode 100644 index 84e5efada..000000000 --- a/Build/NuGet/HtmlRenderer.PdfSharp.nuspec +++ /dev/null @@ -1,52 +0,0 @@ - - - - HtmlRenderer.PdfSharp - 0.0.0.1 - HTML Renderer for PDF using PdfSharp - Arthur Teplitzki - Arthur Teplitzki - https://htmlrenderer.codeplex.com/license - https://htmlrenderer.codeplex.com/ - https://github.com/ArthurHub/HTML-Renderer/blob/master/html.ico?raw=true - false - - PDF document generator from HTML snippet, 100% managed (C#), High performance library using PdfSharp. - - - PDF document generator from HTML snippet, 100% managed (C#), High performance library using PdfSharp. - - Features and Benefits: - --- - * 100% managed code depends only on PdfSharp library, no ActiveX, no MSHTML. - * Extensive HTML 4.01 and CSS level 2 specifications support. - * Support separating CSS from HTML by loading stylesheet code separately. - * Handles "real world" malformed HTML, it doesn't have to be XHTML. - * Supports .NET 2.0 or higher including Client Profile. - * Lightweight, only two DLLs (~300K). - * High performance and low memory footprint. - * Extendable and configurable. - - See http://htmlrenderer.codeplex.com/releases. - html render renderer draw pdfsharp - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Build/NuGet/HtmlRenderer.PdfSharp.readme.txt b/Build/NuGet/HtmlRenderer.PdfSharp.readme.txt deleted file mode 100644 index 97a66b14d..000000000 --- a/Build/NuGet/HtmlRenderer.PdfSharp.readme.txt +++ /dev/null @@ -1,33 +0,0 @@ - -********** Welcome to the HTML Renderer PdfSharp library! ***************************************** - -This library provides the ability to generate PDF documents from HTML snippets using static rendering code. -For more info see HTML Renderer on CodePlex: http://htmlrenderer.codeplex.com - -********** DEMO APPLICATION *********************************************************************** - -HTML Renderer Demo application showcases HTML Renderer capabilities, use it to explore and learn -on the library: http://htmlrenderer.codeplex.com/wikipage?title=Demo%20application - -********** FEEDBACK / RELEASE NOTES *************************************************************** - -If you have problems, wish to report a bug, or have a suggestion please start a thread on -HTML Renderer discussions page: http://htmlrenderer.codeplex.com/discussions - -For full release notes and all versions see: http://htmlrenderer.codeplex.com/releases - -********** QUICK START **************************************************************************** - -For more Quick Start see: https://htmlrenderer.codeplex.com/wikipage?title=Quick%20start - -*************************************************************************************************** -********** Quick Start: Create PDF from HTML snippet using PdfSharp - -class Program -{ - private static void Main(string[] args) - { - PdfDocument pdf = PdfGenerator.GeneratePdf("

Hello World

This is html rendered text

", PageSize.A4); - pdf.Save("document.pdf"); - } -} diff --git a/Build/NuGet/HtmlRenderer.WPF.nuspec b/Build/NuGet/HtmlRenderer.WPF.nuspec deleted file mode 100644 index f3b20bcee..000000000 --- a/Build/NuGet/HtmlRenderer.WPF.nuspec +++ /dev/null @@ -1,55 +0,0 @@ - - - - HtmlRenderer.WPF - 0.0.0.1 - HTML Renderer for WPF - Arthur Teplitzki - Arthur Teplitzki - https://htmlrenderer.codeplex.com/license - https://htmlrenderer.codeplex.com/ - https://github.com/ArthurHub/HTML-Renderer/blob/master/html.ico?raw=true - false - - Multipurpose (UI Controls / Image generation), 100% managed (C#), High performance HTML Rendering library for WPF. - - - Multipurpose (UI Controls / Image generation), 100% managed (C#), High performance HTML Rendering library for WPF. - - HTML UI in .NET WPF applications using controls or static rendering. - - Features and Benefits: - --- - * Controls: HtmlPanel, HtmlLabel. - * Create images from HTML snippets. - * 100% managed code and no external dependencies, no ActiveX, no MSHTML. - * Extensive HTML 4.01 and CSS level 2 specifications support. - * Support separating CSS from HTML by loading stylesheet code separately. - * Support text selection, copy-paste and context menu. - * Handles "real world" malformed HTML, it doesn't have to be XHTML. - * Supports .NET 3.0 or higher including Client Profile. - * Lightweight, only two DLLs (~300K). - * High performance and low memory footprint. - * Extendable and configurable. - - See http://htmlrenderer.codeplex.com/releases. - html render renderer draw control WPF - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Build/NuGet/HtmlRenderer.WPF.readme.txt b/Build/NuGet/HtmlRenderer.WPF.readme.txt deleted file mode 100644 index 6d858ea66..000000000 --- a/Build/NuGet/HtmlRenderer.WPF.readme.txt +++ /dev/null @@ -1,50 +0,0 @@ - -********** Welcome to the HTML Renderer WPF library! ********************************************** - -This library provides the rich formatting power of HTML in your WPF .NET applications using -simple controls or static rendering code. -For more info see HTML Renderer on CodePlex: http://htmlrenderer.codeplex.com - -********** DEMO APPLICATION *********************************************************************** - -HTML Renderer Demo application showcases HTML Renderer capabilities, use it to explore and learn -on the library: http://htmlrenderer.codeplex.com/wikipage?title=Demo%20application - -********** FEEDBACK / RELEASE NOTES *************************************************************** - -If you have problems, wish to report a bug, or have a suggestion please start a thread on -HTML Renderer discussions page: http://htmlrenderer.codeplex.com/discussions - -For full release notes and all versions see: http://htmlrenderer.codeplex.com/releases - -********** QUICK START **************************************************************************** - -For more Quick Start see: https://htmlrenderer.codeplex.com/wikipage?title=Quick%20start - -*************************************************************************************************** -********** Quick Start: Use HTML panel control on WPF window - - - - - - - -*************************************************************************************************** -********** Quick Start: Create image from HTML snippet - -class Program -{ - private static void Main(string[] args) - { - BitmapFrame image = HtmlRender.RenderToImage("

Hello World

This is html rendered text

"); - var encoder = new PngBitmapEncoder(); - encoder.Frames.Add(image); - using (FileStream stream = new FileStream("image.png", FileMode.OpenOrCreate)) - encoder.Save(stream); - } -} diff --git a/Build/NuGet/HtmlRenderer.WinForms.nuspec b/Build/NuGet/HtmlRenderer.WinForms.nuspec deleted file mode 100644 index 37fcfe31b..000000000 --- a/Build/NuGet/HtmlRenderer.WinForms.nuspec +++ /dev/null @@ -1,56 +0,0 @@ - - - - HtmlRenderer.WinForms - 0.0.0.1 - HTML Renderer for WinForms - Arthur Teplitzki - Arthur Teplitzki - https://htmlrenderer.codeplex.com/license - https://htmlrenderer.codeplex.com/ - https://github.com/ArthurHub/HTML-Renderer/blob/master/html.ico?raw=true - false - - Multipurpose (UI Controls / Image generation), 100% managed (C#), High performance HTML Rendering library for WinForms. - - - Multipurpose (UI Controls / Image generation), 100% managed (C#), High performance HTML Rendering library for WinForms. - - HTML UI in .NET WinForms applications using controls or static rendering. - - Features and Benefits: - --- - * Controls: HtmlPanel, HtmlLabel, HtmlToolTip. - * Create images from HTML snippets. - * 100% managed code and no external dependencies, no ActiveX, no MSHTML. - * Extensive HTML 4.01 and CSS level 2 specifications support. - * Support separating CSS from HTML by loading stylesheet code separately. - * Support text selection, copy-paste and context menu. - * Handles "real world" malformed HTML, it doesn't have to be XHTML. - * Supports .NET 2.0 or higher including Client Profile. - * Lightweight, only two DLLs (~300K). - * High performance and low memory footprint. - * Extendable and configurable. - - See http://htmlrenderer.codeplex.com/releases. - html render renderer draw control winforms - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Build/NuGet/HtmlRenderer.WinForms.readme.txt b/Build/NuGet/HtmlRenderer.WinForms.readme.txt deleted file mode 100644 index 8c2fe704b..000000000 --- a/Build/NuGet/HtmlRenderer.WinForms.readme.txt +++ /dev/null @@ -1,50 +0,0 @@ - -********** Welcome to the HTML Renderer WinForms library! ***************************************** - -This library provides the rich formatting power of HTML in your WinForms .NET applications using -simple controls or static rendering code. -For more info see HTML Renderer on CodePlex: http://htmlrenderer.codeplex.com - -********** DEMO APPLICATION *********************************************************************** - -HTML Renderer Demo application showcases HTML Renderer capabilities, use it to explore and learn -on the library: http://htmlrenderer.codeplex.com/wikipage?title=Demo%20application - -********** FEEDBACK / RELEASE NOTES *************************************************************** - -If you have problems, wish to report a bug, or have a suggestion please start a thread on -HTML Renderer discussions page: http://htmlrenderer.codeplex.com/discussions - -For full release notes and all versions see: http://htmlrenderer.codeplex.com/releases - -********** QUICK START **************************************************************************** - -For more Quick Start see: https://htmlrenderer.codeplex.com/wikipage?title=Quick%20start - -*************************************************************************************************** -********** Quick Start: Use HTML panel control on WinForms form - -public partial class Form1 : Form -{ - public Form1() - { - InitializeComponent(); - - TheArtOfDev.HtmlRenderer.WinForms.HtmlPanel htmlPanel = new TheArtOfDev.HtmlRenderer.WinForms.HtmlPanel(); - htmlPanel.Text = "

Hello World

This is html rendered text

"; - htmlPanel.Dock = DockStyle.Fill; - Controls.Add(htmlPanel); - } -} - -*************************************************************************************************** -********** Quick Start: Create image from HTML snippet - -class Program -{ - private static void Main(string[] args) - { - Image image = TheArtOfDev.HtmlRenderer.WinForms.HtmlRender.RenderToImage("

Hello World

This is html rendered text

"); - image.Save("image.png", ImageFormat.Png); - } -} diff --git a/Build/getVer.exe b/Build/getVer.exe deleted file mode 100644 index 4e628a3b4..000000000 Binary files a/Build/getVer.exe and /dev/null differ diff --git a/LICENSE b/LICENSE index ecd7e0153..6b90a0b8d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ Copyright (c) 2009, José Manuel Menéndez Poo -Copyright (c) 2013, Arthur Teplitzki +Copyright (c) 2013-2026, Arthur Teplitzki All rights reserved. Redistribution and use in source and binary forms, with or without modification, diff --git a/README.md b/README.md index 5a21ca388..0a8553037 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,33 @@ -HTML Renderer [![Build status](https://ci.appveyor.com/api/projects/status/cm8xpf8ebt3hyi3e)](https://ci.appveyor.com/project/ArthurHub/html-renderer) -============= +# HTML Renderer -## Help Wanted -* Looking for a contributor(s) to take this project forward as I'm unable to continue supporting it. -* Contribute directly to the repository and update nuget packages. +**Cross framework** (WinForms/WPF/PDF/Metro/Mono/etc.), **Multipurpose** (UI Controls / Image generation / PDF generation / etc.), **100% managed** (C#), High performance HTML Rendering library. -#### Documentation, Discussion and Issue tracking is on [CodePlex](https://htmlrenderer.codeplex.com/). +The library is 100% managed **C#** code without any external dependencies (no WebBrowser control, ActiveX / COM or MSHTML dll), the only requirement is **.NET Standard 2.0 / .NET 8.0 or higher**. -**Cross framework** (WinForms/WPF/PDF/Metro/Mono/etc.), **Multipurpose** (UI Controls / Image generation / PDF generation / etc.), **100% managed** (C#), High performance HTML Rendering library. +![Renderer.png](https://raw.githubusercontent.com/ArthurHub/HTML-Renderer/master/Art/demo_winforms.png) -The library is 100% managed **C#** code without any external dependencies (no WebBrowser control, ActiveX / COM or MSHTML dll), the only requirement is **.NET 2.0 or higher**. -#### [Download](https://htmlrenderer.codeplex.com/releases/) the [Demo application](https://htmlrenderer.codeplex.com/wikipage?title=Demo%20application&referringTitle=Home) to explore HTML Renderer capabilities. +## Issues & Documentation + +For questions and issues, use the official [GitHub repository](https://github.com/ArthurHub/HTML-Renderer). + +For documentation, check out the project on the [CodePlex Archive](https://codeplexarchive.org/project/HtmlRenderer) or the [personal blog](https://theartofdev.com/tag/html-renderer/). + + +## Download + +The release packages on [GitHub](https://github.com/ArthurHub/HTML-Renderer/releases) also contain a Demo application to explore HML Renderer's capabilities. + +The latest NuGet packages can be found on NuGet.org: + +* [HtmlRenderer.WinForms](https://www.nuget.org/packages/HtmlRenderer.WinForms) +* [HtmlRenderer.WPF](https://www.nuget.org/packages/HtmlRenderer.WPF) +* [HtmlRenderer.PdfSharp](https://www.nuget.org/packages/HtmlRenderer.PdfSharp) +* [HtmlRenderer.Core](https://www.nuget.org/packages/HtmlRenderer.Core) -![Renderer.png](https://raw.githubusercontent.com/ArthurHub/HTML-Renderer/master/Art/demo_winforms.png) -### Features and Benefits +## Features and Benefits + * Extensive HTML 4.01 and CSS level 2 specifications support. * Support separating CSS from HTML by loading stylesheet code separately. * Support text selection, copy-paste and context menu. @@ -25,30 +37,23 @@ The library is 100% managed **C#** code without any external dependencies (no We * Create images/PDFs from HTML snippets. * Handles "real world" malformed HTML, it doesn't have to be XHTML. * 100% managed code and no external dependencies. -* Supports .NET 2.0 or higher including Client Profile. * Lightweight, just two DLLs (~300K). * High performance and low memory footprint. * Extendable and configurable. -* Powerful [Demo application](https://htmlrenderer.codeplex.com/wikipage?title=Demo%20application&referringTitle=Home) to explore and learn the library. +* Powerful [Demo application](https://codeplexarchive.org/ProjectTab/Wiki/HtmlRenderer/Documentation/Demo%20application) to explore and learn the library. + + +## WinForms/WPF controls -### WinForms/WPF controls * *HtmlPanel* - The full power of HTML control build to replace WebBrowser control, accepts HTML, text selection, scrollbars, link click intercept, image load intercept and much more. * *HtmlLabel* - As WinForms label but accepts HTML, text selection, auto-size capabilities, transparent background and more. * *HtmlToolTip* - As WinForms ToolTip control but accepts HTML and ability to handle links (WinForms only). -### Sample application's + +## Sample application's + * Render HTML content generated by rich web editors like forums, blogs, etc. * Render Office documents converted to HTML. * Create WinForms UI that requires text selection with clipboard support. -* [Create images from HTML code snippets](https://htmlrenderer.codeplex.com/wikipage?title=Image%20generation&referringTitle=Home). +* [Create images from HTML code snippets](https://codeplexarchive.org/ProjectTab/Wiki/HtmlRenderer/Documentation/Image%20generation). * Create PDF document from HTML code snippets. - -### NuGet packages -* [HtmlRenderer.WinForms](https://www.nuget.org/packages/HtmlRenderer.WinForms) -* [HtmlRenderer.WPF](https://www.nuget.org/packages/HtmlRenderer.WPF) -* [HtmlRenderer.Mono](https://www.nuget.org/packages/HtmlRenderer.Mono) -* [HtmlRenderer.PdfSharp](https://www.nuget.org/packages/HtmlRenderer.PdfSharp) -* [HtmlRenderer.Core](https://www.nuget.org/packages/HtmlRenderer.Core) - -#### HTML Renderer on my blog -[TheArtOfDev / HTML Renderer](http://theartofdev.com/html-renderer/) diff --git a/Source/.nuget/NuGet.Config b/Source/.nuget/NuGet.Config deleted file mode 100644 index 67f8ea046..000000000 --- a/Source/.nuget/NuGet.Config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Source/.nuget/NuGet.exe b/Source/.nuget/NuGet.exe deleted file mode 100644 index c41a0d0de..000000000 Binary files a/Source/.nuget/NuGet.exe and /dev/null differ diff --git a/Source/.nuget/NuGet.targets b/Source/.nuget/NuGet.targets deleted file mode 100644 index 3f8c37b22..000000000 --- a/Source/.nuget/NuGet.targets +++ /dev/null @@ -1,144 +0,0 @@ - - - - $(MSBuildProjectDirectory)\..\ - - - false - - - false - - - true - - - false - - - - - - - - - - - $([System.IO.Path]::Combine($(SolutionDir), ".nuget")) - - - - - $(SolutionDir).nuget - - - - $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config - $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config - - - - $(MSBuildProjectDirectory)\packages.config - $(PackagesProjectConfig) - - - - - $(NuGetToolsPath)\NuGet.exe - @(PackageSource) - - "$(NuGetExePath)" - mono --runtime=v4.0.30319 "$(NuGetExePath)" - - $(TargetDir.Trim('\\')) - - -RequireConsent - -NonInteractive - - "$(SolutionDir) " - "$(SolutionDir)" - - - $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir) - $(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols - - - - RestorePackages; - $(BuildDependsOn); - - - - - $(BuildDependsOn); - BuildPackage; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Source/Demo/Common/DemoUtils.cs b/Source/Demo/Common/DemoUtils.cs index f695886bc..a14b33b3f 100644 --- a/Source/Demo/Common/DemoUtils.cs +++ b/Source/Demo/Common/DemoUtils.cs @@ -29,7 +29,7 @@ public static String SampleHtmlLabelText get { return "This is an HtmlLabel on transparent background with colors and links: " + - "HTML Renderer"; + "HTML Renderer"; } } @@ -40,7 +40,7 @@ public static String SampleHtmlPanelText { get { - return "This is an HtmlPanel with colors and links: HTML Renderer" + + return "This is an HtmlPanel with colors and links: HTML Renderer" + "
If there is more text than the size of the control scrollbars will appear.
" + "
Click me to change my Text property."; } @@ -74,8 +74,8 @@ public static string GetStylesheet(string src) a:link { text-decoration: none; } a:hover { text-decoration: underline; } .gray { color:gray; } - .example { background-color:#efefef; corner-radius:5px; padding:0.5em; } - .whitehole { background-color:white; corner-radius:10px; padding:15px; } + .example { background-color:#efefef; border-radius:5px; padding:0.5em; } + .whitehole { background-color:white; border-radius:10px; padding:15px; } .caption { font-size: 1.1em } .comment { color: green; margin-bottom: 5px; margin-left: 3px; } .comment2 { color: green; }"; diff --git a/Source/Demo/Common/HtmlPrettyPrinter.cs b/Source/Demo/Common/HtmlPrettyPrinter.cs new file mode 100644 index 000000000..09d0e207d --- /dev/null +++ b/Source/Demo/Common/HtmlPrettyPrinter.cs @@ -0,0 +1,145 @@ +// "Therefore those skilled at the unorthodox +// are infinite as heaven and earth, +// inexhaustible as the great rivers. +// When they come to an end, +// they begin again, +// like the days and months; +// they die and are reborn, +// like the four seasons." +// +// - Sun Tsu, +// "The Art of War" + +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using HtmlKit; + +namespace TheArtOfDev.HtmlRenderer.Demo.Common +{ + /// + /// Utility to format HTML into a readable representation while preserving semantic structure. + /// + public static class HtmlPrettyPrinter + { + /// + /// html tags that should be written with indentation on separate lines + /// + private static readonly HashSet _blockTags = new HashSet(StringComparer.OrdinalIgnoreCase) + { + "article", "aside", "blockquote", "body", "caption", "colgroup", "dd", "div", "dl", "dt", "fieldset", "figcaption", + "figure", "footer", "form", "head", "header", "html", "li", "main", "nav", "ol", "p", "section", "table", "tbody", + "td", "tfoot", "th", "thead", "tr", "ul", "title" + }; + + /// + /// html tags that don't have a closing tag and should not change indentation depth + /// + private static readonly HashSet _voidTags = new HashSet(StringComparer.OrdinalIgnoreCase) + { + "area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr" + }; + + /// + /// Format the given html into a readable left-to-right comparable layout. + /// + public static string Format(string html) + { + if (string.IsNullOrWhiteSpace(html)) + return string.Empty; + + var builder = new StringBuilder(html.Length * 2); + using (var reader = new StringReader(html)) + using (var writer = new StringWriter(builder)) + { + var tokenizer = new HtmlTokenizer(reader); + HtmlToken token; + int indent = 0; + + while (tokenizer.ReadNextToken(out token)) + { + switch (token.Kind) + { + case HtmlTokenKind.DocType: + case HtmlTokenKind.Comment: + AppendTokenLine(builder, writer, token, indent); + break; + + case HtmlTokenKind.Tag: + var tag = (HtmlTagToken)token; + var isBlockTag = _blockTags.Contains(tag.Name); + var isVoidTag = tag.IsEmptyElement || _voidTags.Contains(tag.Name); + + if (tag.IsEndTag) + { + if (isBlockTag) + { + indent = Math.Max(0, indent - 1); + AppendTokenLine(builder, writer, token, indent); + } + else + { + token.WriteTo(writer); + } + } + else if (isBlockTag) + { + AppendTokenLine(builder, writer, token, indent); + if (!isVoidTag) + indent++; + } + else + { + token.WriteTo(writer); + } + break; + + case HtmlTokenKind.CData: + case HtmlTokenKind.Data: + case HtmlTokenKind.ScriptData: + var data = ((HtmlDataToken)token).Data; + if (!string.IsNullOrWhiteSpace(data)) + { + if (IsAtLineStart(builder)) + AppendIndent(builder, indent); + builder.Append(data); + } + break; + } + } + } + + return builder.ToString().Trim(); + } + + /// + /// Append the given html token on its own line using the given indentation level. + /// + private static void AppendTokenLine(StringBuilder builder, StringWriter writer, HtmlToken token, int indent) + { + if (!IsAtLineStart(builder)) + builder.AppendLine(); + + AppendIndent(builder, indent); + token.WriteTo(writer); + builder.AppendLine(); + } + + /// + /// Append indentation spaces to the string builder. + /// + private static void AppendIndent(StringBuilder builder, int indent) + { + builder.Append(' ', indent * 2); + } + + /// + /// Return if the builder currently points at the start of a new line. + /// + private static bool IsAtLineStart(StringBuilder builder) + { + return builder.Length == 0 || builder[builder.Length - 1] == '\n'; + } + } +} diff --git a/Source/Demo/Common/HtmlRenderer.Demo.Common.csproj b/Source/Demo/Common/HtmlRenderer.Demo.Common.csproj index 7413cc397..7128e4a70 100644 --- a/Source/Demo/Common/HtmlRenderer.Demo.Common.csproj +++ b/Source/Demo/Common/HtmlRenderer.Demo.Common.csproj @@ -1,178 +1,130 @@ - - - + - Debug - AnyCPU - {2390B71F-9400-47F4-B23A-7F2649C87D35} + netstandard2.0;net8.0 Library - Properties TheArtOfDev.HtmlRenderer.Demo.Common HtmlRendererDemoCommon - v2.0 - 512 - + true - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - + Resources.resx True True - - - - - - - - - + PublicResXFileCodeGenerator Resources.Designer.cs Designer - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {FE611685-391F-4E3E-B27E-D3150E51E49B} - HtmlRenderer - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + - + - + - - \ No newline at end of file diff --git a/Source/Demo/Common/HtmlSyntaxHighlighter.cs b/Source/Demo/Common/HtmlSyntaxHighlighter.cs index d68f2c1c8..e77cdb474 100644 --- a/Source/Demo/Common/HtmlSyntaxHighlighter.cs +++ b/Source/Demo/Common/HtmlSyntaxHighlighter.cs @@ -26,7 +26,7 @@ namespace TheArtOfDev.HtmlRenderer.Demo.Common /// /// /// The MIT License (MIT) Copyright (c) 2014 Arthur Teplitzki.
- /// Based on work by Alun Evans 2006 (http://www.codeproject.com/Articles/15038/C-Formatting-Text-in-a-RichTextBox-by-Parsing-the). + /// Based on work by Alun Evans 2006 (https://web.archive.org/web/20170426121905/http://www.codeproject.com/Articles/15038/C-Formatting-Text-in-a-RichTextBox-by-Parsing-the). ///
public static class HtmlSyntaxHighlighter { diff --git a/Source/Demo/Common/PerfSamples/1.Big table.htm b/Source/Demo/Common/PerfSamples/1.Big table.htm index 9aad29719..d61e7155c 100644 --- a/Source/Demo/Common/PerfSamples/1.Big table.htm +++ b/Source/Demo/Common/PerfSamples/1.Big table.htm @@ -1,7 +1,7 @@ - + - + Big table @@ -80,7 +81,7 @@

Justifed


Breakable lines

- http://www.google.com/sjkdhgfasdfgfg/asdfadfsgaefg/adfgafdgadfg/asdfgaedfgsdfg/dasfgasfdgasdfg/adfgadfgasfdg/adfsgafgafg/afdgaddfgadfg/afsdgafdgaddfg/afsdgafgadqfdgaeddfg + https://www.google.com/sjkdhgfasdfgfg/asdfadfsgaefg/adfgafdgadfg/asdfgaedfgsdfg/dasfgasfdgasdfg/adfgadfgasfdg/adfsgafgafg/afdgaddfgadfg/afsdgafdgaddfg/afsdgafgadqfdgaeddfg

Transparent text

@@ -116,10 +117,12 @@

Unordered list
  • Sub item one
  • Sub item two
  • -
      -
    • Sub-sub item two
    • -
    • Sub-sub item two
    • -
    +
  • +
      +
    • Sub-sub item two
    • +
    • Sub-sub item two
    • +
    +
  • Item three
  • diff --git a/Source/Demo/Common/Samples/03.Tables.htm b/Source/Demo/Common/Samples/03.Tables.htm index e923bacce..e41428638 100644 --- a/Source/Demo/Common/Samples/03.Tables.htm +++ b/Source/Demo/Common/Samples/03.Tables.htm @@ -1,7 +1,8 @@ + Tables - + @@ -20,10 +21,8 @@

    Case 1


    Text align justify with background colors

    -

    - Lorem ipsum dolor sit amet, consectetur adipisicing - elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua tempor incididunt ut labore et dolore magna aliqua incididunt ut labore et dolore magna aliqua. -
    + Lorem ipsum dolor sit amet, consectetur adipisicing + elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua tempor incididunt ut labore et dolore magna aliqua incididunt ut labore et dolore magna aliqua.


    Right align adjusts

    @@ -38,45 +37,43 @@

    Right align adjusts


    Transparent text

    - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ornare mollis elit. Integer sagittis. Fusce elementum commodo felis. Vivamus lacinia eleifend libero. Donec - lacus. Nam sit amet urna. Nullam nulla. Donec accumsan porta magna. Mauris a dolor eu elit rutrum commodo. Nam iaculis turpis non augue. Nullam lobortis egestas risus. Nulla + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ornare mollis elit. Integer sagittis. Fusce elementum commodo felis. Vivamus lacinia eleifend libero. Donec + lacus. Nam sit amet urna. Nullam nulla. Donec accumsan porta magna. Mauris a dolor eu elit rutrum commodo. Nam iaculis turpis non augue. Nullam lobortis egestas risus. Nulla elementum dolor ac mauris. Ut tristique. In varius volutpat metus. Integer leo dolor, tristique a, dignissim ac, iaculis eget, elit. Donec arcu.

    -

    - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ornare mollis elit. Integer sagittis. Fusce elementum commodo felis. Vivamus lacinia eleifend libero. Donec + + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ornare mollis elit. Integer sagittis. Fusce elementum commodo felis. Vivamus lacinia eleifend libero. Donec lacus. -
    - -
    - Nam sit amet urna. Nullam nulla. Donec accumsan porta magna. Mauris a dolor eu elit rutrum commodo. Nam iaculis turpis non augue. Nullam lobortis egestas risus. Nulla + +
    + + Nam sit amet urna. Nullam nulla. Donec accumsan porta magna. Mauris a dolor eu elit rutrum commodo. Nam iaculis turpis non augue. Nullam lobortis egestas risus. Nulla elementum dolor ac mauris. Ut tristique. In varius volutpat metus. Integer leo dolor, tristique a, dignissim ac, iaculis eget, elit. Donec arcu. -
    +

    -

    -

    - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ornare mollis elit. Integer_sagittis_Fusce_elementum_commodo_felis_Vivamus_lacinia_eleifend_libero_Donec +

    + + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ornare mollis elit. Integer_sagittis_Fusce_elementum_commodo_felis_Vivamus_lacinia_eleifend_libero_Donec lacus. -

    - -
    - Nam sit amet urna. Nullam nulla. Donec accumsan porta magna. Mauris a dolor eu elit rutrum commodo. Nam iaculis turpis non augue. Nullam lobortis egestas risus. Nulla + +
    + + Nam sit amet urna. Nullam nulla. Donec accumsan porta magna. Mauris a dolor eu elit rutrum commodo. Nam iaculis turpis non augue. Nullam lobortis egestas risus. Nulla elementum dolor ac mauris. Ut tristique. In varius volutpat metus. Integer leo dolor, tristique a, dignissim ac, iaculis eget, elit. Donec arcu. -
    +


    RTL text

    +

    + בדיקה של טקסט ימין לשמאל +

    +

    + בדיקה של טקסט ימין לשמאל normal text +

    -

    - בדיקה של טקסט ימין לשמאל -

    -

    - בדיקה של טקסט ימין לשמאל normal text -

    -

    - בדיקה של טקסט ימין לשמאל normal text -

    + בדיקה של טקסט ימין לשמאל normal text

    - \ No newline at end of file + diff --git a/Source/Demo/Common/TestSamples/13.Tables.htm b/Source/Demo/Common/TestSamples/13.Tables.htm index 70d454067..a58ac927c 100644 --- a/Source/Demo/Common/TestSamples/13.Tables.htm +++ b/Source/Demo/Common/TestSamples/13.Tables.htm @@ -1,7 +1,9 @@ + + Tables + -

    All fonts with different decorations

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    -

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    - - +

    @font-face fonts with different decorations

    +

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    +

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    +

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    +

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    +

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    +

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    +

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    +

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    +

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    +

    Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230 | Text, ABCgjwzqh. 1230

    +

    @font-face weight and style matching (proves nearest-face selection, not just decoration)

    +

    Regular | Bold | Italic | Bold Italic

    +

    Regular | Bold | Italic | Bold Italic

    +

    Regular | Bold | Italic | Bold Italic

    +

    Regular | Bold | Italic | Bold Italic

    +

    Regular | Bold | Italic | Bold Italic

    +

    Regular | Bold | Italic | Bold Italic

    - \ No newline at end of file + diff --git a/Source/Demo/Common/TestSamples/21.Bullets.htm b/Source/Demo/Common/TestSamples/21.Bullets.htm index a677321b1..b6a06bfc3 100644 --- a/Source/Demo/Common/TestSamples/21.Bullets.htm +++ b/Source/Demo/Common/TestSamples/21.Bullets.htm @@ -1,4 +1,8 @@ - + + + + Bullets +

    Unordered list

    @@ -8,10 +12,12 @@

    Unordered list
    • Sub item one
    • Sub item two
    • -
        -
      • Sub-sub item two
      • -
      • Sub-sub item two
      • -
      +
    • +
        +
      • Sub-sub item two
      • +
      • Sub-sub item two
      • +
      +
  • Item three
  • @@ -58,7 +64,7 @@

    List type: hebrew

    Ordered list reversed

    -
      +
      1. Item one
      2. Item two
      3. Item three
      4. diff --git a/Source/Demo/Common/TestSamples/22.RTL.htm b/Source/Demo/Common/TestSamples/22.RTL.htm index 35bf9bf6c..eec24ac70 100644 --- a/Source/Demo/Common/TestSamples/22.RTL.htm +++ b/Source/Demo/Common/TestSamples/22.RTL.htm @@ -1,4 +1,8 @@ - + + + + RTL +
        שלום עולם, יש ברבורים בעגם הזה
        diff --git a/Source/Demo/Common/TestSamples/23.Media queries and color scheme.htm b/Source/Demo/Common/TestSamples/23.Media queries and color scheme.htm new file mode 100644 index 000000000..501f1c3d2 --- /dev/null +++ b/Source/Demo/Common/TestSamples/23.Media queries and color scheme.htm @@ -0,0 +1,99 @@ + + + + + + +
        +

        prefers-color-scheme

        + This card follows the platform colour scheme. Reported scheme: . +
        GDI+ and WPF read the Windows app theme; PdfSharp always reports light.
        +
        + +
        +

        @media screen

        + Visible because the adapter's media type is screen. +
        + + + +
        +

        Unsupported media feature

        + This card stays neutral. A media feature the matcher cannot evaluate drops its whole block + rather than applying the rules inside it, so the red styling in + @media all and (scan: interlace) must not win. +
        + +
        +

        Viewport width

        + +
        + + + diff --git a/Source/Demo/Common/TestSamples/30.Misc.htm b/Source/Demo/Common/TestSamples/30.Misc.htm index f3cd2a5e5..544ada699 100644 --- a/Source/Demo/Common/TestSamples/30.Misc.htm +++ b/Source/Demo/Common/TestSamples/30.Misc.htm @@ -1,46 +1,47 @@ - + - - - -
        - Single whitespace in seperate element -
        -
        - Multiple whitespaces in seperate        element - using   -
        -
        - TOP -
        -
        - there are margin with percentage -
        -
        - BOTTOM -
        + + Miscellaneous + + + +
        + Single whitespace in seperate element +
        +
        + Multiple whitespaces in seperate        element + using   +
        +
        + TOP +
        +
        + there are margin with percentage +
        +
        + BOTTOM +
        Line through : Text Text Text Text
        +
        +
        + Text END +
        +
        +
        + text 1, text 2, text 3 +
        +
        + +
        +
        + R1H2O +
        -
        -
        - Text END -
        -
        -
        - text 1, text 2, text 3 -
        -
        - -
        -
        - R1H2O -
        - \ No newline at end of file diff --git a/Source/Demo/Common/TestSamples/31.ACID 1.htm b/Source/Demo/Common/TestSamples/31.ACID 1.htm index 3545bf464..e5b2eef95 100644 --- a/Source/Demo/Common/TestSamples/31.ACID 1.htm +++ b/Source/Demo/Common/TestSamples/31.ACID 1.htm @@ -1,3 +1,4 @@ + display/box/float/clear test diff --git a/Source/Demo/Common/TestSamples/32.Image in css content.htm b/Source/Demo/Common/TestSamples/32.Image in css content.htm index c3b7a86ec..f61d6d038 100644 --- a/Source/Demo/Common/TestSamples/32.Image in css content.htm +++ b/Source/Demo/Common/TestSamples/32.Image in css content.htm @@ -1,5 +1,7 @@ - + + + Image in CSS Content ", endIdx, StringComparison.OrdinalIgnoreCase); - if (endIdx > -1) - AddTextBox(source, endIdxS, endIdx, ref curBox); - } + case HtmlTokenKind.Tag: + { + var tag = (HtmlTagToken)token; + ParseHtmlTag(tag, ref curBox); + break; + } + case HtmlTokenKind.Data: + { + var text = (HtmlDataToken)token; + + if (curBox.HtmlTag != null && curBox.HtmlTag.Name.Equals(HtmlConstants.NoScript, StringComparison.OrdinalIgnoreCase)) + { + curBox = ParseDocument(text.Data, curBox); + } + else + { + AddTextBox(text, ref curBox); + } + + break; + } + case HtmlTokenKind.CData: + case HtmlTokenKind.Comment: + case HtmlTokenKind.DocType: + case HtmlTokenKind.ScriptData: + break; + default: + throw new ArgumentOutOfRangeException(); } } - startIdx = tagIdx > -1 && endIdx > 0 ? endIdx : -1; - } - - // handle pieces of html without proper structure - if (endIdx > -1 && endIdx < source.Length) - { - // there is text after the end of last element - var endText = new SubString(source, endIdx, source.Length - endIdx); - if (!endText.IsEmptyOrWhitespace()) - { - var abox = CssBox.CreateBox(root); - abox.Text = endText; - } } return root; @@ -96,168 +90,115 @@ public static CssBox ParseDocument(string source) /// Adding box also for text that contains only whitespaces because we don't know yet if /// the box is preformatted. At later stage they will be removed if not relevant. /// - /// the html source to parse - /// the start of the html part - /// the index of the next html tag + /// the html token to parse /// the current box in html tree parsing - private static void AddTextBox(string source, int startIdx, int tagIdx, ref CssBox curBox) + private static void AddTextBox(HtmlDataToken token, ref CssBox curBox) { - var text = tagIdx > startIdx ? new SubString(source, startIdx, tagIdx - startIdx) : null; - if (text != null) + var text = token.Data; + + if (text == null) return; + + // HTML drops a single newline directly after the
        ,  or