migradoc

Align Page Number to Right Corner in MigraDoc

安稳与你 提交于 2019-12-06 14:49:53
I know how to show page numbers and how to align them in footer. However my problem is that my Footer contains some custom text which should be left aligned and page number should be aligned to right corner. string footer = "My custom footer"; Paragraph footerParagraph = section.Footers.Primary.AddParagraph(footer); footerParagraph.AddTab(); footerParagraph.AddPageField(); Above will generate "My custom footer 1" for page 1, I need page nmuber to be right at the right most corner of the page. I can add extra spaces or tab but thought there must be a clean way to achieve this. Thanks. Keep it

MigraDoc: Setting font for a document

大城市里の小女人 提交于 2019-12-06 09:56:48
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 terribly obvious or am just completley misunderstanding font usage. Make sure you write the font name

How to Define a PDF Outline Using MigraDoc

跟風遠走 提交于 2019-12-05 19:28:41
I noticed when using MigraDoc that if I add a paragraph with any of the heading styles (e.g., "Heading1"), an entry is automatically placed in the document outline. My question is, how can I add entries in the document outline without showing the text in the document? Here is an example of my code: var document = new Document(); var section = document.AddSection(); // The following line adds an entry to the document outline, but it also // adds a line of text to the current section. How can I add an // entry to the document outline without adding any text to the page? var paragraph = section

MigraDoc Bullet List (holes)

六眼飞鱼酱① 提交于 2019-12-05 07:26:59
In my Solution I am using bullet list in PDF files. It looks something like that: • Solcellepaneler kræver hverken autoriseret service eller tidskrævende vedligehold. • Solceller er støjfri, forurener ikke og har ingen bevægelige dele, hvilket mindsker service og vedligehold • Solceller kan integreres i bygningers arkitektur eller anvendes som bygningselement i form af tag, facader eller solafskærmning • Solceller har lang levetid, med en produktionsgaranti på hele 25 år • 10 kvadrameter solceller sparer ca. ½ ton CO2 om året What I want : • Solcellepaneler kræver hverken autoriseret service

Scale image to fit to A4 page - Migradoc

强颜欢笑 提交于 2019-12-05 05:22:04
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? 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. What you have to do: check the dimensions of the image, calculate which is the limiting factor (width or

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

纵饮孤独 提交于 2019-12-05 00:03:42
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. Kidquick 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 = PageFormat.A4; Table table = section.AddTable(); float sectionWidth = section.PageSetup.PageWidth -

How do you have a bulletted list in migradoc / pdfsharp

两盒软妹~` 提交于 2019-12-04 23:42:10
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 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[] items = "Dodge|Nissan|Ford|Chevy".Split('|'); for (int idx = 0; idx < items.Length; ++idx) { ListInfo

MigraDoc C# Align left and right on same line

Deadly 提交于 2019-12-04 20:54:35
问题 I have a table with a cell where i want two texts, the first, aligned on left and the second aligned on the right, in the same cell, on the same line. I tried to reproduce this cell with MigraDoc without success. I only can add two texts aligned on left and right but not on same line. Here my code: Cell cellFooter1 = rowFooter.Cells[0]; Paragraph paraphTot = new Paragraph(); paraphTot.Format.Alignment = ParagraphAlignment.Left; paraphTot.AddText("Left text"); cellFooter1.Add(paraphTot);

How to Set Document Orientation (for All Pages) in MigraDoc Library?

我们两清 提交于 2019-12-04 01:13:20
问题 I'm using MigraDoc to programatically generate a PDF file with text, images and tables. I need to set Document Orientation (for all pages) in the document object to Landscape . So I tried the following. document.DefaultPageSetup.Orientation = Orientation.Landscape; But I get the following debug assertion error. --------------------------- Assertion Failed: Abort=Quit, Retry=Debug, Ignore=Continue --------------------------- DefaultPageSetup must not be modified If I click Ignore , it goes

PDFsharp generates blank page in Azure, but works locally

你。 提交于 2019-12-02 00:36:01
问题 This works in an ASP.NET MVC application when run locally, but not when deployed on Azure: Document doc = new Document(); Section section = doc.AddSection(); section.AddParagraph("Some text to go into a PDF"); PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(false, PdfFontEmbedding.Always); pdfRenderer.Document = doc; pdfRenderer.RenderDocument(); System.IO.MemoryStream stream = new System.IO.MemoryStream(); pdfRenderer.PdfDocument.Save(stream, false); Byte[] documentBytes = stream