migradoc

PDFsharp generates blank page in Azure, but works locally

匆匆过客 提交于 2019-12-01 20:37:45
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.ToArray(); return File(documentBytes, "application/pdf"); Locally, I get a nice PDF. On Azure, I get a

Column text overflowing out of column width

落爺英雄遲暮 提交于 2019-12-01 07:52:28
问题 I am using Migradoc to generate a table and populating some dynamic data for few columns, I have defined column width while defining table structure as- Table table = new Table(); Column column = table.AddColumn(Unit.FromCentimeter(6)); column.Format.Alignment = ParagraphAlignment.Left; table.AddColumn(Unit.FromCentimeter(6)); table.AddColumn(Unit.FromCentimeter(8)); Now the third column is having data ( acs800-07-1234a-5+asdf+asdf+qwer+wert+2345+rg+2345+ag+35+qwe1252rg+34tgh+24rg+253rg+23rgh

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

倖福魔咒の 提交于 2019-12-01 05:21:44
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 through and the Orientation is indeed Landscape . However, I want to make sure I am doing this the right

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

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(

Keep table in one piece MigraDoc / PDFsharp

倖福魔咒の 提交于 2019-11-29 00:57:48
问题 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

PDFsharp: Is there a way to generate “Page X of Y” in the header of the page?

微笑、不失礼 提交于 2019-11-28 18:40:31
It seems rather simple, but I can't find something like getPageCount() in the API. I can get it to return the current page, but not the total number of pages. Perhaps I'm missing it? I would like to somehow be able to print 'Page 1 of 9' at the top of every page, where '1' of course is the current page number. With PDFsharp it's up to you. I presume you are using MigraDoc: With MigraDoc you can add a page header. Add paragraph.AddPageField() for the current page number and paragraph.AddNumPagesField() for the total page count. Sample that uses AddPageField Code snippet from the sample: //

MigraDoc - imbricated / nested tables?

时光怂恿深爱的人放手 提交于 2019-11-28 08:18:32
问题 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

PDFsharp: Is there a way to generate “Page X of Y” in the header of the page?

两盒软妹~` 提交于 2019-11-27 11:35:05
问题 It seems rather simple, but I can't find something like getPageCount() in the API. I can get it to return the current page, but not the total number of pages. Perhaps I'm missing it? I would like to somehow be able to print 'Page 1 of 9' at the top of every page, where '1' of course is the current page number. 回答1: With PDFsharp it's up to you. I presume you are using MigraDoc: With MigraDoc you can add a page header. Add paragraph.AddPageField() for the current page number and paragraph