pdfsharp

How do I walk through tree of Pdf Objects in PDFSharp?

I am trying to to walk though the tree of PdfItem objects in an existing PDF document using PDFSharp in c#. I want to create a hierarchy of all the objects as I go along -- similar to what the "PDF Explorer" example does -- but I want it to be a tree instead of a flat list of all the objects. The root node is document.Internals.Catalo...

How do I add a link to a file in PdfSharp?

I can't seem to get PdfSharp to show a picture for this annotation. It doesn't have the PdfAnnotation.Icon property, so I can't set that. XFont font = new XFont("Verdana", 10); PdfPage page = wDoc.Parent.Page; XGraphics gfx = wDoc.Parent.gfx; XRect rec = gfx.Transformer.WorldToDefaultPage(new XRect(new XPoint(30,...

PdfSharp, GDI+ and HTML printing

I currently have a "PrintingWebService" that I call from an AJAX page with all the information that is needed to construct a highly customized PDF printout using PDF Sharp and the PDFSharp's GDI+ mode, which takes DrawString and other commands that work basically just like GDI+ only they are drawn to the PDF. I then save the PDF file to...

Unacceptable performance rendering PDF Tables with ITextSharp and PDFSharp

I am trying to generate PDF files containing large numbers of tables. Each PDF could potentially be 150 pages in length. When using ITextSharp, the file sizes are up to 16 megabytes and have no noticeable shrinkage when zipped. When using PDFSharp, the file size is very reasonable at 2 or 3 megabytes but it takes an unacceptable l...

Printing PDFs with PDFSharp

Hello All-- I have the following code: using System; using System.Diagnostics; using System.IO; using PdfSharp.Pdf.Printing; namespace PrintPdfFile { class Program { [STAThread] static void Main(string[] args) { // Set Acrobat Reader EXE, e.g.: PdfFilePrinter.AdobeReaderPath = @"C:\\Documents and Setting...

Calculate text height based on available width and font?

We are creating PDF documents on the fly from the database using PDFsharp. I need to know the best way to calculate the height of the text area based on the font used and the available width. I need to know the height so I can process page breaks when required. ...

How to get table height in pdfsharp

I'm using PDFSharp to generate pdf documents and these documents (invoices) contain tables. Is there any way to determine the height of a table? I need to know the height as VAT and Total tables have to be positioned at the bottom of the page. I don't think a count of the rows would do because product descriptions can get wrapped resu...

PdfSharp save to MemoryStream

I want to save a PDFSharp.Pdf.PDFDocument by it's Save method to a Stream, but it doesn't attach the pdf header settings to it. So when I read back the Stream and return it to the user, he see that the pdf file is invalid. Is there a solution to attach the pdf header settings when PdfSharp saves to memory? ...

Tables and charts using PDFSharp

Hello! I just started with a project that requires me to write to PDF file. After some googling I decided on using PDFSharp which looks simple enough, however I have a few questions regarding drawing tables and charts. Is PDFSharp a good choice for writing pdf files that contain tables and charts? If no, can you recommend a better alte...

Keep table in one pice MigraDoc / PDFsharp

Hello! I am using PDFsharp / MigraDoc's to write tables and chart's to PDF files. This worked great so far, however MigraDoc's will always split my tables (vertically) when it should move the whole table to the next page in the document. How do I make sure the table will stay in one piece? Table class of MigraDoc.DocumentObjectModel.Ta...

PdfSharp on Mono

Has anyone tried to port PdfSharp library to Mono? I just ran MoMA against PdfSharp.dll v1.2 beta and I am getting about 12 P/Invoke errors and 10 or so Mono TODOs. Just wondering if anyone has ported PdfSharp over to Linux and OSX, if so, how did it go? Trying to evaluate if PdfSharp is a good candidate for me. ...

Sharepoint "Could not load file or assembly" "The system cannot find the file specified"

I have added a reference to a dll (sharpPDF) to my .net project. In the code it has picked up the dll and I can use it. When I deploy by sharepoint webpart i get the following error: Could not load file or assembly 'sharpPDF, Version=1.0.3511.18105, Culture=neutral, PublicKeyToken=f099e668beaaa0f9' or one of its dependencies. The system...

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 are: PdfSharp.PageSizes.A4 PdfSharp.PageOrientation.Portrait My problem is that these set...

PdfSharp: Text height/positioning problem

Whether I use XTextFormatter or not, I get the same error about the LayoutRectangle having to have a height of 0 or something like this. new PdfSharp.Drawing.Layout.XTextFormatter(_gfx).DrawString(text , new PdfSharp.Drawing.XFont(fontName, fontSize, (PdfSharp.Drawing.XFontStyle)fontStyle) , new PdfSharp.Drawing.XSolidBrush(Pd...

Need the .NET PDF library to edit pdf info

Hello there, I need the 100% .NET library to edit PDF Info like Author, Title, Creator, Subject and Keywords. All PDF libraries I tried are unable to do this without completely resaving the hole PDF documents. So for huge files (>35MB) it takes too much time. I need only to update several text fields (see above) and I don't need to resa...

pdfsharp - font embed?

I am given a file that has some other language font. They can not download the font, so they want me to embed it in the pdf. Now, I only have PDF Reader, so I cant edit or create a pdf file. so I decided to quickly do it in C#.NET using PDFSharp library, but I just cant seem to figure out how to embed fonts using pdfSharp?! Also, it'...

What's the fastest .Net PDF library to dump a bunch of bitmaps to PDF?

I have around 10 System.Drawing.Bitmap elements, which I want to dump to PDF. When combining them to a single bitmap, and then writing this to PNG, this takes me about 150 ms. Now I want to create a PDF out of my bitmaps (4 pages), but with PDFSharp this takes >2.5 seconds. Is there any library that is (way) faster at doing this? NB. I...

How can I do a find & replace using PDFSharp?

Hi All, I have a PDF file with 3 static place holders that I need to replace. The place holders are using the following format: [item1ToReplace] [item2ToReplace] [item3ToRepalce] So my question is how can I read in the pdf, replace the values, and save a new pdf using PDFSharp, or a simliar opensource library? Target language is ...

How to create PagePreview with more than one page using PDFSharp?

I am using PDFSharp to create PDF files in my C# application. It's working very good, but i did not find out how to create preview with more than one page. I have no trouble creating and saving document with multiple pages, also embedding PagePreview into my Form is working. But how do i display (and draw on) more than one page in the P...

find Char width in pixels for various Arial fontsizes

Hi, I have a program that is manually generating a pdf using PDFSharp in C#. Although it is rather tedious I have to use it and am nearing completion of the task. Only one issue remains Problem: I am wondering how I can find out what the width of a given char is for a given font size in Arial I am having trouble coming up with a more ...