diff --git a/lib/Domain/Builders/MergeOfficeBuilder.cs b/lib/Domain/Builders/MergeOfficeBuilder.cs index d84de99..ec9bb99 100644 --- a/lib/Domain/Builders/MergeOfficeBuilder.cs +++ b/lib/Domain/Builders/MergeOfficeBuilder.cs @@ -87,6 +87,17 @@ public MergeOfficeBuilder UseNativePdfFormat(PdfFormats format) this.Request.UseNativePdfFormat = true; this.Request.Format = format; + return this; + } + + /// + /// This tells gotenberg to enable Universal Access for the resulting PDF. + /// + [PublicAPI] + public MergeOfficeBuilder EnablePdfUa() + { + this.Request.EnablePdfUa = true; + return this; } } \ No newline at end of file diff --git a/lib/Domain/Requests/MergeOfficeRequest.cs b/lib/Domain/Requests/MergeOfficeRequest.cs index 500a886..8bd3b2c 100644 --- a/lib/Domain/Requests/MergeOfficeRequest.cs +++ b/lib/Domain/Requests/MergeOfficeRequest.cs @@ -59,7 +59,12 @@ protected override string ApiPath /// Note: the documentation says you can't use both together but that regards request headers. /// When true and Format is not set, the client falls back to PDF/A-1a. /// - public bool UseNativePdfFormat { get; set; } + public bool UseNativePdfFormat { get; set; } + + /// + /// This tells gotenberg to enable Universal Access for the resulting PDF. + /// + public bool EnablePdfUa { get; set; } protected override IEnumerable ToHttpContent() { diff --git a/lib/Extensions/MergeOfficeRequestExtensions.cs b/lib/Extensions/MergeOfficeRequestExtensions.cs index 845f79b..4273f5e 100644 --- a/lib/Extensions/MergeOfficeRequestExtensions.cs +++ b/lib/Extensions/MergeOfficeRequestExtensions.cs @@ -40,6 +40,11 @@ internal static IEnumerable PropertiesToHttpContent(this MergeOffic request.ExportFormFields.Value, Constants.Gotenberg.LibreOffice.Routes.Convert.ExportFormFields); + if (request.EnablePdfUa) + yield return BuildRequestBase.CreateFormDataItem( + "true", + Constants.Gotenberg.LibreOffice.Routes.Convert.PdfUa); + if (!request.UseNativePdfFormat && request.Format == default) yield break; if (!request.UseNativePdfFormat && request.Format != default) diff --git a/lib/Infrastructure/Constants.cs b/lib/Infrastructure/Constants.cs index 106f0a3..dac8281 100644 --- a/lib/Infrastructure/Constants.cs +++ b/lib/Infrastructure/Constants.cs @@ -107,6 +107,8 @@ public static class Convert public const string PdfFormat = CrossCutting.PdfFormat; public const string Merge = "merge"; + + public const string PdfUa = "pdfua"; } } }