cajuncoding / PdfTemplating.XslFO

This is a C# .NET solution that tests and illustrates the capabilities of Xsl-FO for dynamically generating PDF documents. It provides a way to generate the XSL-FO source xml from Xslt or Razor Templating to address various development teams. And it provides basic WinForms Application that can be used to aid in developing the Xslt and Xsl-FO markup.
https://github.com/cajuncoding/PdfTemplating.XslFO
Apache License 2.0
30 stars 5 forks source link

cannot use because of dependencies for PdfTemplating.XslFO NuGet package #4

Closed john1726 closed 3 years ago

john1726 commented 4 years ago

Please note that the NuGet package page says that there are no dependencies,

https://www.nuget.org/packages/PdfTemplating.XslFO.Xslt/

But when I test the demo app without having Adobe Acrobat Reader installed, I receive this error:

https://imgur.com/a/EBKfO4e

According to this page my company would then need to apply for a license from Adobe. This means I am unable to use the software:

https://acrobat.adobe.com/us/en/acrobat/pdf-reader/volume-distribution.html?readstep

So clearly there are dependencies. What do you suggest? TIA.

cajuncoding commented 4 years ago

The Nugget package page is correct - there are no dependencies on any Adobe libraries for the library itself.

If imported and implemented in your app (console, web app, winforms, etc) you can completely render a Valid Pdf document from a template (Xslt in the case of the url you posted; but could also be Razor, etc) and a data model using XSL-FO without any issues. The result is a byte array that can be saved to disk or streamed out. If saved to disk with *.pdf file name then the file can be opened in any PDF document reader you like (eg web browser, Adobe Pdf Viewer, etc).

The demo project here on GitHub includes a WinForms based viewer tool that I created for rapid local development of XSLT templates, but that is not part of the Nuget package. This tool does use the Adobe Pdf viewer to provide viewing of the fully rendered Pdf on screen within the tool. So the dependencies on Adobe are isolated to the Pdf Viewer tool only, that is also only available here in GitHub (not in Nuget).

So to be clear, the winforms app was never designed or intended to be distributed as a volume viewer, it is intended as a local development tool.

In the end the library is for rendering Pdf documents not visualizing them, the Pdf document spec is well established and there are viewers galore, so that is not the purpose of the project or library it’s the reason we choose Pdf format because viewers are ubiquitous.

So none of that is required. You could quickly code something similar on your own with a web app that loads the template from a local file every time you refresh the page and use the Pdf viewer that may be available in your browser (eg Chrome) to visualize it.

I can only assume you have some viable Pdf viewer that is approved for use in your company already, or else you wouldn’t be interested in using Pdf format for document rendering :-)

So worst case scenario is that you could create a small console app that reads your template from a file (Xslt, Razor, etc), reads your Data model (XML, Json) and renders the output and saves the byte array as a file. Then use the “Start ...” via system console command to launch the file (maybe have a batch file with parameters if necessary) depending on the viewer. And voila you’d have a reasonably efficient way to develop your templates locally.

Virtually all of these concepts are illustrated in some form in the project here on GitHub.

Finally, if your need is to actually include the real time rendering and viewing within your app on a local Windows thick client app, then the requirement of defining the appropriate viewer, and licensing of that viewer is your responsibility as a designer. I’ve successfully used the Adobe viewers in use cases of small sets of users that fall squarely under individual use. Otherwise just look at embedding Chrome browser viewer or other options for embeddable controls for your application.

I hope this helps!