Skip to content

Commit ea062f5

Browse files
authored
Merge pull request #47 from lennartb-/develop
LGTM @lennartb- THANK YOU FOR THE PR!
2 parents c9a4187 + 6854915 commit ea062f5

4 files changed

Lines changed: 24 additions & 1 deletion

File tree

lib/Domain/Builders/MergeOfficeBuilder.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,17 @@ public MergeOfficeBuilder UseNativePdfFormat(PdfFormats format)
8787
this.Request.UseNativePdfFormat = true;
8888
this.Request.Format = format;
8989

90+
return this;
91+
}
92+
93+
/// <summary>
94+
/// This tells gotenberg to enable Universal Access for the resulting PDF.
95+
/// </summary>
96+
[PublicAPI]
97+
public MergeOfficeBuilder EnablePdfUa()
98+
{
99+
this.Request.EnablePdfUa = true;
100+
90101
return this;
91102
}
92103
}

lib/Domain/Requests/MergeOfficeRequest.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ protected override string ApiPath
5959
/// Note: the documentation says you can't use both together but that regards request headers.
6060
/// When true and Format is not set, the client falls back to PDF/A-1a.
6161
/// </summary>
62-
public bool UseNativePdfFormat { get; set; }
62+
public bool UseNativePdfFormat { get; set; }
63+
64+
/// <summary>
65+
/// This tells gotenberg to enable Universal Access for the resulting PDF.
66+
/// </summary>
67+
public bool EnablePdfUa { get; set; }
6368

6469
protected override IEnumerable<HttpContent> ToHttpContent()
6570
{

lib/Extensions/MergeOfficeRequestExtensions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ internal static IEnumerable<HttpContent> PropertiesToHttpContent(this MergeOffic
4040
request.ExportFormFields.Value,
4141
Constants.Gotenberg.LibreOffice.Routes.Convert.ExportFormFields);
4242

43+
if (request.EnablePdfUa)
44+
yield return BuildRequestBase.CreateFormDataItem(
45+
"true",
46+
Constants.Gotenberg.LibreOffice.Routes.Convert.PdfUa);
47+
4348
if (!request.UseNativePdfFormat && request.Format == default) yield break;
4449

4550
if (!request.UseNativePdfFormat && request.Format != default)

lib/Infrastructure/Constants.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ public static class Convert
107107
public const string PdfFormat = CrossCutting.PdfFormat;
108108

109109
public const string Merge = "merge";
110+
111+
public const string PdfUa = "pdfua";
110112
}
111113
}
112114
}

0 commit comments

Comments
 (0)