Questions tagged [pdf-generation]

PDF generation is the process of creating a PDF document using various tools or libraries.

Use this tag for any programming-related question concerning the creation of PDF files, be it with a 3rd-party library or tools like PDF printers or PDF converters, or PDF authoring applications.

Questions asking us to recommend or find a tool, library or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam.

Related tags: ,

7433 questions
75
votes
5 answers

How to convert HTML to PDF using iTextSharp

I want to convert the below HTML to PDF using iTextSharp but don't know where to start:

This is some sample

Chris Haas
  • 53,986
  • 12
  • 141
  • 274
70
votes
2 answers

How to make annotation like highlighting, strikethrough, underline, draw, add text, etc in android for a pdf viewer?

Many applications like RepliGo, Aldiko, Mantano, ezPdf in android market make this type of annotation in their pdf viewer shown in the below image. I tried in many ways to implement this annotation but I failed. I have a pdf viewer for android and…
BobDroid
  • 1,898
  • 5
  • 19
  • 39
67
votes
12 answers

Rails: Error running wkhtmltopdf -- (error while loading shared libraries)

When my app runs (or when I run from commandline) the wkhtmltopdf command I get the following error: (showing it from command line) #> wkhtmltopdf wkhtmltopdf: error while loading shared libraries: libXrender.so.1: cannot open shared object file:…
Ben
  • 9,725
  • 6
  • 23
  • 28
64
votes
7 answers

Export html to pdf in ASP.NET Core

I want to export a piece of html to a pdf file but i do not any compatible nuget package. When I try to install anyone: "X not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0)." Does anyone know any way to export to a pdf using asp.net…
Carlos
  • 641
  • 1
  • 5
  • 5
63
votes
6 answers

Open Source HTML to PDF Renderer with Full CSS Support

I asked about getting iTextSharp to render a PDF from HTML and a CSS sheet before here but it seems like that may not be possible... So I guess I will have to try something else. Is there an open source .NET/C# library out there that can take HTML…
Adam Haile
  • 30,705
  • 58
  • 191
  • 286
57
votes
1 answer

Converting HTML to PDF using PHP?

Possible Duplicate: Convert HTML + CSS to PDF with PHP? Is it possible to convert a HTML page to PDF using PHP, and if so, how can it be done? Specifically, the page is an invoice generated dynamically. So I would like it loaded…
Ali
  • 261,656
  • 265
  • 575
  • 769
55
votes
4 answers

How to modify the first pageNumber or execute JS in header or footer template with Chrome DevTools Protocol's printToPDF

I'm using Headless Chrome to print out PDF files by using the printToPDF CDP method. If we set the displayHeaderFooter parameter to true, then we can set specific page header and footer by using the parameters headerTemplate and footerTemplate. The…
54
votes
3 answers

Creating page headers and footers using CSS for print

I'm creating a PDF using Flying Saucer (which dumps out CSS/HTML to iText to a PDF) and I'm trying to use CSS3 to apply an image header and footer to each page. I'd essentially like to put this div in the top left of each page:
Naftuli Kay
  • 87,710
  • 93
  • 269
  • 411
54
votes
4 answers

Convert canvas to PDF

Is it possible to directly convert canvas to pdf using JavaScript (pdf.js or something like that)? Is there another possible way like canvas to img and then img to pdf? Can you give me an example?
Kasta
  • 1,724
  • 2
  • 16
  • 22
54
votes
11 answers

Calling wkhtmltopdf to generate PDF from HTML

I'm attempting to create a PDF file from an HTML file. After looking around a little I've found: wkhtmltopdf to be perfect. I need to call this .exe from the ASP.NET server. I've attempted: Process p = new Process(); …
Sean
  • 2,453
  • 6
  • 41
  • 53
50
votes
14 answers

How to implement custom fonts in TCPDF

In TCPDF, there are only a few fonts to choose from, to create pdf files. I want to set Tahoma as my pdf font. How can I include Tahoma in TCPDF??
Alfred
  • 21,058
  • 61
  • 167
  • 249
50
votes
6 answers

PDF Generation Library for Java

I know this has been asked before, but I'm still undecided on which PDF generation framework to use for my current project. My requirements on-the-fly generation of PDF documents (mainly order forms, invoices) Java based easy to layout should be…
Stefan Haberl
  • 9,812
  • 7
  • 72
  • 81
49
votes
8 answers

How to generate a PDF using Angular 7?

I have to generate a PDF report from data entered by a user, which would be saved in an object. So far, I have come across stuff which generates an HTML page and then takes a screenshot and converts it into PDF. I am looking to generate a PDF…
The Bored Theorist
  • 499
  • 1
  • 4
  • 4
49
votes
7 answers

Print PDF in Firefox

How to print a PDF in Firefox? This function works in Chrome but not in Firefox function print_pdf(url){ var id = 'iframe', html = ''; $('#main').append(html); …
clarkk
  • 27,151
  • 72
  • 200
  • 340
48
votes
5 answers

dompdf Page break if element is exceeding page height?

What is the best way to do page breaks in dompdf? I have had a look here at the page-break-before css attribute, but it didn't work when I did: table {page-break-before:auto;} The page still breaks in the middle of my table. Is it possible to setup…
startupsmith
  • 5,554
  • 10
  • 50
  • 71