Pacem.Extensions.OfficeWord.Pdf 0.8.11

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Pacem.Extensions.OfficeWord.Pdf --version 0.8.11
                    
NuGet\Install-Package Pacem.Extensions.OfficeWord.Pdf -Version 0.8.11
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Pacem.Extensions.OfficeWord.Pdf" Version="0.8.11" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Pacem.Extensions.OfficeWord.Pdf" Version="0.8.11" />
                    
Directory.Packages.props
<PackageReference Include="Pacem.Extensions.OfficeWord.Pdf" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Pacem.Extensions.OfficeWord.Pdf --version 0.8.11
                    
#r "nuget: Pacem.Extensions.OfficeWord.Pdf, 0.8.11"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Pacem.Extensions.OfficeWord.Pdf@0.8.11
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Pacem.Extensions.OfficeWord.Pdf&version=0.8.11
                    
Install as a Cake Addin
#tool nuget:?package=Pacem.Extensions.OfficeWord.Pdf&version=0.8.11
                    
Install as a Cake Tool

Office Word Extensions

About

Pacem.Extensions.OfficeWord.Pdf provides a lightweight set of utilities that ease the conversion of .docx documents into PDFs.

This library depends on Pacem.Extensions.OfficeWord. Please, check its documentation first.

The following paragraphs exemplify the library utilization.

Getting started

Inject the IOfficeWordPdfConverter singleton service into the DI container.

Currently, there's no other [than the dependency injection] way to reach the instance of the processor service.

Like this:

// Program.cs
// You can inject your own instance of `IOfficeWordPdfConverter`
services.AddPacemOfficeWordProcessor()
	.WithPdfConverter<MyConverterType>();

Or you can lean on the - actually sole - implementation of IOfficeWordPdfConverter, which relies on Microsoft Graph API.

You need an account bound to an Office 365 subscription, and an Azure Application relevant to that user with access to the Microsoft Graph API.

// Program.cs
// You can inject your own instance of `IOfficeWordPdfConverter`
services.AddPacemOfficeWordProcessor()
	.WithMicrosoftGraphPdfConverter(options => {
		options.TenantId = "00000000-0000-0000-0000-000000000000", // your tenant id
		options.ClientId = "00000000-0000-0000-0000-000000000000", // your application id
		options.ClientSecret = "Sneaky~Password", // your application secret
		options.UserId = "00000000-0000-0000-0000-000000000000", // the user id licensed w Office 365
	});

Then use it in your services, like this:

namespace Pacem.OpenXml.OfficeWord;

public class MyController : ControllerBase
{
    private readonly IOfficeWordProcessor _word;
    private readonly IOfficeWordPdfConverter _pdf;

    public MyController(IOfficeWordProcessor word, IOfficeWordPdfConverter pdf)
    {
        _word = word;
		_pdf = pdf;
    }

    // [...]
}

Usage

For a comprehensive list of usage example, please refer to Pacem.Extensions.OfficeWord documentation.

Here's a simple find and replace code sample.
The important part is the conversion function, which is the last instruction in the code sample.

string root = AppContext.BaseDirectory;
string source = Path.Combine(root, "file1.docx");
string target = Path.Combine(root, "file1-replaced.pdf");
await _word.Open(source)
    .Find("[_my_placeholder_]")
    .ReplaceWith("Hello, World!")
    .FlushPdfAsync(_pdf, target);
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.9.0-dirac 55 8/2/2025
0.9.0-cayley 104 7/31/2025
0.9.0-boyle 101 7/31/2025
0.9.0-abel 113 7/17/2025
0.8.11 154 5/27/2025
0.8.10 157 5/7/2025
0.8.10-fourier 96 5/2/2025
0.8.10-fibonacci 104 2/7/2025
0.8.10-fermat 111 2/3/2025
0.8.10-euler 105 2/3/2025
0.8.10-euclid 98 2/1/2025
0.8.10-dalembert 100 1/31/2025
0.8.10-cauchy 90 1/26/2025
0.8.10-cantor 106 12/18/2024
0.8.10-caccioppoli 120 12/6/2024
0.8.10-bourbaki 99 12/6/2024
0.8.10-abel 136 4/22/2024
0.8.6 177 3/17/2024
0.8.6-abel 109 3/14/2024
0.8.5 153 3/13/2024
0.8.4 148 3/12/2024
0.8.3 154 3/12/2024
0.8.2 150 3/11/2024
0.8.1 135 3/11/2024
0.8.0 163 2/4/2024
0.8.0-akkad 202 12/8/2023
0.7.4 256 11/20/2023
0.7.3 152 11/17/2023