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

Display issue with PDFView4Net viewer
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3633
Page 1 of 1

Author:  tprestas [ Wed Jul 26, 2017 3:05 pm ]
Post subject:  Display issue with PDFView4Net viewer

We use a 3rd party who is converting documents to PDF using PDFSharp and when we try to open it with PDFView4NET we are receiving errors. Adobe Acrobat can recover the object offsets which are invalid but the viewer we are using cannot. Is there some code we can use to strip out the information before the %pdf or is this being addressed in a updated version.
I have the PDF but it is too large to attach to the forum. The PDF errors with the errors below when trying to open in PDFView4NET but opens fine in Acrobat Reader.
System.NullReferenceException was unhandled
Message=Object reference not set to an instance of an object.
Source=O2S.Components.PDFView4NET
StackTrace:
at #wi.#cl.Parse(Stream , Byte[] )
at #Ax.#q0.#XZ(String , Stream , Byte[] )
at O2S.Components.PDFView4NET.PDFDocument.Load(Stream stream, Byte[] password)
at O2S.Components.PDFView4NET.PDFDocument.Load(String file, Byte[] password)
at O2S.Components.PDFView4NET.PDFDocument.Load(String file)
at O2S.Components.PDFView4NET.PDFDocument.set_FilePath(String value)
at O2S.Samples.PDFView4NET.FileAttachments.FileAttachmentsForm.btnBrowse_Click(Object sender, EventArgs e) in C:\Program Files (x86)\O2 Solutions\PDFView4NET 4.7.2 WinForms Edition\Samples\FileAttachments\CS\FileAttachmentsForm.cs:line 31
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at O2S.Samples.PDFView4NET.FileAttachments.Program.Main() in C:\Program Files (x86)\O2 Solutions\PDFView4NET 4.7.2 WinForms Edition\Samples\FileAttachments\CS\Program.cs:line 17
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

Author:  TH-Soft [ Wed Jul 26, 2017 4:51 pm ]
Post subject:  Re: Display issue with PDFView4Net viewer

Hi!
tprestas wrote:
Is there some code we can use to strip out the information before the %pdf or is this being addressed in a updated version.
If PDFsharp is creating invalid PDF files and if we can replicate and fix this problem, then this will be addressed with a future version.
Seeing just a stack trace from a third-party product, there is nothing we can do.
As of now, case closed.

O2 Solutions write on their site: "NOTE: There might be PDF files that will not be displayed or printed correctly. Feel free to send us any PDF file that is not handled correctly and we'll work on it."

Author:  tprestas [ Fri Aug 04, 2017 7:46 pm ]
Post subject:  Re: Display issue with PDFView4Net viewer

I have a copy of the fax that I an email over because it is larger than the forum allows. We already reached out to O2 solutions and this is what they sent over to us. Is there someone I can send the fax to so that your developers can look at it?

The PDF file you sent us is damaged, the object offsets are invalid. Acrobat can recover the objects, PDFView4NET cannot.
I noticed the file was created with PdfSharp. Please contact the PdfSharp developers and report them the problem.
 
Kind regards,
Adrian Marin 
Technical Support Engineer
O2 Solutions - precisely fit software 
www.o2sol.com
techsupport@o2sol.com

Author:  TH-Soft [ Fri Aug 04, 2017 10:16 pm ]
Post subject:  Re: Display issue with PDFView4Net viewer

tprestas wrote:
The PDF file you sent us is damaged, the object offsets are invalid. [...]
I noticed the file was created with PdfSharp.
It would be best to get code that creates the "damaged" PDF file.
Maybe the file gets damaged in transit because of encoding or transmission problems (and PDFsharp is not to blame).
Maybe the file was modified by a third-party tool that does not change the producer.

Author:  Thomas Hoevel [ Mon Aug 07, 2017 1:13 pm ]
Post subject:  Re: Display issue with PDFView4Net viewer

Hi!

The file we received for inspection was originally created by PDFsharp 1.32 in "verbose" mode with a file size of 310703 bytes (as indicated by a comment that PDFsharp added to the PDF file).

The file we received for inspection was only 304279 bytes in size.
So a third-party tool that did not change the Producer field of the PDF file reduced the file size. The shrunk file is invalid.

I have to assume that PDFsharp created a valid PDF file.

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