rewriting pdf converter to native usage

This commit is contained in:
tomse
2025-09-07 20:25:09 +02:00
parent 02fca61e80
commit 2ae7112dc1
510 changed files with 226213 additions and 50 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@@ -0,0 +1,23 @@
The MIT License (MIT)
Copyright (c) .NET Foundation and Contributors
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,164 @@
## About
<!-- A description of the package and where one can find more documentation -->
`Microsoft.Extensions.Logging.Abstractions` provides abstractions of logging. Interfaces defined in this package are implemented by classes in [Microsoft.Extensions.Logging](https://www.nuget.org/packages/Microsoft.Extensions.Logging/) and other logging packages.
This package includes a logging source generator that produces highly efficient and optimized code for logging message methods.
## Key Features
<!-- The key features of this package -->
* Define main logging abstraction interfaces like ILogger, ILoggerFactory, ILoggerProvider, etc.
## How to Use
<!-- A compelling example on how to use this package with code, as well as any specific guidelines for when to use the package -->
#### Custom logger provider implementation example
```C#
using Microsoft.Extensions.Logging;
public sealed class ColorConsoleLogger : ILogger
{
private readonly string _name;
private readonly Func<ColorConsoleLoggerConfiguration> _getCurrentConfig;
public ColorConsoleLogger(
string name,
Func<ColorConsoleLoggerConfiguration> getCurrentConfig) =>
(_name, _getCurrentConfig) = (name, getCurrentConfig);
public IDisposable? BeginScope<TState>(TState state) where TState : notnull => default!;
public bool IsEnabled(LogLevel logLevel) =>
_getCurrentConfig().LogLevelToColorMap.ContainsKey(logLevel);
public void Log<TState>(
LogLevel logLevel,
EventId eventId,
TState state,
Exception? exception,
Func<TState, Exception?, string> formatter)
{
if (!IsEnabled(logLevel))
{
return;
}
ColorConsoleLoggerConfiguration config = _getCurrentConfig();
if (config.EventId == 0 || config.EventId == eventId.Id)
{
ConsoleColor originalColor = Console.ForegroundColor;
Console.ForegroundColor = config.LogLevelToColorMap[logLevel];
Console.WriteLine($"[{eventId.Id,2}: {logLevel,-12}]");
Console.ForegroundColor = originalColor;
Console.Write($" {_name} - ");
Console.ForegroundColor = config.LogLevelToColorMap[logLevel];
Console.Write($"{formatter(state, exception)}");
Console.ForegroundColor = originalColor;
Console.WriteLine();
}
}
}
```
#### Create logs
```csharp
// Worker class that uses logger implementation of teh interface ILogger<T>
public sealed class Worker : BackgroundService
{
private readonly ILogger<Worker> _logger;
public Worker(ILogger<Worker> logger) =>
_logger = logger;
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
while (!stoppingToken.IsCancellationRequested)
{
_logger.LogInformation("Worker running at: {time}", DateTimeOffset.UtcNow);
await Task.Delay(1_000, stoppingToken);
}
}
}
```
#### Use source generator
```csharp
public static partial class Log
{
[LoggerMessage(
EventId = 0,
Level = LogLevel.Critical,
Message = "Could not open socket to `{hostName}`")]
public static partial void CouldNotOpenSocket(this ILogger logger, string hostName);
}
public partial class InstanceLoggingExample
{
private readonly ILogger _logger;
public InstanceLoggingExample(ILogger logger)
{
_logger = logger;
}
[LoggerMessage(
EventId = 0,
Level = LogLevel.Critical,
Message = "Could not open socket to `{hostName}`")]
public partial void CouldNotOpenSocket(string hostName);
}
```
## Main Types
<!-- The main types provided in this library -->
The main types provided by this library are:
* `Microsoft.Extensions.Logging.ILogger`
* `Microsoft.Extensions.Logging.ILoggerProvider`
* `Microsoft.Extensions.Logging.ILoggerFactory`
* `Microsoft.Extensions.Logging.ILogger<TCategoryName>`
* `Microsoft.Extensions.Logging.LogLevel`
* `Microsoft.Extensions.Logging.Logger<T>`
* `Microsoft.Extensions.Logging.LoggerMessage`
* `Microsoft.Extensions.Logging.Abstractions.NullLogger`
## Additional Documentation
<!-- Links to further documentation. Remove conceptual documentation if not available for the library. -->
* [Conceptual documentation](https://learn.microsoft.com/dotnet/core/extensions/logging)
* [API documentation](https://learn.microsoft.com/dotnet/api/microsoft.extensions.logging)
## Related Packages
<!-- The related packages associated with this package -->
[Microsoft.Extensions.Logging](https://www.nuget.org/packages/Microsoft.Extensions.Logging)
[Microsoft.Extensions.Logging.Console](https://www.nuget.org/packages/Microsoft.Extensions.Logging.Console)
[Microsoft.Extensions.Logging.Debug](https://www.nuget.org/packages/Microsoft.Extensions.Logging.Debug)
[Microsoft.Extensions.Logging.EventSource](https://www.nuget.org/packages/Microsoft.Extensions.Logging.EventSource)
[Microsoft.Extensions.Logging.EventLog](https://www.nuget.org/packages/Microsoft.Extensions.Logging.EventLog)
[Microsoft.Extensions.Logging.TraceSource](https://www.nuget.org/packages/Microsoft.Extensions.Logging.TraceSource)
## Feedback & Contributing
<!-- How to provide feedback on this package and contribute to it -->
Microsoft.Extensions.Logging.Abstractions is released as open source under the [MIT license](https://licenses.nuget.org/MIT). Bug reports and contributions are welcome at [the GitHub repository](https://github.com/dotnet/runtime).

View File

@@ -0,0 +1,6 @@
<Project InitialTargets="NETStandardCompatError_Microsoft_Extensions_Logging_Abstractions_net462">
<Target Name="NETStandardCompatError_Microsoft_Extensions_Logging_Abstractions_net462"
Condition="'$(SuppressTfmSupportBuildWarnings)' == ''">
<Warning Text="Microsoft.Extensions.Logging.Abstractions 8.0.2 doesn't support $(TargetFramework) and has not been tested with it. Consider upgrading your TargetFramework to net462 or later. You may also set &lt;SuppressTfmSupportBuildWarnings&gt;true&lt;/SuppressTfmSupportBuildWarnings&gt; in the project file to ignore this warning and attempt to run in this unsupported configuration at your own risk." />
</Target>
</Project>

View File

@@ -0,0 +1,31 @@
<Project>
<Target Name="_Microsoft_Extensions_Logging_AbstractionsGatherAnalyzers">
<ItemGroup>
<_Microsoft_Extensions_Logging_AbstractionsAnalyzer Include="@(Analyzer)" Condition="'%(Analyzer.NuGetPackageId)' == 'Microsoft.Extensions.Logging.Abstractions'" />
</ItemGroup>
</Target>
<Target Name="_Microsoft_Extensions_Logging_AbstractionsAnalyzerMultiTargeting"
Condition="'$(SupportsRoslynComponentVersioning)' != 'true'"
AfterTargets="ResolvePackageDependenciesForBuild;ResolveNuGetPackageAssets"
DependsOnTargets="_Microsoft_Extensions_Logging_AbstractionsGatherAnalyzers">
<ItemGroup>
<!-- Remove our analyzers targeting roslyn4.x -->
<Analyzer Remove="@(_Microsoft_Extensions_Logging_AbstractionsAnalyzer)"
Condition="$([System.String]::Copy('%(_Microsoft_Extensions_Logging_AbstractionsAnalyzer.Identity)').IndexOf('roslyn4')) &gt;= 0"/>
</ItemGroup>
</Target>
<Target Name="_Microsoft_Extensions_Logging_AbstractionsRemoveAnalyzers"
Condition="'$(DisableMicrosoftExtensionsLoggingSourceGenerator)' == 'true'"
AfterTargets="ResolvePackageDependenciesForBuild;ResolveNuGetPackageAssets"
DependsOnTargets="_Microsoft_Extensions_Logging_AbstractionsGatherAnalyzers">
<!-- Remove all our analyzers -->
<ItemGroup>
<Analyzer Remove="@(_Microsoft_Extensions_Logging_AbstractionsAnalyzer)" />
</ItemGroup>
</Target>
</Project>

View File

@@ -0,0 +1,31 @@
<Project>
<Target Name="_Microsoft_Extensions_Logging_AbstractionsGatherAnalyzers">
<ItemGroup>
<_Microsoft_Extensions_Logging_AbstractionsAnalyzer Include="@(Analyzer)" Condition="'%(Analyzer.NuGetPackageId)' == 'Microsoft.Extensions.Logging.Abstractions'" />
</ItemGroup>
</Target>
<Target Name="_Microsoft_Extensions_Logging_AbstractionsAnalyzerMultiTargeting"
Condition="'$(SupportsRoslynComponentVersioning)' != 'true'"
AfterTargets="ResolvePackageDependenciesForBuild;ResolveNuGetPackageAssets"
DependsOnTargets="_Microsoft_Extensions_Logging_AbstractionsGatherAnalyzers">
<ItemGroup>
<!-- Remove our analyzers targeting roslyn4.x -->
<Analyzer Remove="@(_Microsoft_Extensions_Logging_AbstractionsAnalyzer)"
Condition="$([System.String]::Copy('%(_Microsoft_Extensions_Logging_AbstractionsAnalyzer.Identity)').IndexOf('roslyn4')) &gt;= 0"/>
</ItemGroup>
</Target>
<Target Name="_Microsoft_Extensions_Logging_AbstractionsRemoveAnalyzers"
Condition="'$(DisableMicrosoftExtensionsLoggingSourceGenerator)' == 'true'"
AfterTargets="ResolvePackageDependenciesForBuild;ResolveNuGetPackageAssets"
DependsOnTargets="_Microsoft_Extensions_Logging_AbstractionsGatherAnalyzers">
<!-- Remove all our analyzers -->
<ItemGroup>
<Analyzer Remove="@(_Microsoft_Extensions_Logging_AbstractionsAnalyzer)" />
</ItemGroup>
</Target>
</Project>

View File

@@ -0,0 +1,6 @@
<Project InitialTargets="NETStandardCompatError_Microsoft_Extensions_Logging_Abstractions_net6_0">
<Target Name="NETStandardCompatError_Microsoft_Extensions_Logging_Abstractions_net6_0"
Condition="'$(SuppressTfmSupportBuildWarnings)' == ''">
<Warning Text="Microsoft.Extensions.Logging.Abstractions 8.0.2 doesn't support $(TargetFramework) and has not been tested with it. Consider upgrading your TargetFramework to net6.0 or later. You may also set &lt;SuppressTfmSupportBuildWarnings&gt;true&lt;/SuppressTfmSupportBuildWarnings&gt; in the project file to ignore this warning and attempt to run in this unsupported configuration at your own risk." />
</Target>
</Project>

View File

@@ -0,0 +1,31 @@
<Project>
<Target Name="_Microsoft_Extensions_Logging_AbstractionsGatherAnalyzers">
<ItemGroup>
<_Microsoft_Extensions_Logging_AbstractionsAnalyzer Include="@(Analyzer)" Condition="'%(Analyzer.NuGetPackageId)' == 'Microsoft.Extensions.Logging.Abstractions'" />
</ItemGroup>
</Target>
<Target Name="_Microsoft_Extensions_Logging_AbstractionsAnalyzerMultiTargeting"
Condition="'$(SupportsRoslynComponentVersioning)' != 'true'"
AfterTargets="ResolvePackageDependenciesForBuild;ResolveNuGetPackageAssets"
DependsOnTargets="_Microsoft_Extensions_Logging_AbstractionsGatherAnalyzers">
<ItemGroup>
<!-- Remove our analyzers targeting roslyn4.x -->
<Analyzer Remove="@(_Microsoft_Extensions_Logging_AbstractionsAnalyzer)"
Condition="$([System.String]::Copy('%(_Microsoft_Extensions_Logging_AbstractionsAnalyzer.Identity)').IndexOf('roslyn4')) &gt;= 0"/>
</ItemGroup>
</Target>
<Target Name="_Microsoft_Extensions_Logging_AbstractionsRemoveAnalyzers"
Condition="'$(DisableMicrosoftExtensionsLoggingSourceGenerator)' == 'true'"
AfterTargets="ResolvePackageDependenciesForBuild;ResolveNuGetPackageAssets"
DependsOnTargets="_Microsoft_Extensions_Logging_AbstractionsGatherAnalyzers">
<!-- Remove all our analyzers -->
<ItemGroup>
<Analyzer Remove="@(_Microsoft_Extensions_Logging_AbstractionsAnalyzer)" />
</ItemGroup>
</Target>
</Project>