From 17826abc4b3f192cdc8882d1493df0ef083113bc Mon Sep 17 00:00:00 2001 From: Wei Lin Date: Tue, 17 Nov 2026 09:59:06 +0800 Subject: [PATCH] docs: keep MiniPdf READMEs .NET-only and show practical usage Move remaining language portal content and six translated quick starts per language into the independent PdfLibrarys repositories. Expand the .NET README with file/byte-array/stream conversion, XLSX sheet/layout options, DOCX page geometry, low-memory conversion, font registration, and CLI examples. Validation: all six extracted C# examples and four CLI examples execute successfully; 11 PDFs parse strictly and A4/landscape/selected-sheet/low-memory content checks pass. All 44 README local links validate. No application source is changed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- README.md | 118 +++++++++++++++++++++++++++++----- documents/README.fr.md | 112 +++++++++++++++++++++++++++----- documents/README.it.md | 112 +++++++++++++++++++++++++++----- documents/README.ja.md | 112 +++++++++++++++++++++++++++----- documents/README.ko.md | 112 +++++++++++++++++++++++++++----- documents/README.nuget.cli.md | 8 +-- documents/README.nuget.md | 14 ++-- documents/README.zh-CN.md | 112 +++++++++++++++++++++++++++----- documents/README.zh-TW.md | 112 +++++++++++++++++++++++++++----- 9 files changed, 683 insertions(+), 129 deletions(-) diff --git a/README.md b/README.md index b7cc7237..d31211c4 100644 --- a/README.md +++ b/README.md @@ -19,27 +19,21 @@ Your star or donation can make MiniPdf better -This repository now maintains **MiniPdf for .NET** only. Rust, Java, Go, -Python, and Node.js have moved to their own [PdfLibrarys repositories](https://github.com/PdfLibrarys). -The implementation links below point to those independent repositories. +MiniPdf provides a **.NET library, command-line tool, and standalone Native AOT binaries** +for converting XLSX, DOCX, and PPTX files to PDF. MiniPdf converts Office documents directly to PDF without Microsoft Office, LibreOffice, Adobe Acrobat, or COM automation at runtime. -## Choose an implementation +## .NET overview | Implementation | Inputs | Interfaces | Maturity | Documentation | Visual results | |---|---|---|---|---|---| | .NET | XLSX, DOCX, PPTX | Library, CLI, Native AOT binaries | Stable | **[.NET guide](documents/README.nuget.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=xlsx)**
**[DOCX](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=docx)**
**[PPTX](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=issue&format=pptx)** | -| Rust | XLSX, DOCX, PPTX | Crate, CLI | Stable | **[Rust guide](https://github.com/PdfLibrarys/minipdf-rs/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=rust&suite=classic&format=xlsx)**
**[DOCX](https://mini-software.github.io/minipdf-web-page/?language=rust&suite=classic&format=docx)** | -| Java | XLSX, DOCX, PPTX | Library, CLI | Experimental | **[Java source](https://github.com/PdfLibrarys/minipdf-java)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=java&suite=issue&format=xlsx)**
**[DOCX](https://mini-software.github.io/minipdf-web-page/?language=java&suite=issue&format=docx)** | -| Python | DOCX | Package, CLI | Stable | **[Python guide](https://github.com/PdfLibrarys/minipdf-python/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=python&suite=issue&format=xlsx)**
**[DOCX](https://mini-software.github.io/minipdf-web-page/?language=python&suite=issue&format=docx)** | -| Node.js | XLSX, DOCX, PPTX | Native package | Stable | **[Node.js guide](https://github.com/PdfLibrarys/minipdf-node/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=node&suite=issue&format=xlsx)**
**[DOCX](https://mini-software.github.io/minipdf-web-page/?language=node&suite=issue&format=docx)** | -| Go | XLSX, DOCX, PPTX | Package, CLI | Experimental | **[Go guide](https://github.com/PdfLibrarys/minipdf-go/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=go&suite=issue&format=xlsx)** | ## Quick start -### .NET +### Install the library ```bash dotnet add package MiniPdf @@ -48,17 +42,111 @@ dotnet add package MiniPdf ```csharp using MiniSoftware; +MiniPdf.ConvertToPdf("workbook.xlsx", "workbook.pdf"); MiniPdf.ConvertToPdf("report.docx", "report.pdf"); +MiniPdf.ConvertToPdf("slides.pptx", "slides.pdf"); + +byte[] pdfBytes = MiniPdf.ConvertToPdf("report.docx"); ``` -Prefer a command-line tool? +### Use the command line ```bash dotnet tool install --global MiniPdf.Cli minipdf report.docx -o report.pdf +minipdf workbook.xlsx -o workbook.pdf --compress +minipdf slides.pptx -o slides.pdf +minipdf --help +``` + +No .NET runtime installed on the destination machine? Download a standalone +Native AOT binary from [Releases](https://github.com/mini-software/MiniPdf/releases). + +## Usage examples + +### Convert streams + +```csharp +using System.IO; +using MiniSoftware; + +using var input = File.OpenRead("report.docx"); +using var output = File.Create("stream-output.pdf"); +MiniPdf.ConvertToPdf(input, output); +``` + +The caller owns the streams and disposes them. Use the overload returning +`byte[]` when an in-memory result is needed. + +### Select Excel sheets and control layout + +```csharp +using MiniSoftware; + +MiniPdf.ConvertToPdf("workbook.xlsx", "summary.pdf", new MiniPdfConversionOptions +{ + Sheets = new[] { "Summary" }, + Landscape = true, + FitToPage = true, + Compress = true, +}); +``` + +Sheet names, 1-based `SheetIndexes`, orientation, print scale, and fit-to-page +options apply to XLSX input. See the [conversion options](documents/README.nuget.md#conversion-options) +for the complete list. + +### Set Word page size and margins + +```csharp +using MiniSoftware; + +MiniPdf.ConvertToPdf("report.docx", "a4-report.pdf", new MiniPdfConversionOptions +{ + PageSize = MiniPdfPageSize.A4, + Margins = new MiniPdfMargins(left: 36, top: 48, right: 36, bottom: 48), +}); ``` -See the [.NET guide](documents/README.nuget.md) for usage. +`PageSize` and `Margins` apply to DOCX input. Dimensions use PDF points: +72 points equal one inch. They do not override XLSX worksheet or PPTX slide sizes. + +### Reduce memory for large, simple Excel tables + +```csharp +using System.IO; +using MiniSoftware; + +using var input = File.OpenRead("workbook.xlsx"); +using var output = File.Create("low-memory.pdf"); +MiniPdf.ConvertToPdf(input, output, new MiniPdfConversionOptions +{ + LowMemory = true, + Compress = true, +}); +``` + +This opt-in XLSX mode uses temporary disk storage. Unsupported features, such +as formulas, merged cells, and drawings, produce an explicit error rather than +silently falling back. Read the [supported features and limitations](documents/README.nuget.md#low-memory-xlsx-conversion-opt-in) +before enabling it. Returning `byte[]` still retains the complete PDF in memory. + +### Provide fonts for headless hosts + +```csharp +using System.IO; +using MiniSoftware; + +MiniPdf.RegisterFont("Arial", File.ReadAllBytes(Path.Combine("Fonts", "arial.ttf"))); +MiniPdf.ConvertToPdf("report.docx", "font-report.pdf"); +``` + +Supply licensed `.ttf` or `.ttc` files that contain the required glyphs. +Register fonts once at application startup: registrations are process-wide. +MiniPdf does not distribute these font files. + +See the [.NET library guide](documents/README.nuget.md) and +[CLI reference](documents/README.nuget.cli.md) for more examples and options. ## Why MiniPdf @@ -88,11 +176,7 @@ Run the minipdf-contribution skill. |---|---| | [Online demo](https://mini-software.github.io/MiniPdf/) | Try conversion in a browser | | [.NET documentation](documents/README.nuget.md) | Stable library and CLI usage | -| [Rust documentation](https://github.com/PdfLibrarys/minipdf-rs/blob/main/README.md) | Experimental crate and CLI usage | -| [Java implementation](https://github.com/PdfLibrarys/minipdf-java) | Experimental Maven library and CLI source | -| [Python documentation](https://github.com/PdfLibrarys/minipdf-python/blob/main/README.md) | Experimental package and CLI usage | -| [Node.js documentation](https://github.com/PdfLibrarys/minipdf-node/blob/main/README.md) | Experimental native package usage | -| [Go documentation](https://github.com/PdfLibrarys/minipdf-go/blob/main/README.md) | Experimental package and CLI usage | +| [CLI reference](documents/README.nuget.cli.md) | Commands, fonts, compression, and Excel preview options | | [.NET XLSX benchmark](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=xlsx) | Visual comparison results for spreadsheets | | [.NET DOCX benchmark](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=docx) | Visual comparison results for documents | | [Community governance](GOVERNANCE.md) | Decisions, roles, voting, and maintainer selection | diff --git a/documents/README.fr.md b/documents/README.fr.md index 3c5bded6..d05b6903 100644 --- a/documents/README.fr.md +++ b/documents/README.fr.md @@ -19,22 +19,15 @@ Votre étoile ou votre don peut améliorer MiniPdf. -This repository now maintains **MiniPdf for .NET** only. Rust, Java, Go, -Python, and Node.js have moved to their own [PdfLibrarys repositories](https://github.com/PdfLibrarys). -The implementation links below point to those independent repositories. +MiniPdf provides a .NET library, command-line tool, and standalone Native AOT binaries for XLSX, DOCX, and PPTX conversion. MiniPdf convertit directement les documents Office en PDF sans nécessiter Microsoft Office, LibreOffice, Adobe Acrobat ni automatisation COM à l'exécution. -## Choisir une implémentation +## .NET | Implémentation | Entrées | Interfaces | Maturité | Documentation | Résultats visuels | |---|---|---|---|---|---| | .NET | XLSX, DOCX, PPTX | Bibliothèque, CLI, binaires Native AOT | Stable | **[Guide .NET](README.nuget.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=xlsx)**
**[DOCX](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=docx)**
**[PPTX](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=issue&format=pptx)** | -| Rust | XLSX, DOCX, PPTX | Crate, CLI | Stable | **[Guide Rust](https://github.com/PdfLibrarys/minipdf-rs/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=rust&suite=classic&format=xlsx)**
**[DOCX](https://mini-software.github.io/minipdf-web-page/?language=rust&suite=classic&format=docx)** | -| Java | XLSX, DOCX, PPTX | Bibliothèque, CLI | Expérimental | **[Sources Java](https://github.com/PdfLibrarys/minipdf-java)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=java&suite=issue&format=xlsx)**
**[DOCX](https://mini-software.github.io/minipdf-web-page/?language=java&suite=issue&format=docx)** | -| Python | DOCX | Paquet, CLI | Stable | **[Guide Python](https://github.com/PdfLibrarys/minipdf-python/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=python&suite=issue&format=xlsx)** | -| Node.js | XLSX, DOCX, PPTX | Paquet natif | Stable | **[Guide Node.js](https://github.com/PdfLibrarys/minipdf-node/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=node&suite=issue&format=xlsx)** | -| Go | XLSX, DOCX, PPTX | Paquet, CLI | Expérimental | **[Guide Go](https://github.com/PdfLibrarys/minipdf-go/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=go&suite=issue&format=xlsx)** | ## Démarrage rapide @@ -47,7 +40,11 @@ dotnet add package MiniPdf ```csharp using MiniSoftware; +MiniPdf.ConvertToPdf("workbook.xlsx", "workbook.pdf"); MiniPdf.ConvertToPdf("report.docx", "report.pdf"); +MiniPdf.ConvertToPdf("slides.pptx", "slides.pdf"); + +byte[] pdfBytes = MiniPdf.ConvertToPdf("report.docx"); ``` Pour la ligne de commande : @@ -55,10 +52,99 @@ Pour la ligne de commande : ```bash dotnet tool install --global MiniPdf.Cli minipdf report.docx -o report.pdf +minipdf workbook.xlsx -o workbook.pdf --compress +minipdf slides.pptx -o slides.pdf +minipdf --help ``` Pour l'utilisation, consultez le [guide .NET](README.nuget.md). +## Usage examples + +### Convert streams + +```csharp +using System.IO; +using MiniSoftware; + +using var input = File.OpenRead("report.docx"); +using var output = File.Create("stream-output.pdf"); +MiniPdf.ConvertToPdf(input, output); +``` + +The caller owns the streams and disposes them. Use the overload returning +`byte[]` when an in-memory result is needed. + +### Select Excel sheets and control layout + +```csharp +using MiniSoftware; + +MiniPdf.ConvertToPdf("workbook.xlsx", "summary.pdf", new MiniPdfConversionOptions +{ + Sheets = new[] { "Summary" }, + Landscape = true, + FitToPage = true, + Compress = true, +}); +``` + +Sheet names, 1-based `SheetIndexes`, orientation, print scale, and fit-to-page +options apply to XLSX input. See the [conversion options](README.nuget.md#conversion-options) +for the complete list. + +### Set Word page size and margins + +```csharp +using MiniSoftware; + +MiniPdf.ConvertToPdf("report.docx", "a4-report.pdf", new MiniPdfConversionOptions +{ + PageSize = MiniPdfPageSize.A4, + Margins = new MiniPdfMargins(left: 36, top: 48, right: 36, bottom: 48), +}); +``` + +`PageSize` and `Margins` apply to DOCX input. Dimensions use PDF points: +72 points equal one inch. They do not override XLSX worksheet or PPTX slide sizes. + +### Reduce memory for large, simple Excel tables + +```csharp +using System.IO; +using MiniSoftware; + +using var input = File.OpenRead("workbook.xlsx"); +using var output = File.Create("low-memory.pdf"); +MiniPdf.ConvertToPdf(input, output, new MiniPdfConversionOptions +{ + LowMemory = true, + Compress = true, +}); +``` + +This opt-in XLSX mode uses temporary disk storage. Unsupported features, such +as formulas, merged cells, and drawings, produce an explicit error rather than +silently falling back. Read the [supported features and limitations](README.nuget.md#low-memory-xlsx-conversion-opt-in) +before enabling it. Returning `byte[]` still retains the complete PDF in memory. + +### Provide fonts for headless hosts + +```csharp +using System.IO; +using MiniSoftware; + +MiniPdf.RegisterFont("Arial", File.ReadAllBytes(Path.Combine("Fonts", "arial.ttf"))); +MiniPdf.ConvertToPdf("report.docx", "font-report.pdf"); +``` + +Supply licensed `.ttf` or `.ttc` files that contain the required glyphs. +Register fonts once at application startup: registrations are process-wide. +MiniPdf does not distribute these font files. + +See the [.NET library guide](README.nuget.md) and +[CLI reference](README.nuget.cli.md) for more examples and options. + ## Pourquoi MiniPdf - **Aucune suite Office requise** : la conversion s'exécute dans l'application ou la CLI. @@ -83,16 +169,8 @@ Run the minipdf-contribution skill. |---|---| | [Démo en ligne](https://mini-software.github.io/MiniPdf/) | Tester la conversion dans le navigateur | | [Documentation .NET](README.nuget.md) | Utilisation de la bibliothèque stable et de la CLI | -| [Documentation Rust](https://github.com/PdfLibrarys/minipdf-rs/blob/main/README.md) | Utilisation du crate expérimental et de la CLI | -| [Implémentation Java](https://github.com/PdfLibrarys/minipdf-java) | Sources de la bibliothèque Maven et de la CLI expérimentales | -| [Documentation Python](https://github.com/PdfLibrarys/minipdf-python/blob/main/README.md) | Utilisation du paquet expérimental et de la CLI | -| [Documentation Node.js](https://github.com/PdfLibrarys/minipdf-node/blob/main/README.md) | Utilisation du paquet natif expérimental | -| [Documentation Go](https://github.com/PdfLibrarys/minipdf-go/blob/main/README.md) | Utilisation du paquet expérimental et de la CLI | | [Benchmark XLSX .NET](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=xlsx) | Résultats visuels pour les feuilles de calcul | | [Benchmark DOCX .NET](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=docx) | Résultats visuels pour les documents | -| [Benchmark XLSX Rust](https://mini-software.github.io/minipdf-web-page/?language=rust&suite=classic&format=xlsx) | Résultats de comparaison visuelle Rust des feuilles de calcul | -| [Benchmark DOCX Rust](https://mini-software.github.io/minipdf-web-page/?language=rust&suite=classic&format=docx) | Résultats de comparaison visuelle Rust des documents | -| [Procédure de benchmark Rust](https://github.com/PdfLibrarys/minipdf-rs) | Génère la couverture des tests et les rapports comparatifs | | [Gouvernance communautaire](../GOVERNANCE.md) | Décisions, rôles, votes et sélection des mainteneurs | | [Feuille de route](../ROADMAP.md) | Périmètre du projet, état des implémentations et priorités | | [Sécurité](../SECURITY.md) | Signalement privé des vulnérabilités et versions prises en charge | diff --git a/documents/README.it.md b/documents/README.it.md index dfda030c..4e286f89 100644 --- a/documents/README.it.md +++ b/documents/README.it.md @@ -19,22 +19,15 @@ La tua stella o donazione può rendere MiniPdf migliore. -This repository now maintains **MiniPdf for .NET** only. Rust, Java, Go, -Python, and Node.js have moved to their own [PdfLibrarys repositories](https://github.com/PdfLibrarys). -The implementation links below point to those independent repositories. +MiniPdf provides a .NET library, command-line tool, and standalone Native AOT binaries for XLSX, DOCX, and PPTX conversion. MiniPdf converte direttamente i documenti Office in PDF senza richiedere Microsoft Office, LibreOffice, Adobe Acrobat o automazione COM durante l'esecuzione. -## Scegli un'implementazione +## .NET | Implementazione | Input | Interfacce | Maturità | Documentazione | Risultati visivi | |---|---|---|---|---|---| | .NET | XLSX, DOCX, PPTX | Libreria, CLI, binari Native AOT | Stabile | **[Guida .NET](README.nuget.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=xlsx)**
**[DOCX](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=docx)**
**[PPTX](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=issue&format=pptx)** | -| Rust | XLSX, DOCX, PPTX | Crate, CLI | Stabile | **[Guida Rust](https://github.com/PdfLibrarys/minipdf-rs/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=rust&suite=classic&format=xlsx)**
**[DOCX](https://mini-software.github.io/minipdf-web-page/?language=rust&suite=classic&format=docx)** | -| Java | XLSX, DOCX, PPTX | Libreria, CLI | Sperimentale | **[Sorgenti Java](https://github.com/PdfLibrarys/minipdf-java)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=java&suite=issue&format=xlsx)**
**[DOCX](https://mini-software.github.io/minipdf-web-page/?language=java&suite=issue&format=docx)** | -| Python | DOCX | Pacchetto, CLI | Stabile | **[Guida Python](https://github.com/PdfLibrarys/minipdf-python/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=python&suite=issue&format=xlsx)** | -| Node.js | XLSX, DOCX, PPTX | Pacchetto nativo | Stabile | **[Guida Node.js](https://github.com/PdfLibrarys/minipdf-node/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=node&suite=issue&format=xlsx)** | -| Go | XLSX, DOCX, PPTX | Pacchetto, CLI | Sperimentale | **[Guida Go](https://github.com/PdfLibrarys/minipdf-go/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=go&suite=issue&format=xlsx)** | ## Avvio rapido @@ -47,7 +40,11 @@ dotnet add package MiniPdf ```csharp using MiniSoftware; +MiniPdf.ConvertToPdf("workbook.xlsx", "workbook.pdf"); MiniPdf.ConvertToPdf("report.docx", "report.pdf"); +MiniPdf.ConvertToPdf("slides.pptx", "slides.pdf"); + +byte[] pdfBytes = MiniPdf.ConvertToPdf("report.docx"); ``` Per la riga di comando: @@ -55,10 +52,99 @@ Per la riga di comando: ```bash dotnet tool install --global MiniPdf.Cli minipdf report.docx -o report.pdf +minipdf workbook.xlsx -o workbook.pdf --compress +minipdf slides.pptx -o slides.pdf +minipdf --help ``` Per l'uso, consulta la [guida .NET](README.nuget.md). +## Usage examples + +### Convert streams + +```csharp +using System.IO; +using MiniSoftware; + +using var input = File.OpenRead("report.docx"); +using var output = File.Create("stream-output.pdf"); +MiniPdf.ConvertToPdf(input, output); +``` + +The caller owns the streams and disposes them. Use the overload returning +`byte[]` when an in-memory result is needed. + +### Select Excel sheets and control layout + +```csharp +using MiniSoftware; + +MiniPdf.ConvertToPdf("workbook.xlsx", "summary.pdf", new MiniPdfConversionOptions +{ + Sheets = new[] { "Summary" }, + Landscape = true, + FitToPage = true, + Compress = true, +}); +``` + +Sheet names, 1-based `SheetIndexes`, orientation, print scale, and fit-to-page +options apply to XLSX input. See the [conversion options](README.nuget.md#conversion-options) +for the complete list. + +### Set Word page size and margins + +```csharp +using MiniSoftware; + +MiniPdf.ConvertToPdf("report.docx", "a4-report.pdf", new MiniPdfConversionOptions +{ + PageSize = MiniPdfPageSize.A4, + Margins = new MiniPdfMargins(left: 36, top: 48, right: 36, bottom: 48), +}); +``` + +`PageSize` and `Margins` apply to DOCX input. Dimensions use PDF points: +72 points equal one inch. They do not override XLSX worksheet or PPTX slide sizes. + +### Reduce memory for large, simple Excel tables + +```csharp +using System.IO; +using MiniSoftware; + +using var input = File.OpenRead("workbook.xlsx"); +using var output = File.Create("low-memory.pdf"); +MiniPdf.ConvertToPdf(input, output, new MiniPdfConversionOptions +{ + LowMemory = true, + Compress = true, +}); +``` + +This opt-in XLSX mode uses temporary disk storage. Unsupported features, such +as formulas, merged cells, and drawings, produce an explicit error rather than +silently falling back. Read the [supported features and limitations](README.nuget.md#low-memory-xlsx-conversion-opt-in) +before enabling it. Returning `byte[]` still retains the complete PDF in memory. + +### Provide fonts for headless hosts + +```csharp +using System.IO; +using MiniSoftware; + +MiniPdf.RegisterFont("Arial", File.ReadAllBytes(Path.Combine("Fonts", "arial.ttf"))); +MiniPdf.ConvertToPdf("report.docx", "font-report.pdf"); +``` + +Supply licensed `.ttf` or `.ttc` files that contain the required glyphs. +Register fonts once at application startup: registrations are process-wide. +MiniPdf does not distribute these font files. + +See the [.NET library guide](README.nuget.md) and +[CLI reference](README.nuget.cli.md) for more examples and options. + ## Perché MiniPdf - **Nessuna suite Office richiesta**: la conversione viene eseguita nell'applicazione o nella CLI. @@ -83,16 +169,8 @@ Run the minipdf-contribution skill. |---|---| | [Demo online](https://mini-software.github.io/MiniPdf/) | Prova la conversione nel browser | | [Documentazione .NET](README.nuget.md) | Uso della libreria stabile e della CLI | -| [Documentazione Rust](https://github.com/PdfLibrarys/minipdf-rs/blob/main/README.md) | Uso del crate sperimentale e della CLI | -| [Implementazione Java](https://github.com/PdfLibrarys/minipdf-java) | Sorgenti della libreria Maven e della CLI sperimentali | -| [Documentazione Python](https://github.com/PdfLibrarys/minipdf-python/blob/main/README.md) | Uso del pacchetto sperimentale e della CLI | -| [Documentazione Node.js](https://github.com/PdfLibrarys/minipdf-node/blob/main/README.md) | Uso del pacchetto nativo sperimentale | -| [Documentazione Go](https://github.com/PdfLibrarys/minipdf-go/blob/main/README.md) | Uso del pacchetto sperimentale e della CLI | | [Benchmark XLSX .NET](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=xlsx) | Risultati visivi per i fogli di calcolo | | [Benchmark DOCX .NET](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=docx) | Risultati visivi per i documenti | -| [Benchmark XLSX Rust](https://mini-software.github.io/minipdf-web-page/?language=rust&suite=classic&format=xlsx) | Risultati del confronto visivo Rust per i fogli di calcolo | -| [Benchmark DOCX Rust](https://mini-software.github.io/minipdf-web-page/?language=rust&suite=classic&format=docx) | Risultati del confronto visivo Rust per i documenti | -| [Flusso benchmark Rust](https://github.com/PdfLibrarys/minipdf-rs) | Genera copertura dei test e report comparativi | | [Governance della comunità](../GOVERNANCE.md) | Decisioni, ruoli, votazioni e selezione dei maintainer | | [Roadmap](../ROADMAP.md) | Ambito del progetto, stato delle implementazioni e priorità | | [Sicurezza](../SECURITY.md) | Segnalazione privata delle vulnerabilità e versioni supportate | diff --git a/documents/README.ja.md b/documents/README.ja.md index 354c0af5..b08d1bbc 100644 --- a/documents/README.ja.md +++ b/documents/README.ja.md @@ -19,22 +19,15 @@ -This repository now maintains **MiniPdf for .NET** only. Rust, Java, Go, -Python, and Node.js have moved to their own [PdfLibrarys repositories](https://github.com/PdfLibrarys). -The implementation links below point to those independent repositories. +MiniPdf provides a .NET library, command-line tool, and standalone Native AOT binaries for XLSX, DOCX, and PPTX conversion. MiniPdf は、実行時に Microsoft Office、LibreOffice、Adobe Acrobat、COM オートメーションを必要とせず、Office 文書を直接 PDF に変換します。 -## 実装を選ぶ +## .NET | 実装 | 入力 | インターフェイス | 成熟度 | ドキュメント | 視覚結果 | |---|---|---|---|---|---| | .NET | XLSX、DOCX、PPTX | ライブラリ、CLI、Native AOT バイナリ | 安定版 | **[.NET ガイド](README.nuget.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=xlsx)**
**[DOCX](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=docx)**
**[PPTX](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=issue&format=pptx)** | -| Rust | XLSX、DOCX、PPTX | Crate、CLI | 安定版 | **[Rust ガイド](https://github.com/PdfLibrarys/minipdf-rs/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=rust&suite=classic&format=xlsx)**
**[DOCX](https://mini-software.github.io/minipdf-web-page/?language=rust&suite=classic&format=docx)** | -| Java | XLSX、DOCX、PPTX | ライブラリ、CLI | 実験版 | **[Java ソース](https://github.com/PdfLibrarys/minipdf-java)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=java&suite=issue&format=xlsx)**
**[DOCX](https://mini-software.github.io/minipdf-web-page/?language=java&suite=issue&format=docx)** | -| Python | DOCX | パッケージ、CLI | 安定版 | **[Python ガイド](https://github.com/PdfLibrarys/minipdf-python/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=python&suite=issue&format=xlsx)** | -| Node.js | XLSX、DOCX、PPTX | ネイティブパッケージ | 安定版 | **[Node.js ガイド](https://github.com/PdfLibrarys/minipdf-node/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=node&suite=issue&format=xlsx)** | -| Go | XLSX、DOCX、PPTX | パッケージ、CLI | 実験版 | **[Go ガイド](https://github.com/PdfLibrarys/minipdf-go/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=go&suite=issue&format=xlsx)** | ## クイックスタート @@ -47,7 +40,11 @@ dotnet add package MiniPdf ```csharp using MiniSoftware; +MiniPdf.ConvertToPdf("workbook.xlsx", "workbook.pdf"); MiniPdf.ConvertToPdf("report.docx", "report.pdf"); +MiniPdf.ConvertToPdf("slides.pptx", "slides.pdf"); + +byte[] pdfBytes = MiniPdf.ConvertToPdf("report.docx"); ``` コマンドラインを使う場合: @@ -55,10 +52,99 @@ MiniPdf.ConvertToPdf("report.docx", "report.pdf"); ```bash dotnet tool install --global MiniPdf.Cli minipdf report.docx -o report.pdf +minipdf workbook.xlsx -o workbook.pdf --compress +minipdf slides.pptx -o slides.pdf +minipdf --help ``` 使用方法については [.NET ガイド](README.nuget.md) をご覧ください。 +## Usage examples + +### Convert streams + +```csharp +using System.IO; +using MiniSoftware; + +using var input = File.OpenRead("report.docx"); +using var output = File.Create("stream-output.pdf"); +MiniPdf.ConvertToPdf(input, output); +``` + +The caller owns the streams and disposes them. Use the overload returning +`byte[]` when an in-memory result is needed. + +### Select Excel sheets and control layout + +```csharp +using MiniSoftware; + +MiniPdf.ConvertToPdf("workbook.xlsx", "summary.pdf", new MiniPdfConversionOptions +{ + Sheets = new[] { "Summary" }, + Landscape = true, + FitToPage = true, + Compress = true, +}); +``` + +Sheet names, 1-based `SheetIndexes`, orientation, print scale, and fit-to-page +options apply to XLSX input. See the [conversion options](README.nuget.md#conversion-options) +for the complete list. + +### Set Word page size and margins + +```csharp +using MiniSoftware; + +MiniPdf.ConvertToPdf("report.docx", "a4-report.pdf", new MiniPdfConversionOptions +{ + PageSize = MiniPdfPageSize.A4, + Margins = new MiniPdfMargins(left: 36, top: 48, right: 36, bottom: 48), +}); +``` + +`PageSize` and `Margins` apply to DOCX input. Dimensions use PDF points: +72 points equal one inch. They do not override XLSX worksheet or PPTX slide sizes. + +### Reduce memory for large, simple Excel tables + +```csharp +using System.IO; +using MiniSoftware; + +using var input = File.OpenRead("workbook.xlsx"); +using var output = File.Create("low-memory.pdf"); +MiniPdf.ConvertToPdf(input, output, new MiniPdfConversionOptions +{ + LowMemory = true, + Compress = true, +}); +``` + +This opt-in XLSX mode uses temporary disk storage. Unsupported features, such +as formulas, merged cells, and drawings, produce an explicit error rather than +silently falling back. Read the [supported features and limitations](README.nuget.md#low-memory-xlsx-conversion-opt-in) +before enabling it. Returning `byte[]` still retains the complete PDF in memory. + +### Provide fonts for headless hosts + +```csharp +using System.IO; +using MiniSoftware; + +MiniPdf.RegisterFont("Arial", File.ReadAllBytes(Path.Combine("Fonts", "arial.ttf"))); +MiniPdf.ConvertToPdf("report.docx", "font-report.pdf"); +``` + +Supply licensed `.ttf` or `.ttc` files that contain the required glyphs. +Register fonts once at application startup: registrations are process-wide. +MiniPdf does not distribute these font files. + +See the [.NET library guide](README.nuget.md) and +[CLI reference](README.nuget.cli.md) for more examples and options. + ## MiniPdf を選ぶ理由 - **Office スイート不要**:変換はアプリケーションまたは CLI 内で実行されます。 @@ -83,16 +169,8 @@ Run the minipdf-contribution skill. |---|---| | [オンラインデモ](https://mini-software.github.io/MiniPdf/) | ブラウザーで変換を試す | | [.NET ドキュメント](README.nuget.md) | 安定版ライブラリと CLI の使用方法 | -| [Rust ドキュメント](https://github.com/PdfLibrarys/minipdf-rs/blob/main/README.md) | 実験版 crate と CLI の使用方法 | -| [Java 実装](https://github.com/PdfLibrarys/minipdf-java) | 実験版 Maven ライブラリと CLI のソース | -| [Python ドキュメント](https://github.com/PdfLibrarys/minipdf-python/blob/main/README.md) | 実験版パッケージと CLI の使用方法 | -| [Node.js ドキュメント](https://github.com/PdfLibrarys/minipdf-node/blob/main/README.md) | 実験版ネイティブパッケージの使用方法 | -| [Go ドキュメント](https://github.com/PdfLibrarys/minipdf-go/blob/main/README.md) | 実験版パッケージと CLI の使用方法 | | [.NET XLSX ベンチマーク](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=xlsx) | スプレッドシートの視覚比較結果 | | [.NET DOCX ベンチマーク](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=docx) | 文書の視覚比較結果 | -| [Rust XLSX ベンチマーク](https://mini-software.github.io/minipdf-web-page/?language=rust&suite=classic&format=xlsx) | Rust スプレッドシートの視覚比較結果 | -| [Rust DOCX ベンチマーク](https://mini-software.github.io/minipdf-web-page/?language=rust&suite=classic&format=docx) | Rust ドキュメントの視覚比較結果 | -| [Rust ベンチマーク手順](https://github.com/PdfLibrarys/minipdf-rs) | フィクスチャ範囲と比較レポートを生成 | | [コミュニティガバナンス](../GOVERNANCE.md) | 意思決定、役割、投票、メンテナー選出 | | [ロードマップ](../ROADMAP.md) | プロジェクト範囲、実装状況、現在の優先事項 | | [セキュリティ](../SECURITY.md) | 脆弱性の非公開報告とサポート対象バージョン | diff --git a/documents/README.ko.md b/documents/README.ko.md index 6de14b61..39bd29cf 100644 --- a/documents/README.ko.md +++ b/documents/README.ko.md @@ -19,22 +19,15 @@ -This repository now maintains **MiniPdf for .NET** only. Rust, Java, Go, -Python, and Node.js have moved to their own [PdfLibrarys repositories](https://github.com/PdfLibrarys). -The implementation links below point to those independent repositories. +MiniPdf provides a .NET library, command-line tool, and standalone Native AOT binaries for XLSX, DOCX, and PPTX conversion. MiniPdf는 런타임에 Microsoft Office, LibreOffice, Adobe Acrobat 또는 COM 자동화 없이 Office 문서를 PDF로 직접 변환합니다. -## 구현 선택 +## .NET | 구현 | 입력 | 인터페이스 | 성숙도 | 문서 | 시각적 결과 | |---|---|---|---|---|---| | .NET | XLSX, DOCX, PPTX | 라이브러리, CLI, Native AOT 바이너리 | 안정 | **[.NET 가이드](README.nuget.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=xlsx)**
**[DOCX](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=docx)**
**[PPTX](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=issue&format=pptx)** | -| Rust | XLSX, DOCX, PPTX | Crate, CLI | 안정 | **[Rust 가이드](https://github.com/PdfLibrarys/minipdf-rs/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=rust&suite=classic&format=xlsx)**
**[DOCX](https://mini-software.github.io/minipdf-web-page/?language=rust&suite=classic&format=docx)** | -| Java | XLSX, DOCX, PPTX | 라이브러리, CLI | 실험적 | **[Java 소스](https://github.com/PdfLibrarys/minipdf-java)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=java&suite=issue&format=xlsx)**
**[DOCX](https://mini-software.github.io/minipdf-web-page/?language=java&suite=issue&format=docx)** | -| Python | DOCX | 패키지, CLI | 안정 | **[Python 가이드](https://github.com/PdfLibrarys/minipdf-python/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=python&suite=issue&format=xlsx)** | -| Node.js | XLSX, DOCX, PPTX | 네이티브 패키지 | 안정 | **[Node.js 가이드](https://github.com/PdfLibrarys/minipdf-node/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=node&suite=issue&format=xlsx)** | -| Go | XLSX, DOCX, PPTX | 패키지, CLI | 실험적 | **[Go 가이드](https://github.com/PdfLibrarys/minipdf-go/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=go&suite=issue&format=xlsx)** | ## 빠른 시작 @@ -47,7 +40,11 @@ dotnet add package MiniPdf ```csharp using MiniSoftware; +MiniPdf.ConvertToPdf("workbook.xlsx", "workbook.pdf"); MiniPdf.ConvertToPdf("report.docx", "report.pdf"); +MiniPdf.ConvertToPdf("slides.pptx", "slides.pdf"); + +byte[] pdfBytes = MiniPdf.ConvertToPdf("report.docx"); ``` 명령줄 사용: @@ -55,10 +52,99 @@ MiniPdf.ConvertToPdf("report.docx", "report.pdf"); ```bash dotnet tool install --global MiniPdf.Cli minipdf report.docx -o report.pdf +minipdf workbook.xlsx -o workbook.pdf --compress +minipdf slides.pptx -o slides.pdf +minipdf --help ``` 사용 방법은 [.NET 가이드](README.nuget.md)를 참조하세요. +## Usage examples + +### Convert streams + +```csharp +using System.IO; +using MiniSoftware; + +using var input = File.OpenRead("report.docx"); +using var output = File.Create("stream-output.pdf"); +MiniPdf.ConvertToPdf(input, output); +``` + +The caller owns the streams and disposes them. Use the overload returning +`byte[]` when an in-memory result is needed. + +### Select Excel sheets and control layout + +```csharp +using MiniSoftware; + +MiniPdf.ConvertToPdf("workbook.xlsx", "summary.pdf", new MiniPdfConversionOptions +{ + Sheets = new[] { "Summary" }, + Landscape = true, + FitToPage = true, + Compress = true, +}); +``` + +Sheet names, 1-based `SheetIndexes`, orientation, print scale, and fit-to-page +options apply to XLSX input. See the [conversion options](README.nuget.md#conversion-options) +for the complete list. + +### Set Word page size and margins + +```csharp +using MiniSoftware; + +MiniPdf.ConvertToPdf("report.docx", "a4-report.pdf", new MiniPdfConversionOptions +{ + PageSize = MiniPdfPageSize.A4, + Margins = new MiniPdfMargins(left: 36, top: 48, right: 36, bottom: 48), +}); +``` + +`PageSize` and `Margins` apply to DOCX input. Dimensions use PDF points: +72 points equal one inch. They do not override XLSX worksheet or PPTX slide sizes. + +### Reduce memory for large, simple Excel tables + +```csharp +using System.IO; +using MiniSoftware; + +using var input = File.OpenRead("workbook.xlsx"); +using var output = File.Create("low-memory.pdf"); +MiniPdf.ConvertToPdf(input, output, new MiniPdfConversionOptions +{ + LowMemory = true, + Compress = true, +}); +``` + +This opt-in XLSX mode uses temporary disk storage. Unsupported features, such +as formulas, merged cells, and drawings, produce an explicit error rather than +silently falling back. Read the [supported features and limitations](README.nuget.md#low-memory-xlsx-conversion-opt-in) +before enabling it. Returning `byte[]` still retains the complete PDF in memory. + +### Provide fonts for headless hosts + +```csharp +using System.IO; +using MiniSoftware; + +MiniPdf.RegisterFont("Arial", File.ReadAllBytes(Path.Combine("Fonts", "arial.ttf"))); +MiniPdf.ConvertToPdf("report.docx", "font-report.pdf"); +``` + +Supply licensed `.ttf` or `.ttc` files that contain the required glyphs. +Register fonts once at application startup: registrations are process-wide. +MiniPdf does not distribute these font files. + +See the [.NET library guide](README.nuget.md) and +[CLI reference](README.nuget.cli.md) for more examples and options. + ## MiniPdf를 선택하는 이유 - **Office 제품군 불필요**: 애플리케이션 또는 CLI 내부에서 변환합니다. @@ -83,16 +169,8 @@ Run the minipdf-contribution skill. |---|---| | [온라인 데모](https://mini-software.github.io/MiniPdf/) | 브라우저에서 변환 체험 | | [.NET 문서](README.nuget.md) | 안정 버전 라이브러리 및 CLI 사용법 | -| [Rust 문서](https://github.com/PdfLibrarys/minipdf-rs/blob/main/README.md) | 실험 버전 crate 및 CLI 사용법 | -| [Java 구현](https://github.com/PdfLibrarys/minipdf-java) | 실험적 Maven 라이브러리 및 CLI 소스 | -| [Python 문서](https://github.com/PdfLibrarys/minipdf-python/blob/main/README.md) | 실험적 패키지 및 CLI 사용법 | -| [Node.js 문서](https://github.com/PdfLibrarys/minipdf-node/blob/main/README.md) | 실험적 네이티브 패키지 사용법 | -| [Go 문서](https://github.com/PdfLibrarys/minipdf-go/blob/main/README.md) | 실험적 패키지 및 CLI 사용법 | | [.NET XLSX 벤치마크](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=xlsx) | 스프레드시트 시각 비교 결과 | | [.NET DOCX 벤치마크](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=docx) | 문서 시각 비교 결과 | -| [Rust XLSX 벤치마크](https://mini-software.github.io/minipdf-web-page/?language=rust&suite=classic&format=xlsx) | Rust 스프레드시트 시각 비교 결과 | -| [Rust DOCX 벤치마크](https://mini-software.github.io/minipdf-web-page/?language=rust&suite=classic&format=docx) | Rust 문서 시각 비교 결과 | -| [Rust 벤치마크 절차](https://github.com/PdfLibrarys/minipdf-rs) | 픽스처 범위 및 비교 보고서 생성 | | [커뮤니티 거버넌스](../GOVERNANCE.md) | 의사 결정, 역할, 투표 및 메인테이너 선정 | | [로드맵](../ROADMAP.md) | 프로젝트 범위, 구현 상태 및 현재 우선순위 | | [보안](../SECURITY.md) | 비공개 취약점 신고 및 지원 버전 | diff --git a/documents/README.nuget.cli.md b/documents/README.nuget.cli.md index 92a892eb..e0a98353 100644 --- a/documents/README.nuget.cli.md +++ b/documents/README.nuget.cli.md @@ -1,7 +1,7 @@ [![NuGet](https://img.shields.io/nuget/v/MiniPdf.Cli.svg)](https://www.nuget.org/packages/MiniPdf.Cli) [![NuGet Downloads](https://img.shields.io/nuget/dt/MiniPdf.Cli.svg)](https://www.nuget.org/packages/MiniPdf.Cli) -[![GitHub stars](https://img.shields.io/github/stars/shps951023/MiniPdf?logo=github)](https://github.com/shps951023/MiniPdf) -[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/shps951023/MiniPdf/blob/main/LICENSE) +[![GitHub stars](https://img.shields.io/github/stars/mini-software/MiniPdf?logo=github)](https://github.com/mini-software/MiniPdf) +[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/mini-software/MiniPdf/blob/main/LICENSE) A command-line tool to convert Excel (`.xlsx`), Word (`.docx`), and PowerPoint (`.pptx`) files to PDF. Powered by [MiniPdf](https://www.nuget.org/packages/MiniPdf) — zero-dependency, pure .NET. @@ -70,5 +70,5 @@ for supported features and limitations. ## Links - Library package: [MiniPdf on NuGet](https://www.nuget.org/packages/MiniPdf) -- Source code: https://github.com/shps951023/MiniPdf -- License: [Apache-2.0](https://github.com/shps951023/MiniPdf/blob/main/LICENSE) \ No newline at end of file +- Source code: https://github.com/mini-software/MiniPdf +- License: [Apache-2.0](https://github.com/mini-software/MiniPdf/blob/main/LICENSE) \ No newline at end of file diff --git a/documents/README.nuget.md b/documents/README.nuget.md index c55887d5..79ace9b9 100644 --- a/documents/README.nuget.md +++ b/documents/README.nuget.md @@ -1,7 +1,7 @@ [![NuGet](https://img.shields.io/nuget/v/MiniPdf.svg)](https://www.nuget.org/packages/MiniPdf) [![NuGet Downloads](https://img.shields.io/nuget/dt/MiniPdf.svg)](https://www.nuget.org/packages/MiniPdf) -[![GitHub stars](https://img.shields.io/github/stars/shps951023/MiniPdf?logo=github)](https://github.com/shps951023/MiniPdf) -[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/shps951023/MiniPdf/blob/main/LICENSE) +[![GitHub stars](https://img.shields.io/github/stars/mini-software/MiniPdf?logo=github)](https://github.com/mini-software/MiniPdf) +[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/mini-software/MiniPdf/blob/main/LICENSE) # MiniPdf for .NET @@ -10,8 +10,7 @@ applications or the command line. It runs without Microsoft Office, LibreOffice, Adobe Acrobat, or COM automation. [Project home](https://github.com/mini-software/MiniPdf) · -[Online demo](https://mini-software.github.io/MiniPdf/) · -[Rust implementation](https://github.com/mini-software/MiniPdf/tree/main/minipdf-rs) +[Online demo](https://mini-software.github.io/MiniPdf/) ## Features @@ -33,6 +32,7 @@ dotnet add package MiniPdf ## Usage ```csharp +using System.IO; using MiniSoftware; // Excel to PDF @@ -166,7 +166,9 @@ for commands and options. ## Benchmark -MiniPdf output is compared against LibreOffice as the reference renderer across 373 test cases. +MiniPdf output is compared against Microsoft 365 as the primary reference and +LibreOffice as the auxiliary reference. Use the reports below to evaluate +representative spreadsheets and documents. @@ -182,4 +184,4 @@ Detailed reports: - Project portal: https://github.com/mini-software/MiniPdf - .NET CLI: https://www.nuget.org/packages/MiniPdf.Cli - API source: https://github.com/mini-software/MiniPdf/blob/main/src/MiniPdf/MiniPdf.cs -- License: [Apache-2.0](https://github.com/shps951023/MiniPdf/blob/main/LICENSE) \ No newline at end of file +- License: [Apache-2.0](https://github.com/mini-software/MiniPdf/blob/main/LICENSE) \ No newline at end of file diff --git a/documents/README.zh-CN.md b/documents/README.zh-CN.md index f2c5f55e..26721524 100644 --- a/documents/README.zh-CN.md +++ b/documents/README.zh-CN.md @@ -19,22 +19,15 @@ -This repository now maintains **MiniPdf for .NET** only. Rust, Java, Go, -Python, and Node.js have moved to their own [PdfLibrarys repositories](https://github.com/PdfLibrarys). -The implementation links below point to those independent repositories. +MiniPdf provides a .NET library, command-line tool, and standalone Native AOT binaries for XLSX, DOCX, and PPTX conversion. MiniPdf 无需在运行时安装 Microsoft Office、LibreOffice、Adobe Acrobat 或使用 COM 自动化,即可将 Office 文档直接转换为 PDF。 -## 选择实现 +## .NET | 实现 | 输入 | 接口 | 成熟度 | 文档 | 视觉结果 | |---|---|---|---|---|---| | .NET | XLSX、DOCX、PPTX | 库、CLI、Native AOT 二进制文件 | 稳定 | **[.NET 指南](README.nuget.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=xlsx)**
**[DOCX](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=docx)**
**[PPTX](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=issue&format=pptx)** | -| Rust | XLSX、DOCX、PPTX | Crate、CLI | 稳定 | **[Rust 指南](https://github.com/PdfLibrarys/minipdf-rs/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=rust&suite=classic&format=xlsx)**
**[DOCX](https://mini-software.github.io/minipdf-web-page/?language=rust&suite=classic&format=docx)** | -| Java | XLSX、DOCX、PPTX | 库、CLI | 实验性 | **[Java 源代码](https://github.com/PdfLibrarys/minipdf-java)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=java&suite=issue&format=xlsx)**
**[DOCX](https://mini-software.github.io/minipdf-web-page/?language=java&suite=issue&format=docx)** | -| Python | DOCX | 包、CLI | 稳定 | **[Python 指南](https://github.com/PdfLibrarys/minipdf-python/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=python&suite=issue&format=xlsx)** | -| Node.js | XLSX、DOCX、PPTX | 原生包 | 稳定 | **[Node.js 指南](https://github.com/PdfLibrarys/minipdf-node/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=node&suite=issue&format=xlsx)** | -| Go | XLSX、DOCX、PPTX | 包、CLI | 实验性 | **[Go 指南](https://github.com/PdfLibrarys/minipdf-go/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=go&suite=issue&format=xlsx)** | ## 快速开始 @@ -47,7 +40,11 @@ dotnet add package MiniPdf ```csharp using MiniSoftware; +MiniPdf.ConvertToPdf("workbook.xlsx", "workbook.pdf"); MiniPdf.ConvertToPdf("report.docx", "report.pdf"); +MiniPdf.ConvertToPdf("slides.pptx", "slides.pdf"); + +byte[] pdfBytes = MiniPdf.ConvertToPdf("report.docx"); ``` 命令行用法: @@ -55,10 +52,99 @@ MiniPdf.ConvertToPdf("report.docx", "report.pdf"); ```bash dotnet tool install --global MiniPdf.Cli minipdf report.docx -o report.pdf +minipdf workbook.xlsx -o workbook.pdf --compress +minipdf slides.pptx -o slides.pdf +minipdf --help ``` 使用方式请查看 [.NET 指南](README.nuget.md) +## Usage examples + +### Convert streams + +```csharp +using System.IO; +using MiniSoftware; + +using var input = File.OpenRead("report.docx"); +using var output = File.Create("stream-output.pdf"); +MiniPdf.ConvertToPdf(input, output); +``` + +The caller owns the streams and disposes them. Use the overload returning +`byte[]` when an in-memory result is needed. + +### Select Excel sheets and control layout + +```csharp +using MiniSoftware; + +MiniPdf.ConvertToPdf("workbook.xlsx", "summary.pdf", new MiniPdfConversionOptions +{ + Sheets = new[] { "Summary" }, + Landscape = true, + FitToPage = true, + Compress = true, +}); +``` + +Sheet names, 1-based `SheetIndexes`, orientation, print scale, and fit-to-page +options apply to XLSX input. See the [conversion options](README.nuget.md#conversion-options) +for the complete list. + +### Set Word page size and margins + +```csharp +using MiniSoftware; + +MiniPdf.ConvertToPdf("report.docx", "a4-report.pdf", new MiniPdfConversionOptions +{ + PageSize = MiniPdfPageSize.A4, + Margins = new MiniPdfMargins(left: 36, top: 48, right: 36, bottom: 48), +}); +``` + +`PageSize` and `Margins` apply to DOCX input. Dimensions use PDF points: +72 points equal one inch. They do not override XLSX worksheet or PPTX slide sizes. + +### Reduce memory for large, simple Excel tables + +```csharp +using System.IO; +using MiniSoftware; + +using var input = File.OpenRead("workbook.xlsx"); +using var output = File.Create("low-memory.pdf"); +MiniPdf.ConvertToPdf(input, output, new MiniPdfConversionOptions +{ + LowMemory = true, + Compress = true, +}); +``` + +This opt-in XLSX mode uses temporary disk storage. Unsupported features, such +as formulas, merged cells, and drawings, produce an explicit error rather than +silently falling back. Read the [supported features and limitations](README.nuget.md#low-memory-xlsx-conversion-opt-in) +before enabling it. Returning `byte[]` still retains the complete PDF in memory. + +### Provide fonts for headless hosts + +```csharp +using System.IO; +using MiniSoftware; + +MiniPdf.RegisterFont("Arial", File.ReadAllBytes(Path.Combine("Fonts", "arial.ttf"))); +MiniPdf.ConvertToPdf("report.docx", "font-report.pdf"); +``` + +Supply licensed `.ttf` or `.ttc` files that contain the required glyphs. +Register fonts once at application startup: registrations are process-wide. +MiniPdf does not distribute these font files. + +See the [.NET library guide](README.nuget.md) and +[CLI reference](README.nuget.cli.md) for more examples and options. + ## 为什么选择 MiniPdf - **无需 Office 套件**:转换直接在应用程序或 CLI 内运行。 @@ -83,16 +169,8 @@ Run the minipdf-contribution skill. |---|---| | [在线演示](https://mini-software.github.io/MiniPdf/) | 在浏览器中试用转换 | | [.NET 文档](README.nuget.md) | 稳定版库与 CLI 用法 | -| [Rust 文档](https://github.com/PdfLibrarys/minipdf-rs/blob/main/README.md) | 实验版 crate 与 CLI 用法 | -| [Java 实现](https://github.com/PdfLibrarys/minipdf-java) | 实验性 Maven 库与 CLI 源代码 | -| [Python 文档](https://github.com/PdfLibrarys/minipdf-python/blob/main/README.md) | 实验性包与 CLI 用法 | -| [Node.js 文档](https://github.com/PdfLibrarys/minipdf-node/blob/main/README.md) | 实验性原生包用法 | -| [Go 文档](https://github.com/PdfLibrarys/minipdf-go/blob/main/README.md) | 实验性包与 CLI 用法 | | [.NET XLSX 基准](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=xlsx) | 电子表格视觉比较结果 | | [.NET DOCX 基准](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=docx) | 文档视觉比较结果 | -| [Rust XLSX 基准](https://mini-software.github.io/minipdf-web-page/?language=rust&suite=classic&format=xlsx) | Rust 电子表格视觉比较结果 | -| [Rust DOCX 基准](https://mini-software.github.io/minipdf-web-page/?language=rust&suite=classic&format=docx) | Rust 文档视觉比较结果 | -| [Rust 基准流程](https://github.com/PdfLibrarys/minipdf-rs) | 生成测试覆盖与比较报告 | | [社区治理](../GOVERNANCE.md) | 决策、角色、投票和维护者选任 | | [路线图](../ROADMAP.md) | 项目范围、实现状态和当前优先事项 | | [安全政策](../SECURITY.md) | 私密漏洞报告和支持版本 | diff --git a/documents/README.zh-TW.md b/documents/README.zh-TW.md index d98a4244..f7dfb50d 100644 --- a/documents/README.zh-TW.md +++ b/documents/README.zh-TW.md @@ -19,22 +19,15 @@ -This repository now maintains **MiniPdf for .NET** only. Rust, Java, Go, -Python, and Node.js have moved to their own [PdfLibrarys repositories](https://github.com/PdfLibrarys). -The implementation links below point to those independent repositories. +MiniPdf provides a .NET library, command-line tool, and standalone Native AOT binaries for XLSX, DOCX, and PPTX conversion. MiniPdf 不需要在執行階段安裝 Microsoft Office、LibreOffice、Adobe Acrobat 或使用 COM 自動化,即可直接將 Office 文件轉換為 PDF。 -## 選擇實作 +## .NET | 實作 | 輸入 | 介面 | 成熟度 | 文件 | 視覺結果 | |---|---|---|---|---|---| | .NET | XLSX、DOCX、PPTX | 程式庫、CLI、Native AOT 二進位檔 | 穩定 | **[.NET 指南](README.nuget.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=xlsx)**
**[DOCX](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=docx)**
**[PPTX](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=issue&format=pptx)** | -| Rust | XLSX、DOCX、PPTX | Crate、CLI | 穩定 | **[Rust 指南](https://github.com/PdfLibrarys/minipdf-rs/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=rust&suite=classic&format=xlsx)**
**[DOCX](https://mini-software.github.io/minipdf-web-page/?language=rust&suite=classic&format=docx)** | -| Java | XLSX、DOCX、PPTX | 程式庫、CLI | 實驗性 | **[Java 原始碼](https://github.com/PdfLibrarys/minipdf-java)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=java&suite=issue&format=xlsx)**
**[DOCX](https://mini-software.github.io/minipdf-web-page/?language=java&suite=issue&format=docx)** | -| Python | DOCX | 套件、CLI | 穩定 | **[Python 指南](https://github.com/PdfLibrarys/minipdf-python/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=python&suite=issue&format=xlsx)** | -| Node.js | XLSX、DOCX、PPTX | 原生套件 | 穩定 | **[Node.js 指南](https://github.com/PdfLibrarys/minipdf-node/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=node&suite=issue&format=xlsx)** | -| Go | XLSX、DOCX、PPTX | 套件、CLI | 實驗性 | **[Go 指南](https://github.com/PdfLibrarys/minipdf-go/blob/main/README.md)** | **[XLSX](https://mini-software.github.io/minipdf-web-page/?language=go&suite=issue&format=xlsx)** | ## 快速開始 @@ -47,7 +40,11 @@ dotnet add package MiniPdf ```csharp using MiniSoftware; +MiniPdf.ConvertToPdf("workbook.xlsx", "workbook.pdf"); MiniPdf.ConvertToPdf("report.docx", "report.pdf"); +MiniPdf.ConvertToPdf("slides.pptx", "slides.pdf"); + +byte[] pdfBytes = MiniPdf.ConvertToPdf("report.docx"); ``` 命令列用法: @@ -55,10 +52,99 @@ MiniPdf.ConvertToPdf("report.docx", "report.pdf"); ```bash dotnet tool install --global MiniPdf.Cli minipdf report.docx -o report.pdf +minipdf workbook.xlsx -o workbook.pdf --compress +minipdf slides.pptx -o slides.pdf +minipdf --help ``` 使用方式請參閱 [.NET 指南](README.nuget.md)。 +## Usage examples + +### Convert streams + +```csharp +using System.IO; +using MiniSoftware; + +using var input = File.OpenRead("report.docx"); +using var output = File.Create("stream-output.pdf"); +MiniPdf.ConvertToPdf(input, output); +``` + +The caller owns the streams and disposes them. Use the overload returning +`byte[]` when an in-memory result is needed. + +### Select Excel sheets and control layout + +```csharp +using MiniSoftware; + +MiniPdf.ConvertToPdf("workbook.xlsx", "summary.pdf", new MiniPdfConversionOptions +{ + Sheets = new[] { "Summary" }, + Landscape = true, + FitToPage = true, + Compress = true, +}); +``` + +Sheet names, 1-based `SheetIndexes`, orientation, print scale, and fit-to-page +options apply to XLSX input. See the [conversion options](README.nuget.md#conversion-options) +for the complete list. + +### Set Word page size and margins + +```csharp +using MiniSoftware; + +MiniPdf.ConvertToPdf("report.docx", "a4-report.pdf", new MiniPdfConversionOptions +{ + PageSize = MiniPdfPageSize.A4, + Margins = new MiniPdfMargins(left: 36, top: 48, right: 36, bottom: 48), +}); +``` + +`PageSize` and `Margins` apply to DOCX input. Dimensions use PDF points: +72 points equal one inch. They do not override XLSX worksheet or PPTX slide sizes. + +### Reduce memory for large, simple Excel tables + +```csharp +using System.IO; +using MiniSoftware; + +using var input = File.OpenRead("workbook.xlsx"); +using var output = File.Create("low-memory.pdf"); +MiniPdf.ConvertToPdf(input, output, new MiniPdfConversionOptions +{ + LowMemory = true, + Compress = true, +}); +``` + +This opt-in XLSX mode uses temporary disk storage. Unsupported features, such +as formulas, merged cells, and drawings, produce an explicit error rather than +silently falling back. Read the [supported features and limitations](README.nuget.md#low-memory-xlsx-conversion-opt-in) +before enabling it. Returning `byte[]` still retains the complete PDF in memory. + +### Provide fonts for headless hosts + +```csharp +using System.IO; +using MiniSoftware; + +MiniPdf.RegisterFont("Arial", File.ReadAllBytes(Path.Combine("Fonts", "arial.ttf"))); +MiniPdf.ConvertToPdf("report.docx", "font-report.pdf"); +``` + +Supply licensed `.ttf` or `.ttc` files that contain the required glyphs. +Register fonts once at application startup: registrations are process-wide. +MiniPdf does not distribute these font files. + +See the [.NET library guide](README.nuget.md) and +[CLI reference](README.nuget.cli.md) for more examples and options. + ## 為什麼選擇 MiniPdf - **不需要 Office 套件**:轉換直接在應用程式或 CLI 內執行。 @@ -83,16 +169,8 @@ Run the minipdf-contribution skill. |---|---| | [線上展示](https://mini-software.github.io/MiniPdf/) | 在瀏覽器中試用轉換 | | [.NET 文件](README.nuget.md) | 穩定版程式庫與 CLI 用法 | -| [Rust 文件](https://github.com/PdfLibrarys/minipdf-rs/blob/main/README.md) | 實驗版 crate 與 CLI 用法 | -| [Java 實作](https://github.com/PdfLibrarys/minipdf-java) | 實驗性 Maven 程式庫與 CLI 原始碼 | -| [Python 文件](https://github.com/PdfLibrarys/minipdf-python/blob/main/README.md) | 實驗性套件與 CLI 用法 | -| [Node.js 文件](https://github.com/PdfLibrarys/minipdf-node/blob/main/README.md) | 實驗性原生套件用法 | -| [Go 文件](https://github.com/PdfLibrarys/minipdf-go/blob/main/README.md) | 實驗性套件與 CLI 用法 | | [.NET XLSX 基準](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=xlsx) | 試算表視覺比較結果 | | [.NET DOCX 基準](https://mini-software.github.io/minipdf-web-page/?language=dotnet&suite=classic&format=docx) | 文件視覺比較結果 | -| [Rust XLSX 基準](https://mini-software.github.io/minipdf-web-page/?language=rust&suite=classic&format=xlsx) | Rust 試算表視覺比較結果 | -| [Rust DOCX 基準](https://mini-software.github.io/minipdf-web-page/?language=rust&suite=classic&format=docx) | Rust 文件視覺比較結果 | -| [Rust 基準流程](https://github.com/PdfLibrarys/minipdf-rs) | 產生測試涵蓋率與比較報告 | | [社群治理](../GOVERNANCE.md) | 決策、角色、投票與維護者選任 | | [路線圖](../ROADMAP.md) | 專案範圍、實作狀態與目前優先事項 | | [安全政策](../SECURITY.md) | 私密漏洞回報與支援版本 |