PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Exception thrown when rendering document
https://forum.pdfsharp.net/viewtopic.php?f=2&t=563
Page 1 of 1

Author:  llebron [ Thu Dec 04, 2008 5:28 pm ]
Post subject:  Exception thrown when rendering document

I have a .net class that renders a pdf form information stored in the db. Most of the time it works correctly. However, ocassionally I get the following error:

System.ArgumentException was caught
Message="An item with the same key has already been added."
Source="mscorlib"
StackTrace:
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at MigraDoc.Rendering.FormattedDocument.MigraDoc.Rendering.IAreaProvider.StoreRenderInfos(ArrayList renderInfos)
at MigraDoc.Rendering.TopDownFormatter.FormatOnAreas(XGraphics gfx, Boolean topLevel)
at MigraDoc.Rendering.FormattedDocument.Format(XGraphics gfx)
at MigraDoc.Rendering.DocumentRenderer.PrepareDocument()
at MigraDoc.Rendering.PdfDocumentRenderer.PrepareDocumentRenderer(Boolean prepareCompletely)
at MigraDoc.Rendering.PdfDocumentRenderer.PrepareRenderPages()
at MigraDoc.Rendering.PdfDocumentRenderer.RenderDocument()
at F1Office.clsPrintWorkOrder.CreateWOPdf(String strCompanyName, String strWO, String strCreatedBy, String strPrimaryPhone, String strStartDate, String strLastEditedBy, String strCaller, String strDueDate, String strActualTime, String strAddress, String strAge, String strBillableTime, String strPriority, String strPriorityDate, String strBilled, String strSubject, String strDetails, DataGridView dgridActionsTaken) in C:\Data\Projects\F1 Office\F1OfficeV2\Classes\clsPrintWorkOrder.vb:line 124
InnerException:

Here's the relevant code

MigraDoc.DocumentObjectModel.IO.DdlWriter.WriteToFile(document, "MigraDoc.mdddl")
Dim renderer As PdfDocumentRenderer = New PdfDocumentRenderer(True, PdfSharp.Pdf.PdfFontEmbedding.Always)
renderer.Document = document

The last line is the one that throws the exception

thanks,

Luis

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/