PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
Exception when try to use Document. https://forum.pdfsharp.net/viewtopic.php?f=2&t=3626 |
Page 1 of 1 |
Author: | Snehal [ Tue Jul 18, 2017 6:32 am ] |
Post subject: | Exception when try to use Document. |
I got the following exception : To be XML serializable, types which inherit from IEnumerable must have an implementation of Add(System.Object) at all levels of their inheritance hierarchy. MigraDoc.DocumentObjectModel.Borders does not implement Add(System.Object). I am using http://www.pdfsharp.net/wiki/Invoice-sample.ashx this page to create the same page as it is creating. But when I use Code: public Document CreateDocument() { // Create a new MigraDoc document this.document = new Document(); this.document.Info.Title = "A sample invoice"; this.document.Info.Subject = "Demonstrates how to create an invoice."; this.document.Info.Author = "Stefan Lange"; DefineStyles(); CreatePage(); FillContent(); return this.document; } It return the specified error and when I did not return the document everything is good but it will not create pdf file. I am new to this , So please tell me how can I fix it? Document is using MigraDoc.DocumentObjectModel . Thanks |
Author: | Thomas Hoevel [ Tue Jul 18, 2017 8:03 am ] |
Post subject: | Re: Exception when try to use Document. |
Hi! Snehal wrote: So please tell me how can I fix it? Use MigraDoc as intended and it will work.Use this forum as intended and we will be able to help: read the rules, use the Issue Submission Template, give is something to understand the problem and to replicate the exception. It seems you feed the XML Serializer with objects that were not meant to be serialized. Show us what you do, otherwise we cannot detect the problem. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |