| Target framework | Status |
|---|---|
| .NET 8.0 | Supported |
The package currently targets .NET 8.0 specifically — a consuming project needs to target .NET 8.0 or later. It's a plain class library, so it works from any .NET language (C#, F#, VB.NET); examples below are shown in C#.
Hytone-PDF is a standard NuGet package — no additional runtime dependencies, and no Microsoft Word or Office installation needed on the machine running it.
dotnet add package Hytone-PDF
Or via the Package Manager Console:
Install-Package Hytone-PDF
Or by editing your .csproj directly:
<PackageReference Include="Hytone-PDF" Version="*" />
On install, NuGet prompts you to accept the license (packed as LICENSE.txt).
Set your license key once at application startup:
using Hytone.Pdf;
HytonePdf.SetLicense("HYT1....");
Without a key, the library runs in evaluation mode — output is capped at 1 page and watermarked, with PDF merging disabled. See Purchase License for what a license unlocks.
using Hytone.Pdf.Licensing;
if (License.IsLicensed)
{
Console.WriteLine($"Licensed to {License.Current.LicensedTo} ({License.Current.Type})");
}
Simplest form — load a document, convert it:
HytonePdf.LoadDocument("report.docx");
HytonePdf.ConvertToPDF("report.pdf", deleteOriginalFile: false);
LoadDocument/ConvertToPDF share one loaded document across the process — fine for a script, CLI tool, or any single-conversion-at-a-time caller, but not safe to call concurrently from multiple threads.
For a server or any other concurrent caller, use the stateless stream overload instead — it touches no shared state and is safe to call from as many threads as you like at once:
using var docxStream = File.OpenRead("report.docx");
using var pdfStream = File.Create("report.pdf");
HytonePdf.Convert(docxStream, pdfStream);
Merge already-existing PDFs, in order — each source's own content (including its own page numbering) is preserved exactly as authored:
using var a = File.OpenRead("part1.pdf");
using var b = File.OpenRead("part2.pdf");
using var merged = File.Create("combined.pdf");
HytonePdf.MergePdfs([a, b], merged);
To append a freshly-converted document onto an existing PDF, pass appendToDocument to either conversion entry point instead of a separate merge step:
// File-based: grows appendToDocument in place. outputPath and appendToDocument are
// mutually exclusive — specify exactly one.
HytonePdf.LoadDocument("chapter2.docx");
HytonePdf.ConvertToPDF(appendToDocument: "report.pdf");
// Stream-based: appendToDocument is read-only input; the combined result goes to
// pdfStream, appendToDocument itself is never modified.
using var existing = File.OpenRead("report.pdf");
using var docxStream = File.OpenRead("chapter2.docx");
using var pdfStream = File.Create("report_v2.pdf");
HytonePdf.Convert(docxStream, pdfStream, appendToDocument: existing);
Word 97-2003 binary (.doc) documents convert to .docx first — chain into Convert above to go straight to PDF:
using var docStream = File.OpenRead("legacy.doc");
using var docxStream = File.Create("legacy.docx");
HytonePdf.ConvertDocToDocx(docStream, docxStream);
Email licenses@hytone-tools.com with any questions.