DEV Community

Fernando Rodrigues Cristan
Fernando Rodrigues Cristan

Posted on

Vue.js printing

Hello everyone, I have a task to implement sales impressions and reports in the application I work on.

I have created a separate page with the data separated from the report and I request it to be printed by the browser, but I have had problems with the page break.

The page break does not occur as expected and does not keep the header on the next page.

Has anyone ever experienced this? Any tips help.

Top comments (4)

Collapse
 
aarone4 profile image
Aaron Reese

AWS, Azure or GCP; you may even be able to do it on DigitalOcean or one of the other second level cloud providers.
Do a search for Syntax.fm podcast. They had an episode a few weeks ago interviewing someone who had done just what you are looking for. From memory they used a Serverless function to spin up a headless browser and passed the DOM to it, then generated a PDF to S3 bucket and returned the URL,

One of the issues they found with having the browser do it natively (as you have found out) is that layout and page breaks can be tricky.

You may also want to look at whether there are any decent pdf .net libraries, or if you know the report details beforehand, use SSIS and PowerBI or Reporting Services to generate the report pack as a PDF.

Collapse
 
fernandocristan profile image
Fernando Rodrigues Cristan

Thanks!! I will check!!

Collapse
 
aarone4 profile image
Aaron Reese

I would look at creating a pdf file, possibly via a serverless function and return that rather than an HTML page.

Collapse
 
fernandocristan profile image
Fernando Rodrigues Cristan

Would this function be in aws for example?
I've never worked with a serveless function.

On the backend we use dotnet and the solution available to generate pdf is not very robust