PDFsharp & MigraDoc Foundation http://forum.pdfsharp.de/ |
|
The dictionary already has a stream. http://forum.pdfsharp.de/viewtopic.php?f=2&t=352 |
Page 1 of 1 |
Author: | cp4072 [ Mon Mar 31, 2008 1:31 pm ] |
Post subject: | The dictionary already has a stream. |
Hi all, Ive been writing a vb.net plugin that processes two xml files and outputs two pdfs along with two updated xmls. Everything works well until I save the second generated pdf to a memorystream in order to convert it to base64 to insert into the second updated xml. The error raised is: "The dictionary already has a stream." BTW: The first pdf is pdfSharp only, the second is a MigraDoc document. Has anyone seen this error before? Any ideas on a way around? TIA. |
Author: | Adrian [ Thu Oct 22, 2009 8:37 am ] |
Post subject: | Re: The dictionary already has a stream. |
I am getting the same error - Anyone have any idea how to resolve this |
Author: | Adrian [ Thu Oct 22, 2009 8:45 am ] |
Post subject: | Re: The dictionary already has a stream. |
Resolved this - Caused by not creating a new occurrence of the class for each document |
Author: | Mattpil29 [ Mon Jan 31, 2011 4:45 pm ] |
Post subject: | Re: The dictionary already has a stream. |
Adria, I know this was a long time ago but do you remember what class you need to create a new isntance of? I'd like to create a Migradoc, add pages and then do two steps: 1) save it to a memory stream (for embedding in to another file) 2) save it to a file. I get the dictionary error if I use the same pdf object for both. I'd like to do this to save cpu cycles in creating two identical documents! Matt |
Author: | Thomas Hoevel [ Mon Jan 31, 2011 5:28 pm ] |
Post subject: | Re: The dictionary already has a stream. |
Performance will be better if step 2 uses the memory stream created in step 1 to create the file. See also here: viewtopic.php?p=4107#p4107 |
Author: | Mattpil29 [ Tue Feb 01, 2011 10:03 am ] |
Post subject: | Re: The dictionary already has a stream. |
Thanks Thomas. I probably over simplified my problem. In between step 1 and 2 I want to add a watermark to the report. In the end I figured I could save v1 to a memory stream. Use pdfReader to re-load the doc from the same memory stream, then add the watermark and do the save v2 (to a file). BTW for anyone looking the vb.net code to save the memory stream to a file is: Code: 'tempstr1 is the result of saving the pdf to a memory stream Dim writeStream As FileStream Try writeStream = New FileStream("c:\testBinary.pdf", FileMode.Create) Dim writeBinay As New BinaryWriter(writeStream) tempstr1.Position = 0 writeBinay.Write(tempstr1.ToArray()) writeBinay.Close() Catch ex As Exception MsgBox(ex.ToString) End Try Matt |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |