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
30
votes
4 answers

How to set a background color of a Table Cell using iText?

While it is of course possible to use BaseColor, by default, it offers very limited choices. I wonder how can i add my own custom color to the document? ... PdfPTable table = new PdfPTable(3); PdfPCell cell = new PdfPCell(new…
James Raitsev
  • 92,517
  • 154
  • 335
  • 470
30
votes
2 answers

How can I generate a PDF index from pdfLaTeX?

I often generate reports from pdfLaTeX using TeXworks, and would like to generate a document index, which will appear in the sidebar of a PDF viewer, (e.g. evince, Adobe Reader). Are there any packages which will allow me to do so?
levyd
  • 589
  • 2
  • 5
  • 8
29
votes
11 answers

How can I combine two PDF pages show up on the same page?

I am looking for a free tool that allows re-arranging pages of a PDF document and combining multiple pages per sheet. The first part (re-arranging) is easily solved by many tools (I use PyPDF). The problem is with the second requirement: to combine…
Boris Gorelik
  • 29,945
  • 39
  • 128
  • 170
29
votes
10 answers

Google Docs viewer returning 204 responses, no longer working, alternatives?

UPDATE 2016-11-16 9:53am EST It appears many people are still seeing 204 responses even though Google has claimed to have "fixed" the problem. When I myself tested the loading of a document 50 times, 3 of those times Google returned a 204 response.…
Art Geigel
  • 1,915
  • 3
  • 22
  • 24
29
votes
3 answers

Save Open XML as PDF

As part of an investigation into enterprise level server side document generation I have come across Open XML. For those that have used this, how successful were you? Would you recommend it? Can you save the OpenXML to PDF directly or would I need…
Gineer
  • 2,358
  • 4
  • 26
  • 40
29
votes
5 answers

How make 2 column layout in R markdown when rendering pdf?

When rendering html documents with rmarkdown there are ways to make a two columns layout, e.g. here Is there an easy way to render a pdf document with two column layout? Is there an example code somewhere?
rdatasculptor
  • 8,112
  • 14
  • 56
  • 81
28
votes
10 answers

Create new PDF from template with PHP

I have a docx document file set up with formating and layout, which I saved as a PDF file. I want to use this pdf file as a template for creating new pdf files pre-filled with user data. I have seen FPDF, FPDI, tcPDF, domPDF, Zend PDF,…
Kim
  • 2,747
  • 7
  • 41
  • 50
28
votes
6 answers

PHP create PDF invoice

Hi does anyone know how I can create a nicely formatted PDF invoice through PHP? Ideally I'm looking for something with a header and then an itemised listing of the products with some sort of table around. After a quick Google I would be comfortable…
Martin
  • 10,294
  • 11
  • 63
  • 83
28
votes
4 answers

How to handle PDF pagination in PhantomJS

I am using PhantomJS to create PDFs from html. It works fine, but I can't find out how to work with pagination; I want to create a page for each div in my document, but I can't find anything in the doc. about pagination. If my document is short, it…
Rayjax
  • 7,494
  • 11
  • 56
  • 82
27
votes
2 answers

Print to PDF in a for loop

I want to loop over a plot and put the result of the plot in a PDF. The following code is used to do this: What this does is loop 3 times and plot 3 different plots from the iris dataset. Then it should save it to the C:/ drive. The PDF files are…
Sir Ksilem
  • 1,195
  • 2
  • 12
  • 27
27
votes
4 answers

How to render an ASP.NET MVC View in PDF format

I'm working with ExpertPDF's Html-to-PDF conversion utility for this question (although I'm open to other libraries if there's sufficient documentation). In short, I have a view that is formatted a specific way and I would like to render it as a PDF…
nkirkes
  • 2,635
  • 2
  • 21
  • 36
26
votes
4 answers

How to generate PDF from markdown using pure ruby

I'm currently using Kramdown to generate HTML from Markdown in Ruby. I know that I can generate a latex file using kramdown and convert it to pdf usaing a command line utility. But I want a pure ruby solution. Is there a way to convert markdown to…
Dimas Kotvan
  • 723
  • 1
  • 7
  • 10
26
votes
8 answers

Converting HTML to PDF (not PDF to HTML) using PHP

I am a PHP developer and in one of my projects, I need to convert some HTML documents (about 30 to 50 pages) into PDF documents. My search has turned up the following possible solutions. Among them are some PHP libraries and some command line…
Santosh S
  • 4,165
  • 6
  • 32
  • 37
26
votes
4 answers

Compress existing PDF using C# programming using freeware libraries

I have been searching a lot on Google about how to compress existing pdf (size). My problem is I can't use any application, because it needs to be done by a C# program. I can't use any paid library as my clients don't want to go out of Budget. So…
Prahalad Gaggar
  • 11,389
  • 16
  • 53
  • 71
25
votes
2 answers

How to use the browser's (chrome/firefox) HTML/CSS/JS rendering engine to produce PDF?

There are nice projects that generate pdf from html/css/js files http://wkhtmltopdf.org/ (open source) https://code.google.com/p/flying-saucer/ (open source) http://cssbox.sourceforge.net/ (not necessarily straight pdf…
David Hofmann
  • 5,683
  • 12
  • 50
  • 78