New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GetPage fails with error : 'Cannot convert array to rectangle' #29
Comments
Thanks, I will try to take a look into this tonight, I was fairly sure the MediaBox for a page should have 4 numbers but I'll check the spec and the PDFBox code and see what they're doing. Would you be able to send me the document so I can check the parsing logic or is it confidential? |
I've attached a version which works around this problem however I think the problem is deeper in the code which parses the PDF objects. If you can send me the document or alternatively open the document in a text editor such as notepad++ or Visual Studio and find the part of it which will look something like (using the /MediaBox text):
And send that part to me it would be a huge help to make sure the library works for other cases, thanks, Eliot. |
I can send you this :
It ok for you or you need more ? |
Thank you, I've run that through the parser and it seems to come through ok, are there other instances of the /MediaBox token in this document (generally there will be 1 per page in the document)? If you can't share it publicly you could email it to me at elioty(at)hotmail.co.uk |
No problem, i have one /MediaBox per page. |
Did the last release fix the problem for you or is it still present? |
I try that tomorrow,
Regards
Le jeu. 24 janv. 2019 à 18:50, Eliot Jones <notifications@github.com> a
écrit :
… Did the last release fix the problem for you or is it still present?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#29 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AGy56C8bfG0GBOTxd4mE-6a1Fgju77lUks5vGfJcgaJpZM4aJpKB>
.
|
Hi, I have now a new problem :
à UglyToad.PdfPig.Fonts.SystemFonts.SystemFontFinder..ctor(TrueTypeFontParser trueTypeFontParser) |
Sorry for the delay on getting back to you. There's just not enough information in this error message to guess at a fix to be honest. It looks like the InnerException might contain a more valuable exception. I've attached an updated package with a change that wraps the static initializer (which I think is throwing) in a try-catch but it's not going to fix whatever the problem is here... |
Sorry I wasn't able to be more help here but without the original document it's very difficult to fix. |
Hello,
When i try to open a PDF file and read it, i have an error :
UglyToad.PdfPig.Exceptions.PdfDocumentFormatException : 'Cannot convert array to rectangle, expected 4 values instead got: [ 0, 0 ].'
UglyToad.PdfPig.Exceptions.PdfDocumentFormatException
HResult=0x80131500
Message=Cannot convert array to rectangle, expected 4 values instead got: [ 0, 0 ].
Source=UglyToad.PdfPig
Arborescence des appels de procédure :
à UglyToad.PdfPig.Util.ArrayTokenExtensions.ToIntRectangle(ArrayToken array)
à UglyToad.PdfPig.Parser.PageFactory.GetMediaBox(Int32 number, DictionaryToken dictionary, PageTreeMembers pageTreeMembers, Boolean isLenientParsing)
à UglyToad.PdfPig.Parser.PageFactory.Create(Int32 number, DictionaryToken dictionary, PageTreeMembers pageTreeMembers, Boolean isLenientParsing)
à UglyToad.PdfPig.Content.Pages.GetPage(Int32 pageNumber)
à UglyToad.PdfPig.PdfDocument.GetPage(Int32 pageNumber)
à WindowsFormsApp2.Form1.button1_Click(Object sender, EventArgs e) dans C:\Users\source\repos\WindowsFormsApp2\WindowsFormsApp2\Form1.cs :ligne 40
à System.Windows.Forms.Control.OnClick(EventArgs e)
à System.Windows.Forms.Button.OnClick(EventArgs e)
à System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
à System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
à System.Windows.Forms.Control.WndProc(Message& m)
à System.Windows.Forms.ButtonBase.WndProc(Message& m)
à System.Windows.Forms.Button.WndProc(Message& m)
à System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
à System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
à System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
à System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
à System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
à System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
à System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
à System.Windows.Forms.Application.Run(Form mainForm)
à WindowsFormsApp2.Program.Main() dans C:\Users\source\repos\WindowsFormsApp2\WindowsFormsApp2\Program.cs :ligne 19
Hope it will help you to fix it,
The text was updated successfully, but these errors were encountered: