Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate a PDF?

Tags:

c#

pdf

For my Microsoft Surface application I'd like to generate a PDF including some images. How should I start to do that?

EDIT: I don't want to convert a text or html document, but I want to create a pdf from scratch.

like image 319
RoflcoptrException Avatar asked Dec 28 '10 12:12

RoflcoptrException


2 Answers

PDFsharp is nice, free, relatively easy to use and compatible with WPF

like image 81
Nir Avatar answered Sep 19 '22 22:09

Nir


Two basic options:

  1. use a PDF specific library, like iText in @Kent's answer
  2. install a PDF printer and use any reporting/printing code.

Option 1) will be the most flexible and efficient way.
Option 2) is interesting when you already have code that prints what you want. It is a bit of a hassle to manage the output-file etc. It's very easy to support XPS as well.

like image 44
Henk Holterman Avatar answered Sep 20 '22 22:09

Henk Holterman