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
Invalid offset/length when creating typed array - pdfmake.js (24651,9) on Edge Windows 10 #577
Comments
I have found this issue as well when I try to embed an image into the output file. Chrome and Safari work fine and the image is embedded, Firefox embeds a blank image but that's probably a result of something else on not this library, but IE, not just Edge, from 10 and up, it prevents the export. |
I have this issue too, for IE and edge |
Having the same problem. Anyone? |
I am having the same problem, cannot embed image into output file in edge... |
I've just run into this problem as well.. I dont have Win10/Edge, so I'm doing compatibility testing with browserstack.com. "Invalid offset/length when creating typed array" is showing up for me when creating the pdf in Win10/Edge13 only. When I use Win10/Edge12 (or Chrome/FF/IE10+/Safari), the pdf is generated correctly. Somehow, neither Edge browser works on the pdfmake playground page - just get a blank pdf doc. |
I have issue too, only MS Edge |
Same issue here. |
Hi, I have the same problem, any solution to fix that? On chrome, firefox, works fine. |
@bpampuch Same error for me. Does anyone have a way to catch the error in order to show the user a message saying that the feature is 'not supported'? I tried using try/catch when calling pdfMake.createPdf but it does not work. |
I think I'm seeing a similar error now with the latest version of Firefox (v48).
Note: the error only occurs when I include images in the PDF. |
It seems to be the handling for arrays. I commented out the lines 24650 - 24653 as a workaround:
There is fallback code from the original author which works at least for all browsers I tested so far. There still will be the issue with missing transparencies (#660). I have no further information if it has any other consequences, so use it at your own risk. |
Thanks for the workaround/fix @sluo86, it's seems to be working well for us. |
Works for me! Thank you From: sluo86 [mailto:notifications@github.com] It seems to be the handling for arrays. I commented out the lines 24650 - 24653 as a work-around: var fnTyped = { There is a fallback code for that which works at least for all browsers I tested so far. There still will be the issue with missing transparencies. I have no further information if it has any other consequences, so use it at your own risk. — This email has been checked for viruses by Avast antivirus software. |
Hello Thanks for the hints - we faced the same problem and tracked it down to the Buffer-Methods used by pdfkit / pdfmake. The problem seems to be that Firefox and IE Edge are using the following constructor method for slicing / "subarraying" TypedArrays: new Uint8Array(buffer, offset, length). This constructor is not support by the current buffer implementation in pdfmake / pdfkit which seems to rely on a rather old node.js buffer implementation. The reason is, that the buffer implementation overwrites the constructor of the TypedArrays:
The patch would be (it should work, but isn't tested on all browsers, but it works in IE Edge, Firefox 48 and Chrome on Windows 10 64 Bit): (sorry, I cannot give line-Numbers, but it is all in the Buffer-module of pdfmake):
|
As you can See above, I forked pdfmake and applied the provided fix. |
@FastestRobot @tsiegleauq Legends! I've run this update in IE Edge, IE11, Chrome, Firefox, Firefox Mobile, Chrome mobile and all seems to be working. I've minified it here: And I've combined that with vfs_fonts library here if you are delay loading: |
Hey guys, I honestly think bpampuch/pdfmake is depracted, but I might be completely wrong. the current Master does not build anymore and @bpampuch seems to be inactive since May 18 (also see this). When we started using bpampuch/pdfmake, we did not notice that. We consider changing to this project (it has the same basis, even to webpage looks the same though) and I try to get a patch upstream for this issue (if this even exist in pdfmake/pdfmake) asap. |
@FastestRobot Yes, this is because the Buffer library (via Browserify/npm) used by pdfmake is outdated. Updating the library is enough to fix it -- no need for manual patching. Building with a newly-installed copy of webpack also seems to pull in 4.9.1. Unfortunately, I can't seem to build pdfmake master at the moment, as tsiegleauq mentioned. I noticed this a couple months ago but apparently forgot to open an issue here - sorry! https://bugzilla.mozilla.org/show_bug.cgi?id=1277784 |
@Elusive138, thanks a lot for this suggestion. I tested it and it worked just as you described. |
Hi. Can you make a release with that fix, please? |
Hi @tsiegleauq can you please share me that file because I am not too familiar with browserify so it will help me, Or please tell me the steps so that I will do it by my self. |
@tsiegleauq pdfmake/pdfmake used to solve this issue for me but our last build just failed today as the repository was removed. Anyone has a fork of pdfmake/pdfmake? |
@mikaoelitiana you don't have to use pdfmake/pdfmake fork anymore. It is merged back to this one, and development continues here. While there is no ETA for a new release, I recommend you to try out latest master. |
@miltador thanks! I will try with latest master then and let you know. |
@miltador latest master from this repo doesn't solve the problem yet so I finally had to use fork from @tsiegleauq https://github.com/tsiegleauq/pdfmake.git to make it work. |
@mikaoelitiana Or just configure your bower.json like the following to get this commit
that strange number behind the "#" (3b44129) is the extracted from the URL. |
@tsiegleauq thanks for these details. For now I will use your fork and on next release of bpampuch/pdfmaker, I can swithc back to in (when this issue is officially closed I guess) |
@mikaoelitiana Currently should be all changes from pdfmake/pdfmake transferred to this repo. It should work. Conducted you rebuild? |
@liborm85 I have tested this build and it works fine for me. Thanks |
New version released. |
After constructing my array to create a pdf all is ok on others browsers but on edge I got this error,
pdfMake.createPdf(dd).download('planning.pdf');
The text was updated successfully, but these errors were encountered: