migradoc

How do you have a bulletted list in migradoc / pdfsharp

半世苍凉 提交于 2019-12-22 03:23:06
问题 even after reading this forum post, its still quite confusing how to create a bulletted list using migradoc / pdfsharp. I basically want to display a list of items like this: Dodge Nissan Ford Chevy 回答1: Here's a sample (a few lines added to the HelloWorld sample): // Add some text to the paragraph paragraph.AddFormattedText("Hello, World!", TextFormat.Italic); // Add Bulletlist begin Style style = document.AddStyle("MyBulletList", "Normal"); style.ParagraphFormat.LeftIndent = "0.5cm"; string

Does PDFsharp with MigraDoc support HTML syntax?

為{幸葍}努か 提交于 2019-12-12 18:24:43
问题 Does PDFsharp with MigraDoc support HTML syntax? <a> <strong> etc. If yes, how can I implement it on the document? 回答1: No, it doesn't support HTML directly. You have to write a code that reads the HTML and create the PDF using either MigraDoc or PdfSharp. To create the PDF, you need to use the API, for instance: .AddPage(...) , .Draw(...) , .DrawRectangle(...) You have a full example here. You can also use this project to convert HTML to PDF: https://wkhtmltopdf.org/ 回答2: For example: para1

How to make room for the header on PDF document?

倖福魔咒の 提交于 2019-12-12 05:48:31
问题 This is a follow up of this other question. I have an image and text on the header of a PDF document created with MigraDoc. Problem is that content that should be below header is placed over the header partially, hiding part of the header content (they overlap vertically, table starts before header finishes). How to force a table control to make room to all header content? 回答1: You have to "protect" your header by setting header position and top margin as needed. It's up to you to determine

MigraDoc TextFrame Wrapstyle on Page Break

风流意气都作罢 提交于 2019-12-11 17:26:57
问题 I am using TextFrames in MigraDoc to be able to display in-line tables (2 per line) - this seems to work a treat: ... until the end of the page approaches. (The red boxes are the TextFrame borders - I have included to help visualize things) There seems to be a threshold where the top row's second table decides to break onto the next page - despite it actually being shorter than the first table. I want both tables to stay on the same page if there is room. The code I am using is as follows. It

How do you add a border around a table in MigraDoc?

£可爱£侵袭症+ 提交于 2019-12-11 15:09:49
问题 Is there a way to add a border around the table and hide the cell borders in MigraDoc? 回答1: The default width of the borders is 0 and borders are not visible. To enable borders, set a value greater than 0. If table is your Table object, you could write table.Borders.Width = 0.5; You can set borders for the table and for each cell. Cells inherit border properties from the table, the column, the row unless they are overwritten at a lower stage. Also check the SetEdge method of the Table class.

Make an Entire Cell in a MigraDoc Table a Link

大憨熊 提交于 2019-12-11 10:36:57
问题 Is there a way in MigraDoc to make an entire table cell a link? I have a tabular table of contents, and the page number is difficult to click. I would prefer if the entire cell was clickable to navigate to a specified page. Here is an example of my code: // Create the table within the document var document = new Document(); var section = document.AddSection(); var table = section.AddTable(); // Create a column in the table var column = table.AddColumn(); column.Width = "2cm"; // Create a row

MigraDoc table border issue with left indent

社会主义新天地 提交于 2019-12-11 01:21:52
问题 I'm trying to create a PDF document using MigraDoc, and am facing issues with table borders when the table contains a left indent. I'm passing data to the following functions to render the table. public void AddTable(int _iNumberOfColumns, double leftInd) { table = section.AddTable(); if (leftInd != 0d) { table.Format.LeftIndent = leftInd; } for (int i = 0; i < _iNumberOfColumns; i++) { Column col = table.AddColumn(); } } In the above method I'm passing a double value for the parameter

MigraDoc: Setting font for a document

允我心安 提交于 2019-12-10 11:27:22
问题 I'm wanting to use a different font with MigraDoc, but I'm having a hard time getting it to stick. Currently, I'm working with the following code: I have this as a class-wide variable: String tPdfFont = "MonospaceTyperwriter"; Then the MigraDoc code itself: Document tDoc = new Document(); MigraDoc.DocumentObjectModel.Style style = tDoc.Styles["Normal"]; style.Font.Name = tPdfFont; That particular font is installed on the machine, but it doesn't seem to work. I feel like I'm missing something

How to size a table to the page width in MigraDoc?

白昼怎懂夜的黑 提交于 2019-12-10 01:12:16
问题 I am trying to resize a table automatically to full width of the page. That table should have 2 columns, 50% width each. How can I achieve this? I tried LeftIndent and RightIndent properties with no luck. 回答1: Here's an approach that avoids hardcoding widths and allows for more flexible paper formats. Make sure to include the using MigraDoc.DocumentObjectModel; statement in your class. Document document = new Document(); Section section = document.AddSection(); section.PageSetup.PageFormat =

Scale image to fit to A4 page - Migradoc

我怕爱的太早我们不能终老 提交于 2019-12-07 01:34:21
问题 I am really struggling to get this right, any help would be appreciated. I have a series of images that I want to build in to a PDF using MigraDoc (1 image = 1 page) Each image must be displayed on a separate page but may not extend over the page it must fit on to the page perfectly. So, how do I scale an image (of any size) to fit to a page using MigraDoc? 回答1: You call AddImage() to add the image - and in return you get an Image object that allows you to set width and/or height of the image