PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 9:30 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Wed Jul 26, 2017 3:05 pm 
Offline

Joined: Wed Jul 26, 2017 2:57 pm
Posts: 2
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:


Top
 Profile  
Reply with quote  
PostPosted: Wed Jul 26, 2017 4:51 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 909
Location: CCAA
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."

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Fri Aug 04, 2017 7:46 pm 
Offline

Joined: Wed Jul 26, 2017 2:57 pm
Posts: 2
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


Top
 Profile  
Reply with quote  
PostPosted: Fri Aug 04, 2017 10:16 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 909
Location: CCAA
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.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 07, 2017 1:13 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 121 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group