GNOME Bugzilla – Bug 654531
Crash when extracting pages from an iso-8859-1 PDF if i18n-west is not installed
Last modified: 2018-07-16 10:14:10 UTC
Hi, At lib/PdfSharp/PdfSharp.Pdf.Internal/PdfEncoders.cs:93, pdfmod asks for the Encoding corresponding to iso-8859-1. This may fail if the user does not have mono-i18n-west installed. It would be nice to display an informational error to the user in this case instead of crashing. example PDF to test on: www.cwts.nl/pdf/BookofAbstracts2010_version_15072010.pdf To reproduce: * Open the above PDF in pdfmod /without i18n-west installed/ * Select some pages * Click 'extract' on the toolbar * Crash (expected: error message indicating that you don't have the right library installed) Here's the trace Exception in Gtk# callback delegate Note: Applications can use GLib.ExceptionManager.UnhandledException to handle the exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NotSupportedException: CodePage 1252 not supported at System.Text.Encoding.GetEncoding (Int32 codepage) [0x00000] in <filename unknown>:0 at PdfSharp.Pdf.Internal.PdfEncoders.get_WinAnsiEncoding () [0x00000] in <filename unknown>:0 at PdfSharp.Pdf.Internal.DocEncoding.GetByteCount (System.Char[] chars, Int32 index, Int32 count) [0x00000] in <filename unknown>:0 at System.Text.Encoding.GetByteCount (System.Char[] chars) [0x00000] in <filename unknown>:0 at System.Text.Encoding.GetByteCount (System.Char* chars, Int32 count) [0x00000] in <filename unknown>:0 at System.Text.Encoding.GetByteCount (System.String s) [0x00000] in <filename unknown>:0 at System.Text.Encoding.GetBytes (System.String s) [0x00000] in <filename unknown>:0 at PdfSharp.Pdf.IO.PdfWriter.WriteDocString (System.String text) [0x00000] in <filename unknown>:0 at PdfSharp.Pdf.PdfDate.WriteObject (PdfSharp.Pdf.IO.PdfWriter writer) [0x00000] in <filename unknown>:0 at PdfSharp.Pdf.PdfDictionary.WriteDictionaryElement (PdfSharp.Pdf.IO.PdfWriter writer, PdfSharp.Pdf.PdfName key) [0x00000] in <filename unknown>:0 at PdfSharp.Pdf.PdfDictionary.WriteObject (PdfSharp.Pdf.IO.PdfWriter writer) [0x00000] in <filename unknown>:0 at PdfSharp.Pdf.PdfDocument.DoSave (PdfSharp.Pdf.IO.PdfWriter writer) [0x00000] in <filename unknown>:0 at PdfSharp.Pdf.PdfDocument.Save (System.IO.Stream stream, Boolean closeStream) [0x00000] in <filename unknown>:0 at PdfSharp.Pdf.PdfDocument.Save (System.IO.Stream stream) [0x00000] in <filename unknown>:0 at PdfSharp.Pdf.PdfDocument.Save (System.String path) [0x00000] in <filename unknown>:0 at PdfMod.Gui.Actions.OnExtractPages (System.Object o, System.EventArgs args) [0x00000] in <filename unknown>:0 at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 --- End of inner exception stack trace --- at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0 at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in <filename unknown>:0 at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in <filename unknown>:0 at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <filename unknown>:0 at GLib.Signal.ClosureInvokedCB (System.Object o, GLib.ClosureInvokedArgs args) [0x00000] in <filename unknown>:0 at GLib.SignalClosure.Invoke (GLib.ClosureInvokedArgs args) [0x00000] in <filename unknown>:0 at GLib.SignalClosure.MarshalCallback (IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) [0x00000] in <filename unknown>:0 at GLib.ExceptionManager.RaiseUnhandledException(System.Exception e, Boolean is_terminal) at GLib.SignalClosure.MarshalCallback(IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) at Gtk.Application.gtk_main() at Gtk.Application.Run() at PdfMod.Gui.Client..ctor(Boolean loadFiles) at PdfMod.PdfMod.Main(System.String[] args) Cairo.Context: called from finalization thread, programmer is missing a call to Dispose Forwarded from http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=618365
pdfmod is not under active development anymore and had its last code changes in 2011. Its codebase has been archived: https://gitlab.gnome.org/Archive/pdfmod/commits/master Closing this report as WONTFIX as part of Bugzilla Housekeeping to reflect reality. Please feel free to reopen this ticket (or rather transfer the project to GNOME Gitlab, as GNOME Bugzilla is deprecated) if anyone takes the responsibility for active development again.