REPORTING SPECS

CASES
1734 - REPORTS:GRIDS: - grid filter name and summary of filter criteria available as fields to print on report


REQUIREMENTS

- All v7 reports ported to RAVEN
    - ALL Fields even the ones that don't show on the report but are available for adding to a report in the editor need to be available

	- REPORTS
			- Report object has following properties:
				- DataList name it's based off of
				- Required fields from DataList
				- Report template itself with it's own code and template requirements TBD			
			- Report columns returned: When user selects to show a report, client will fixup any missing columns from the datalistview currently in use
				- For example they are viewing a table based on a TestWidgetDataList DataListview with only 3 columns in it
				- They drop down the reports list which shows all reports based off TestWidgetDataList view
				- They select a report to print.
				- Report code looks at report's required fields from DatalistView and sees report uses 6 fields listed
				- Code compares report fields to in use DataListview fields and appends any report required fields missing from current view to the right of the collection in the current DataListview 
				- When report is run it will have all fields this way returned but will still be sorted and filtered by table view
			- As part of editing process user can select an existing datalistview to prime their report editing view
			- A report can be selected from any client table that is based on the same view
		

//=======================


USEFUL REPORTING RELATED LINKS

			https://github.com/jsreport/jsreport-core
			https://github.com/jsreport/jsreport-core/blob/master/lib/render/engineScript.js

			//actual render here
			https://github.com/jsreport/jsreport-chrome-pdf/blob/d3fe318aac3628d8cb62f86f8f71314f21745798/lib/conversion.js

			//PDF utils
			https://github.com/jsreport/jsreport-pdf-utils

			They use a Mozilla library called pdfjs and their utils are basically just wrappers around using it
			https://github.com/mozilla/pdf.js
			
			hub to docs here:
			https://mozilla.github.io/pdf.js/
			
	This is the jsreport designer libs used for reference: https://github.com/jsreport/jsreport-studio/blob/master/package.json
https://jsreport.net/learn/api

Report templates pre-designed and open source: https://github.com/wildbit/postmark-templates

HTML -> PDF
	JSREPORT has a comparison table of various html to pdf tools here:
		https://jsreport.net/learn/pdf-recipes


	Headless Chrome
		https://github.com/jsreport/jsreport-chrome-pdf
		FAST SPEED (according to jsreport docs)
		jsreport uses headless chrome by default which has built in pdf from html ability.
		they use a NODE library Puppeteer for it, but there is a c# wrapper for .net core linux windows mac: https://github.com/hardkoded/puppeteer-sharp
			some kind of example that may be relevant: https://github.com/kblok/netconfar-puppeteer-sharp-demo/blob/master/hacking-the-browser-api/Controllers/MediumController.cs#L13
			Maybe not the only one for c# core, need to dig around
		Issues:
			Issue with header / footer not being settable apparently which is a big breaking issue for many biz reports usage
			someone said that another pdf tool can be used to set those post processing but fuckery abounds
			other solutions below apparently don't have this issue.
			Even jsreport has listed workarounds and tools to resolve this
			Update: apparently there are ways:
				https://stackoverflow.com/questions/44575628/alter-the-default-header-footer-when-printing-to-pdf?noredirect=1&lq=1
				see last comment seems relevant, also other linked cases all mention various things.  Finally, could use a pdf writer tool to post process maybe.

			There seem to be many potential issues with missing libraries, rights and sandbox and etc etc etc on linux			
			These things kind of turned me off this a bit, it's not plug and play and simple
			

		LINKS:
			https://github.com/hardkoded/puppeteer-sharp
			https://github.com/puppeteer/puppeteer
			https://stackoverflow.com/search?q=puppeteer-sharp
			https://stackoverflow.com/questions/62042078/puppeteer-sharp-for-server-side-html-to-pdf-conversions
			https://www.singlestoneconsulting.com/blog/how-to-generate-server-side-pdf-reports-puppeteer-d3-handlebars/
			https://github.com/hardkoded/puppeteer-sharp/issues/1510 - shows being used by someone other than jsreport which buries all the details in endless libs
			https://github.com/hardkoded/puppeteer-sharp/issues/1514

	WeasyPrint
		https://github.com/jsreport/jsreport-weasyprint-pdf
		SLOWEST SPEED
		https://github.com/Kozea/WeasyPrint based on python, does it's own rendering doesn't rely on a web browser engine like the rest
		free, recommended by wkhtmltopdf author as an alternative
		May be slow, slower than the other options likely, has some installation steps that are a bit convoluted but ironically only for windows as it's included in package managers
		Very good support for modern css3 PAGE properties apparently
		WRAPPER
			https://github.com/balbarak/WeasyPrint-netcore/blob/master/src/Balbarak.WeasyPrint/WeasyPrintClient.cs


	wkhtmltopdf 
		https://github.com/jsreport/jsreport-wkhtmltopdf
		MEDIUM SPEED
		https://wkhtmltopdf.org/downloads.html
		Well used, old based on older webkit so doesn't support css3 but likely enough for our purposes
		has an easy installer for all platforms
		free
		Has warnings about how unsanitized html can take down a server or own it somehow
		WRAPPERS
			https://github.com/carloscds/HtmlToPDFCore/tree/master/HtmlToPDFCore  This one looks cool, all platforms supported includes binary possibly?
			https://blog.elmah.io/generate-a-pdf-from-asp-net-core-for-free/


HTML -> DOCX
	This is a possiblity that needs to be researched, instead of pdf go docx which is in theory multi platform and openable on other devices? Not sure
	https://github.com/jsreport/jsreport-docx
	https://github.com/EricWhiteDev/Open-Xml-PowerTools

HTML -> XLSX
	https://github.com/jsreport/jsreport-xlsx

HTML -> TEXT
	https://github.com/jsreport/jsreport-html-to-text
	https://github.com/jsreport/jsreport-text


TEMPLATE ENGINE
	https://github.com/jsreport/jsreport-handlebars
	Handlebars by default for jsreport which is easy peasy to work with

PDF META DATA EDITING
	https://github.com/jsreport/jsreport-pdf-meta

Render outputs
	JSReport renders to different outputs, they call it recipes https://jsreport.net/learn/recipes
	HTML - just outputs as html for viewing in the browser / printing from browser
	PDF: https://jsreport.net/learn/pdf-recipes
		Outputs 5 different pdf converters because they all support different feature sets which is ominous



BAR CODE STUFF
	Bar codes: https://github.com/metafloor/bwip-js 
		https://stackoverflow.com/questions/19017512/use-canvas-inside-a-handlebars-template
		https://github.com/metafloor/bwip-js#browser-usage
		https://www.scandit.com/blog/types-barcodes-choosing-right-barcode/
		https://github.com/metafloor/bwip-js/wiki/BWIPP-Barcode-Types

		 let opt = {
      bcid: "code128", // Barcode type
      text: "0123456789", // Text to encode
      scale: 3, // 3x scaling factor
      height: 10, // Bar height, in millimeters
      includetext: true, // Show human-readable text
      textxalign: "center" // Always good to set this
    };
