calculate the number of PDF pages generated from a HTML document - html

So basically I am creating PDF documents in my app using wkhtmltopdf.
My app is a builder app, the user adds and removes some elements and then presses a button to send the data to the server to generate to PDF doc.
I want to show the user the number of pages of the PDF that is going to be generated. Is it possible somehow calculate that based on the document height and font size's?

Related

How to build Angular HTML template on button click?

I'm trying to create an HTML template to export it as a PDF File, but I'm not sure on how to do this using Angular's engine;
What I need to do basically is to build this template when I click a "Download As PDF" button, and this should take all the information I have in one component and use to create an HTML document which will be exported, but not shown on the screen or anything like that.
Since my actual screen and the format I need to have on the PDF file I'm not able to just use the same component's HTML template, so I'm looking to build the template structure I need when I click on the button.
My current component uses mat-tabs to display information, but in the actual PDF I need each tab to be its own individual section in the page; so I would need to build this new HTML structure only when I want to generate the file
Any ideas how i could do something like this?
Based on your criteria this sounds like it needs to be a whole new component that is created specifically to the format needed for the PDF export. You'd add the correct headers such as content-disposition to have your PDF attachment.
Your next task is to determine how to get your data into that new component that is dedicated to PDF export. If you are already using a Redux/NGRX store in your app then that is probably easy enough to use.
A more common way to share data across components within the same module is to utilize an Angular service. This service is injected into both versions of the component and all important data is saved and retrieved from that service.

PDF Template - HTML Form - Automatically Send To Email

I was hoping I could get some insight as to how to perform the following on my website;
I have a PDF application that I would like users to be able to fill out and hit 'Submit' to automatically send the filled-out application to my email.
Would it be possible to have an editable pdf on a web page that they fill out on the web page? When they are done they would hit submit and it would send a copy of this filled-out pdf to my email
Would it be possible to have an html form that the user fills out and when they hit submit, it automatically creates a copy of the pdf, fills in the fields using the html form information, and sends it to my email?
I have very little knowledge when it comes to this so any sort of assistance would be helpful.
Thank you!
Would it be possible to have an editable pdf on a web page that they fill out on the web page? When they are done they would hit submit and it would send a copy of this filled-out pdf to my email
I don't know about this.
Would it be possible to have an html form that the user fills out and when they hit submit, it automatically creates a copy of the pdf, fills in the fields using the html form information, and sends it to my email?
I know about this.
You can do this by using mpdf and PHPMailer libraries. I am using them in my projects. I will soon paste here an example.

How to embed local HTML file to existing GWT page

I have a page that is constructed by GWT, when the page get loaded, I will display some required content in it. And then if user click a certain button on the page, I will send request to server side and server will return me a HTML file(a chart generated by jquery plotting tool) stored in local directory, I need to display this HTML file into the existing GWT page's certain widget.
I tried to use Frame in GWT to link to the local HTML file and display it, it get failed, googled and found it's because of browser security setting.Please share your thought, any idea is appreciated.

Convert live HTML to a PDF with iTextSharp

I want to save a webpage as a PDF using iTextSharp.
The HTML I want to save as a PDF is generated from ASP NET with labels populated via a database. There are also user checked checkboxes.
How can I get the current HTML being displayed in the browser and save it as a PDF on the server side?

Sending a html form via email as a pdf

I have made an html form. What i want to happen is when the user clicks submit for the page to be emailed as a pdf (like the pdf that comes up if you print the webpage). I've been looking a all sorts of script but nothing seems to do what I want.
You will have to have a server-side component that takes the values, creates the PDF, and then e-mails it appropriately.
You'll be surprised to hear that not all browsers can easily make pdfs out of web pages. Hence, there is no universal JavaScript command that simply taps into a browser's capabilities. That leaves you with options:
Generate the pdf on the server (using, say, pdfbox, and send the email right from the server (using good old sendmail).
Generate the pdf on the server, have the user download it, and then transfer it all to his email client. (Might just work, see on Stackoverflow).
Generate the PDF in the browser, cross-platform. There are some Javascript-only libraries that can generate PDF.
Use Safari's PDF capabilities. Safari can make PDFs just in the print dialog. Explain that to your users and call window.print().