Questions tagged [pdfsharp]

PDFsharp - A .NET library for processing PDF (create, merge, split, or modify PDF files). For questions related to using the PDFsharp library on any platform and with any programming language.

PDFsharp is the Open Source .NET library that easily creates and processes PDF documents on the fly from any .NET language. The same drawing routines can be used to create PDF documents, draw on the screen, or send output to any printer.

PDFsharp’s outstanding features

Here are just a few highlights:

  • Creates PDF documents on the fly from any .NET language
  • Easy to understand object model to compose documents
  • Newly designed from scratch and written entirely in C#
  • One source code for drawing on a PDF page as well as in a window or on the printer
  • Modify, merge, and split existing PDF files
  • Images with transparency (color mask, monochrome mask, alpha mask)
  • Font embedding and subsetting
  • The graphical implementation based either on GDI+ or WPF

PDFsharp Resources

Questions

Use this tag for all questions that relate to using the PDFsharp library.

MigraDoc is a different library from the same authors. MigraDoc includes PDFsharp and uses PDFsharp to create PDF files. Not all questions about MigraDoc justify the PDFsharp tag.
It is less confusing for people trying to answer your questions when you use the tag that corresponds to the API you are using (either or ). Simply look at the namespace of the objects you are using.

For questions about the HTML Renderer for PDF using PdfSharp use the tag.

Related Tags

, ,

Orthography

The name of the library is PDFsharp. When used for namespaces the name is written as PdfSharp following C# naming conventions. So unless you are referring to a namespace, the recommended writing is PDFsharp.

886 questions
11
votes
3 answers

How to get path of Properties.Resources.Image in .NET

I included an image as a resource following this post: How to create and use resources in .NET I am using PDFSharp library to create a PDF. The method to draw an image, requires the path of the image. How do I get the path of…
Crystal
  • 28,460
  • 62
  • 219
  • 393
10
votes
4 answers

PDFsharp can't find image (image not found)

I am using PDFsharp in an ASP.NET MVC application. I want to add an image but no matter what directory I put it in, it can't seem to find it. I have code like this as I am trying to copy the sample application Section section =…
leora
  • 188,729
  • 360
  • 878
  • 1,366
10
votes
1 answer

How to measure the text length using PDFsharp library

I have a requirement to measure the text length in a PDF and wrap the line if the length exceeds a certain amount. I am already using PDFsharp library. I already used the following code to determine the length of the text. public static Size…
Mori
  • 2,484
  • 5
  • 28
  • 45
10
votes
3 answers

C# PDF Sharp position in document

Hi I am using PDF sharp to print user input onto positions in a template document. The data (fields) are collected from user (web page) and written at appropriate positions on the document using drawstring method. Currently I am finding the Pixel…
josephj1989
  • 9,509
  • 9
  • 48
  • 70
10
votes
1 answer

Pdf sharp font style Bold,Italic and Underline together

Have any way set font style ItalicUnderline or BoldItalicUnderline? Thanks
Shahdat
  • 5,343
  • 4
  • 37
  • 37
9
votes
5 answers

Can PDFSharp create Pdf file from a Html string in Net Core?

This maybe sounds "easy" but I haven't found a real solution. I need to create Pdf files from Html strings from an API on .Net Core. The library must be free (Not payments or anything related). I found that PDFSharp was a good option, but now I…
Roger Ospina
  • 435
  • 1
  • 3
  • 14
9
votes
2 answers

Is it possible to use PDFsharp with .NET Core?

Is it possible to use PDFsharp library with .NET Core?
Rocket Singh
  • 469
  • 1
  • 10
  • 22
9
votes
0 answers

ZetPDF - Does anyone know the background of this Product?

Questions: Is ZetPDF just PDFSharp in disguise? Is this product going to stick around? Who are ZetPDF? We are currently using PDFSharp to create our PDFs from scratch. We need to be able to draw in specific areas, add images from embedded…
Sylvia
  • 1,022
  • 9
  • 20
9
votes
1 answer

PdfSharpCore image rendering issue

Completely unable to render JPEG image to PDF using PdfSharpCore. Code is as simple as public byte[] GetPdfContent() { ImageSource.ImageSourceImpl = new ImageSharpImageSource(); var document = new PdfDocument(); var logo =…
Ivan Zverev
  • 327
  • 2
  • 14
9
votes
1 answer

Add acroform with pdfsharp

how can i add Acroforms (or any inputfields) with pdfsharp lib to a pdf? For example a textbox (PdfSharp::Pdf::AcroForms::PdfTextField) I can't find any example for this, only read/modify. I found "page->Elements->Add(key,pdfitem)", but i cant…
user3600403
  • 339
  • 1
  • 2
  • 18
9
votes
1 answer

write lines on PDF

I want to write line by line on a pdf document the code I have is writing the text in the center of the page how can I write line by line? // Create a new PDF document PdfDocument document = new PdfDocument(); document.Info.Title = "Created with…
Ateeq
  • 797
  • 2
  • 9
  • 27
9
votes
1 answer

PDFsharp page size and set margin issue c#

I am converting an image to pdf using PDFsharp lib. I need to set margin & page size so I got a trick from this forum to set page size and margin. From here I got code which I used but getting error for two area. Here is code which I got. page =…
Thomas
  • 33,544
  • 126
  • 357
  • 626
9
votes
2 answers

How do I display a PDF using PdfSharp in ASP.Net MVC?

We're making an ASP.Net MVC app that needs to be able to generate a PDF and display it to the screen or save it somewhere easy for the user to access. We're using PdfSharp to generate the document. Once it's finished, how do we let the user save the…
Kevin
  • 14,655
  • 24
  • 74
  • 124
9
votes
2 answers

PdfSharp - Wrong PDF page settings when document is opened in Acrobat

I have written a piece of code which uses the PdfSharp library. The instance of PdfSharp.Pdf.PdfDocument created saves to disk as expected. The right content is displayed, but onto the wrong page settings. The default page settings for PdfSharp…
Will Marcouiller
  • 23,773
  • 22
  • 96
  • 162
8
votes
1 answer

PDFsharp Watermark

I am making an application that creates a watermark on a PDF that the user selects and I can't seem to get the watermark to appear on the selected PDF but I also get no errors. Any help would be appreciated. I am using PDFsharp version…
Jacob
  • 83
  • 1
  • 6
1 2
3
59 60