PDFsharp & MigraDoc Foundation http://forum.pdfsharp.com/ |
|
AddPage Exception http://forum.pdfsharp.com/viewtopic.php?f=2&t=3694 |
Page 1 of 1 |
Author: | vbjay [ Tue Nov 21, 2017 9:22 pm ] |
Post subject: | AddPage Exception |
Exception:The given key was not present in the dictionary. StackTrace: at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at PdfSharp.Pdf.Advanced.PdfImportedObjectTable.get_Item(PdfObjectID externalID) at PdfSharp.Pdf.PdfObject.FixUpObject(PdfImportedObjectTable iot, PdfDocument owner, PdfObject value) at PdfSharp.Pdf.PdfObject.FixUpObject(PdfImportedObjectTable iot, PdfDocument owner, PdfObject value) at PdfSharp.Pdf.PdfObject.ImportClosure(PdfImportedObjectTable importedObjectTable, PdfDocument owner, PdfObject externalObject) at PdfSharp.Pdf.PdfPages.CloneElement(PdfPage page, PdfPage importPage, String key, Boolean deepcopy) at PdfSharp.Pdf.PdfPages.ImportExternalPage(PdfPage importPage) at PdfSharp.Pdf.PdfPages.Insert(Int32 index, PdfPage page) at PdfSharp.Pdf.PdfPages.Add(PdfPage page) at PdfSharp.Pdf.PdfDocument.AddPage(PdfPage page) at Tickets.Module1.mergePDFS(IEnumerable`1 docs) in E:\Apps\PDF\Tickets\Tickets\Module1.vb:line 87 at Tickets.Module1.Main() in E:\Apps\PDF\Tickets\Tickets\Module1.vb:line 31 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel) at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly() at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData) at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext) at System.Activator.CreateInstance(ActivationContext activationContext) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() Code: Function mergePDFS(docs As IEnumerable(Of String)) As PdfSharp.Pdf.PdfDocument Dim merged As New PdfSharp.Pdf.PdfDocument merged.Options.CompressContentStreams = True merged.Options.NoCompression = False For Each doc In docs.Distinct Dim rdr = PdfSharp.Pdf.IO.PdfReader.Open(doc, PdfSharp.Pdf.IO.PdfDocumentOpenMode.Import) For Each pg In rdr.Pages.Cast(Of PdfSharp.Pdf.PdfPage)().ToArray merged.AddPage(pg)<-----Exception here Next Next Return merged End Function <package id="PdfSharp" version="1.32.3057.0" targetFramework="net462" /> |
Author: | Thomas Hoevel [ Wed Nov 22, 2017 8:51 am ] |
Post subject: | Re: AddPage Exception |
Hi! Does the issue also occur with the latest version of PDFsharp 1.50? |
Author: | vbjay [ Wed Nov 22, 2017 1:02 pm ] |
Post subject: | Re: AddPage Exception |
Actually. Found out the PDF generation was messed up. I did try the latest version and it said it couldn't read the file. Something about missing eostream or something. So it was a bad PDF. The signature image was placed twice instead of company logo at top and signature at bottom. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |