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

PdfReader.Open(file, PdfDocumentOpenMode.ReadOnly) Exception
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3179
Page 1 of 1

Author:  hsimoes [ Fri Aug 21, 2015 2:51 pm ]
Post subject:  PdfReader.Open(file, PdfDocumentOpenMode.ReadOnly) Exception

Hello,

I'm trying to open a document but I'm getting this exception:

Code:
System.NullReferenceException was unhandled
  HResult=-2147467261
  Message=A referência de objecto não foi definida como uma instância de um objecto.
  Source=PdfSharp
  StackTrace:
       em PdfSharp.Pdf.IO.Parser.ReadTrailer()
       em PdfSharp.Pdf.IO.PdfReader.Open(Stream stream, String password, PdfDocumentOpenMode openmode, PdfPasswordProvider passwordProvider)
       em PdfSharp.Pdf.IO.PdfReader.Open(String path, String password, PdfDocumentOpenMode openmode, PdfPasswordProvider provider)
       em PdfSharp.Pdf.IO.PdfReader.Open(String path, PdfDocumentOpenMode openmode)
       em testePDF.Form1.btProcessa_Click(Object sender, EventArgs e) em D:\Desenvolvimento\Testes\testePDF\testePDF\Form1.cs:line 73
       em System.Windows.Forms.Control.OnClick(EventArgs e)
       em System.Windows.Forms.Button.OnClick(EventArgs e)
       em System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       em System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       em System.Windows.Forms.Control.WndProc(Message& m)
       em System.Windows.Forms.ButtonBase.WndProc(Message& m)
       em System.Windows.Forms.Button.WndProc(Message& m)
       em System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       em System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       em System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       em System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       em System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       em System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       em System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       em System.Windows.Forms.Application.Run(Form mainForm)
       em testePDF.Program.Main() em D:\Desenvolvimento\Testes\testePDF\testePDF\Program.cs:line 19
       em System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       em System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       em Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       em System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       em System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       em System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       em System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       em System.Threading.ThreadHelper.ThreadStart()
  InnerException:


My code:

Code:
PdfDocument documento = PdfReader.Open(ficheiro, PdfDocumentOpenMode.ReadOnly);


I tried version 1.32 and I was getting the same thing, so I tried version 1.50.338.0 of PdfSharp.

I can't put the pdf in public due to sensitive information. Is there a way to check this?

I also tried to open in Pdf Explorer v1.32 but I also got an error:

https://drive.google.com/file/d/0B-edcK2uWyVXLWk3dXYxUFJ6YlE/view?usp=sharing

Properties of the PDF:

https://drive.google.com/file/d/0B-edcK2uWyVXekhvaUQzNVQ3eGM/view?usp=sharing

Thank you in advance. :)

Author:  TH-Soft [ Fri Aug 21, 2015 7:55 pm ]
Post subject:  Re: PdfReader.Open(file, PdfDocumentOpenMode.ReadOnly) Excep

AFAIK all known bugs with respect to opening PDF files have been fixed with the latest internal builds of PDFsharp.
If you cannot submit your file for testing, please wait patiently for the next beta. I don't know when it will come, but I hope it will come soon.

Author:  hsimoes [ Sat Aug 22, 2015 9:21 pm ]
Post subject:  Re: PdfReader.Open(file, PdfDocumentOpenMode.ReadOnly) Excep

First of all, thank you Thomas to take some time to my problem.

I got the version from nuget package last week. If there is a more recent version of the pdfsharp.dll I would be glad to use it.
If it is possible to send the file only to you, I can do it.

Thank you very much.

Keep up the good work!

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