pdfsharp

PDFsharp Documentation

寵の児 提交于 2019-11-30 13:44:20
问题 Is it possible to find good documentation for the PDFsharp library? I searched on Google but I didn't find any reference documentation. I don't know how XGraphics.RotateAtTransform and XGraphics.TranslateTransform work. 回答1: The PDFsharp documentation is included in the source code. Help files created from the source code can be found here: http://pdfsharp.codeplex.com/releases The XGraphics class implements the same functions as the Graphics class from GDI+. So for further information about

PDFsharp Documentation

这一生的挚爱 提交于 2019-11-30 08:19:53
Is it possible to find good documentation for the PDFsharp library? I searched on Google but I didn't find any reference documentation. I don't know how XGraphics.RotateAtTransform and XGraphics.TranslateTransform work. The PDFsharp documentation is included in the source code. Help files created from the source code can be found here: http://pdfsharp.codeplex.com/releases The XGraphics class implements the same functions as the Graphics class from GDI+. So for further information about the two methods given in the question, search information about Graphics.RotateAtTransform and Graphics

PDFsharp Line Break

只谈情不闲聊 提交于 2019-11-30 06:52:42
问题 I am trying to get new line but if I use \n it does not work. Any way to have new line by adding something to string like \r\n (which also does not work) gfx.DrawString("Project No \n" + textBoxProjNumber.Text, fontUnder, XBrushes.Black, 230, 95); (the example snippet shows what I've tried but does not work). 回答1: Have you tried the XTextFormatter class? See here: http://www.pdfsharp.net/wiki/TextLayout-sample.ashx Code snippet: PdfDocument document = new PdfDocument(); PdfPage page =

Keep table in one piece MigraDoc / PDFsharp

♀尐吖头ヾ 提交于 2019-11-30 03:19:54
I am using PDFsharp / MigraDoc to write tables and charts to PDF files. This worked great so far, however MigraDoc 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.Tables has a bool KeepTogether property however it seems to have no effect (either set to true or false). Is there a way to do it manually? Is there any way to "measure" the distance from the end of the page and compare it to tables height? (Or any other way of knowing wether

PDFsharp edit a pdf file

时光毁灭记忆、已成空白 提交于 2019-11-30 01:51:59
Environment - PDFsharp Library, Visual Studio 2012 and C# as the language. I am trying to: read Test1.pdf (Width = 17 inches, Height – 11 inches) with 1 page add some text to it save it as another file (Test2.pdf) I am able to do all the following. But when I open the file Test2.pdf the size of the page is getting reduced to Width = 11 inches, Height – 11 inches. These PDF files that I am using are Product Specification Sheets that I have downloaded from the internet. I believe this is happening on only certain types of file and I am not sure how to differentiate these files. Code given below:

PDFSharp: Measuring height of long text with word wrap

﹥>﹥吖頭↗ 提交于 2019-11-29 22:13:15
问题 PDFSharp supports automatic text wrapping when drawing long text portions: textFormatter.DrawString(text, font, XBrushes.Black, new XRect(x, y, textAreaWidth, 1000), XStringFormats.TopLeft); This will wrap the text if it is longer than textAreaWidth . How can I get the height of the text that has just been drawn? I tried it with gfx.MeasureString() , but there is no overload that supports specifying a maximal width. gfx.MeasureString() returns the size of the text without text wrapping.

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

纵饮孤独 提交于 2019-11-29 19:35:31
问题 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 document or open it up in a reader? I'm especially confused because the PDF is generated server-side but we want it to show up client-side. Here is the MVC controller to create the report that we have written so far: public class ReportController

MigraDoc - imbricated / nested tables?

旧巷老猫 提交于 2019-11-29 15:15:57
I would like to add a table inside another table (inside a specific cell). I can't find a way to add a Table object to a Cell object. Is that simply impossible? Alternatively, I may merge some cells, but I can't find any sample in MigraDoc website with cells merging. Here is my code : Table parentTable = new Table(); parentTable.AddColumn(Unit.FromCentimeter(9)); Row parentRow = parentTable.AddRow(); Cell parentCell = parentRow.Cells[0]; Table currentTable = new Table(); currentTable.AddColumn(Unit.FromCentimeter(4)); Row currentRow = currentTable.AddRow(); currentRow.Cells[0].AddParagraph(

How to add PDFsharp lib in C#?

廉价感情. 提交于 2019-11-29 10:56:17
问题 I am new to C#.net, I downloaded PDFsharp lib. But how to add this lib to our project? My project is to create a PDF file. Please provide me step by step instructions. After unziping it has 32 folders. I tried by coping it in my project folder, but same errors come. " The type or namespace name 'PdfSharp' could not be found (are you missing a using directive or an assembly reference?)" 回答1: If you wish to use this library you need to add a reference to the assembly (dll) that contains the

Calculate text height based on available width and font?

大城市里の小女人 提交于 2019-11-29 03:20:55
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. In .NET you can call Graphics.MeasureString to find out how large the drawn text is going to be. Right, but when using PDFsharp you call XGraphics.MeasureString. The PdfSharp.Drawing.XGraphics object has a MeasureString method that returns what you require. var pdfDoc = new PdfSharp.Pdf.PdfDocument(); var pdfPage = pdfDoc.AddPage();