Is there a way to automate saving a PDF version of an HTML formatted report whenever it is viewed in the browser? - html

I am working with SQL Server and C# to create individual employee reports. I am using HTML and CSS to format the reports and display in a browser. The customer also wants a printout of every report. I would like to have a formatted PDF version of the report automatically saved to a folder on the server whenever a report is viewed in the browser. I could create a process to print all of the PDF pages at one time.

With regards to the generation of the PDF, as it happens I had to do something similar a couple of years ago.
I was generating HTML reports from C# that I needed to convert to PDF.
There is a nuget package named OpenHtmlToPdf that uses wkhtmlopdf to convert HTML to PDF.
At the time I also wrote a bit of blurb on this subject on my blog here!
For your scenario, when the customer requests a report, on the server side you could generate the html as you are now. Then you could use OpenHtmlToPdf to additionally generate a PDF version on the server at the same time.
All you would then need to work out is how to get the PDF link address to the user (email, web link, etc)

Related

RShiny Output as HTML or PDF

Originally, I built a shiny application that served as a dashboard for clients. However, my team later determined that, rather than having a live dashboard that clients can log into, we would simply send pdf reports. I have been trying to determine if there is a way to convert a shiny page into a static html file (or even better, directly as a pdf) in a fast and convenient programmatic way as there are hundreds of pages that need to be saved (one for each client).

Programatically send a copy of a local file system notebook to Onedrive Onenote

Locally, I have several OneNote notebooks in the OneNote 2007 format. For reasons out of scope it is difficult to convert them to the new format first.
I want to be able to send a copy of the notebook to OneNote Online so that I can read-only it from wherever OneNote Online is accessible.
Programmatically, I have used the OneNote desktop API to export a page as an MHT file. Then I have used further code to convert the MHT to an HTML file. Finally, I then used MS graph explorer (because I haven't written that part of the code yet), to create a new OneNoteAPI page with the HTML that I exported.
I had expected the resulting page in OneNote Online to look like the HTML I had just uploaded.
It .. did not.
a) Where before I had a nice OneNote list with checkboxes I now had them laid out vertically. So checkbox\nitem\ncheckbox\item.
b) The title box that was exported as part of the HTML .. remained in its place and the new page did not absorb it into its title box.
So, how can I programmatically send a page from a desktop OneNote to a OneNote Online folder and have it look the same?
NB: I actually want to send the entire notebook but am trying one page at a time.
NB2: I cannot port all the notebooks to OneNote online once off and then just use that. They need to live in the local network.
NB3: I suppose I could just set up an FTP site with the HTML pages that I just exported - that is plan Z.
Thank you

Scraping AJAX generated table to download PDFs in bulk

I'm trying to download (or alternatively open and save) approximately 30,000 PDF documents. The documents that are only accessible through a 3rd party service provider's website/platform (there are no ethical dilemmas here).
The website is secure and needs to be logged into (I have access) and the table is generated via AJAX. The report I intend on reading from has a URL of the form https://sub.website.com/au/report/index?id=1001# that doesn't change when dates or other filters change. In total there are 180,000+ table entries, not all have an associated invoice and not all invoices are required.
Using Chrome DevTools I can see the elements; table name is #reportResults, invoice details are in a html element.
There also looks to be an API but I don't know where to start here either.
How do I scrape data from this using VBA? I have downloaded the JSON.bas module recommended in other solutions for scraping JSON and AJAX. But for this situation I don't know how to use it and where to go from here.
I'm handy with VBA but have no experience with any other languages.

How to show SSRS URL Report in Print Preview Mode?

I am showing report from web (angular application) through SSRS URL. It shows me output like below.
How can i show report default as print preview mode? In PDF its showing correctly but i want same view in browser.
Thanks.!!
I am unaware of any option to do this. You can schedule this report to generate the PDF to a physical location and have your customers access the PDF directly if you want to hide the SSRS interface... but a lot of people like to export tables like this to Excel.
I recommend you educate your customers how to use this interface as it is pretty useful.

HTML controls in PDF

I ran into an interesting problem at work today. I got a request to provide a link to a certain PDF file from my company's homepage. Now, this PDF is to contain some testimonials etc. and is to be followed by a feedback page which has HTML like controls - radio buttons, textboxes and a submit button - We are still talking about the PDF here :)
Further, the PDF must open in the browser and if a user hits 'submit', the form data must be sent to a server script.
I must admit, I am a little stumped. I mean, is it even possible to put HTML controls in a PDF and, is it possible to submit a form from a PDF?
Any other thoughts on this problem?
Yes you can create forms in PDF. Following might be useful to you.
Adobe Acrobat Professional gives you
the ability to turn your previously
designed, standard PDF file into an
interactive form that clients can
download, easily fill out, print or
effortlessly return to you by email.
All they need is the free Adobe
Acrobat Reade
http://www.thedesigncubicle.com/2008/12/how-to-create-interactive-pdf-forms-to-impress-your-clients/
All PDF forms can be distributed via
email but can also be distributed to
web sites using FormArtist itself.
Data can be submitted straight from
forms back to your web server. It can
then be retrieved automatically and
stored in a database on your PC for
export or analysis.
http://www.quask.com/survey/applications_pdfforms.asp
You can't put HTML controls in a PDF, but you can add form fields to a PDF which support buttons, radio buttons, check boxes, text fields, etc. Form fields support the use of JavaScript, so it's possible to create some fairly interactive PDF forms.
You can create a PDF form with a submit button that when clicked will submit form data to a server. This requires the use of a file format called FDF. These PDF forms can be created by any number of different PDF development libraries or off the shelf products including Adobe Acrobat, Nitro PDF Professional, PDF Converter Professional and more.
Here are some articles that will help orientate you on PDF forms and FDF:
How to populate a PDF file's form with data from a web server
Web Hosting PDFs
Linking Up with FDF
Developing with PDF Forms
Where Should I use Acrobat JavaScript?
There are quite a number of different products from a variety of different companies. The Planet PDF Forum is a very useful resource too.
PDF forms can be submitted to a server. When the form data is submitted to the server, you'll need the services of the Adobe FDF (Form Data File) toolkit to parse the FDF file received at the server side. In order to create PDF Forms that submit FDF data to the server, one would require Adobe Acrobat or other similar software (for instance Nitro PDF Professional and PDF Converter Professional 6, thanks to Rowan for the links).
You also have the option of submitting a XFDF file to the server, that can be processed by any XML parser. Unless I'm mistaken, this requires you to have a license of Adobe Lifecyle Designer (or equivalent software) to create an XFDF file.