PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 8:55 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Tue Jul 18, 2017 6:32 am 
Offline

Joined: Tue Jul 18, 2017 6:22 am
Posts: 1
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


Top
 Profile  
Reply with quote  
PostPosted: Tue Jul 18, 2017 8:03 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 157 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group