You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+34-3Lines changed: 34 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,10 +18,24 @@ then I do love-me-some-coffee!*
18
18
19
19
## Updates / Change Log
20
20
21
+
##### Updated the project to v1.6 with the following:
22
+
- Updated Apache FOP to v2.11 (latest as of 2025-05-20).
23
+
- Update to now use Java Azure Functions v4 (v3 is fully deprecated by end of 2022).
24
+
- Updated Java to latest supported version Java v21 ([Using Azul Zulu OpenJDK](https://www.azul.com/downloads/?version=java-21-lts&package=jdk#zulu)).
25
+
- Updated all other packages to latest stable versions.
26
+
- Upgraded project `apachefop-serverless-az-func.iml` to IntelliJ 2025 Community.
27
+
- Resolved bug/breaking issue with `ApacheFopJavaResourcesFileResolver` not being used in v2.11 when calling `FopFactoryBuilder.setConfiguration()` (as it was in FOP v2.6).
28
+
- The new version of FOP upgraded from FOP v2.6 to v2.11 introduced a bug (breaking issue) where the `ResourceResolver` injected to the constrcutor of `FopFactoryBuilder` is not honored resulting in embedded Fonts (java resources) no longer being resolved.
29
+
- The custom resolver is lost when calling `FopFactoryBuilder.setConfiguration()`, whereby the code now instantiates a default resource resover that is actually passed to the `FontManager` instead of the resource resolver we provided in the constructor.
30
+
- This worked fine in Fop v2.6 (and maybe other versions).
31
+
- The resolution is to initialize `FopFactoryBuilder` differently now by parsing the configuration directly from the `Stream` using `FopConfParser` which allows us to provide the `ApacheFopJavaResourcesFileResolver` into it's constructor instead (that is then correctly honored).
32
+
- We are then able to call `FopConfParsergetFopFactoryBuilder()` to get the fully initialize `FopFactoryBuilder` from the `FopConfParser`.
33
+
- Everything works as expected after that!
34
+
21
35
##### Updated the project to v1.5 with the following:
22
36
- Add support to read the Accessibility flag correctly from ApacheFOP configuration as noted in the documentation; a bug exists where the value is not loaded so we manually support this now in a way that is fully compliant with the documentation.
23
37
- The original support from Azure Function configuration (environment variable) is still supported also.
24
-
- Several small code improvements for consistency
38
+
- Several small code improvements for consistency.
25
39
- Additional debugging log added to better know if rendering process was completed (e.g. logs SUCCESS along with Pdf Byte Size).
26
40
27
41
##### Updated the project to v1.4 with the following:
@@ -30,7 +44,7 @@ then I do love-me-some-coffee!*
30
44
- This should make it easier to get up and running quickly with either IDE.
31
45
- Resolved a bug in the Font loading/path handling when running in Windows Host (due to existing font paths).
32
46
- Updated Microsoft's `azure-functions-maven-plugin` to address various issues (esp. the need for a GUID in the deployment name which broke VS Code's ability to debug).
33
-
- Pom.xml cleanup to eliminate various "*Problems*" flagged by VS Code's pom parsing (using M2Eclipse processor
47
+
- Pom.xml cleanup to eliminate various "*Problems*" flagged by VS Code's pom parsing (using M2Eclipse processor).
34
48
- Various small code cleanup items as noted in VS Code Java "*Problems*" tab.
35
49
36
50
##### Updated the project to v1.3 with the following:
@@ -148,6 +162,23 @@ If you'd rather just deploy directly to Azure, then there's some info on using G
148
162
## Additional Features:
149
163
150
164
### GZIP Compression:
165
+
166
+
#### Request Compression:
167
+
Since some reports may be quite large XSL-FO sources you can submit them with GZIP compression to reduce the size of the request payload.
168
+
This is especially useful for large reports with lots of text content, as the text tends to be more compressible than binary data.
169
+
170
+
To do this you should post the payload to the `/api/apache-fop/gzip` endpoint (insetead of the default `/api/apache-fop/xslfo` which expects `String` inputs) which expectes a GZIP compressed Byte Array (`Byte[]`) content body on the request.
171
+
172
+
In addition the following Headerss should be correctly specified on the Request:
173
+
-`Content-Encoding`: `gzip`
174
+
-`Content-Type`: `application/octet-stream`
175
+
176
+
This is already completely supported, and handled for you, when using the .NET Client available in Nuget and discussed in more detail below 👇: [PdfTemplating.XslFO.Render.ApacheFOP.Serverless](https://www.nuget.org/packages/PdfTemplating.XslFO.Render.ApacheFOP.Serverless/).
177
+
178
+
**NOTE:** The reason that we have two distinct/separate endpoints is because it allows us to optimize the endpoints using Azure Funcitons default binding and ensures we are using any optimizations that Microsoft may provide
179
+
for different kinds of input bindings (`String` vs `Byte Array`) -- improving performance & minimizing any risk of double encoding/de-coding of large content body reqeusts, unnecessary memory utilizaiton, streaming optimizations, etc..
180
+
181
+
### Response Compression
151
182
In addition to rendering the PDF, this service already implements GZIP compression for returning the Binary PDF files. This can greatly improve performance and download times, especially for PDFs rendered without much imagery, as the text content bytes tends to be more compressible.
152
183
153
184
All you need to do is add the `Accept-Encoding` header with a value of `gzip` to the request:
A full blown implementation of `Razor Templating + ApacheFOP.Serverless` is available in my [PdfTemplating.XslFO project here](https://github.com/cajuncoding/PdfTemplating.XslFO).
242
273
243
274
#### .NET Client
244
-
The `PdfTemplating.XslFO` project also provides ready-to-use .NET Client for `ApacheFOP.Serverless` that is readily availalbe in Nuget: [PdfTemplating.XslFO.Render.ApacheFOP.Serverless](https://www.nuget.org/packages/PdfTemplating.XslFO.Render.ApacheFOP.Serverless/)
275
+
The `PdfTemplating.XslFO` project also provides ready-to-use .NET Client for `ApacheFOP.Serverless` that is readily available in Nuget: [PdfTemplating.XslFO.Render.ApacheFOP.Serverless](https://www.nuget.org/packages/PdfTemplating.XslFO.Render.ApacheFOP.Serverless/)
245
276
246
277
It illustrates the use of both Xslt and/or Razor templates from ASP.Net MVC to render PDF Binary reports dynamically from queries to the [Open Movie Database API](http://www.omdbapi.com/). And it has now been enhanced to also illustrate the use of _ApacehFOP.Serverless_ microservice for rendering instead of the embedded legacy FO.Net implementation.
0 commit comments