Save PDF into local server
See original GitHub issueHi, html2pdf is awesome!
Congrats for this solution!
My html content is huge, so I slice into parts avoiding canvas size limitations. 😄
let fileName = "evaluation_xxx.pdf";
// Assuming "pages" is an array of HTML elements or strings that are separate pages:
let pages = [];
$('.evaluation-page-template.page').each(function () {
pages.push($(this)[0]);
});
// Generate the PDF.
let worker = html2pdf().from(pages[0]).set({
margin: 0,
filename: fileName,
html2canvas: { scale: 2 },
jsPDF: {orientation: 'portrait', unit: 'pt', format: 'a4', compressPDF: true}
}).toPdf();
pages.slice(1).forEach(function (page) {
worker = worker.get('pdf').then(function (pdf) {
pdf.addPage();
}).from(page).toContainer().toCanvas().toPdf();
});
worker = worker.save();
Can I save PDF file into server instead of download it? Maybe with some upload API to send to server? Can you help me?
Thanks!!!
Issue Analytics
- State:
- Created 4 years ago
- Comments:7
Top Results From Across the Web
Save pdf to local server - php - Stack Overflow
This worked for me, using the fpdf library, $pdf_data = $pdf->Output(); These 3 lines allow me to save the .pdf so I can...
Read more >How to save pdf to file server location? - CodeProject
I am able to get the generated pdf to download locally but when I send it to the file folder it gets corrupted...
Read more >Save modified PDF on server - PSPDFKit
A: There are 2 ways you can do this: Save the whole PDF: You can export the modified PDF as an arrayBuffer using...
Read more >How do I save a PDF locally on the server? - SugarClub
I just want to take a PDF Manager record and turn it into a PDF and save that PDF locally on the server....
Read more >Save Pdf documents in server side | ASP.NET Web Forms
How to save a PDF document by replacing the original PDF document in the server side of the PDF viewer control? · PdfViewerHelper...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@gcuculi Why need dataURI convert to blob?
Hi, everyone!!!
Many hours later I figured out using parts of other codes that I found around. My solution:
PHP code
I know html2pdf is recommended to let things in client side, but this solution (save into server feature) is not part of initial scope of this project, so save me a lot of time.
Thanks @eKoopmans for this awesome work.
Merry Christmas and a great new year for all of us!!!