Skip to content
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

cannot read property 'opts' of null #17

Closed
ninas880025 opened this issue Dec 19, 2016 · 13 comments
Closed

cannot read property 'opts' of null #17

ninas880025 opened this issue Dec 19, 2016 · 13 comments
Assignees

Comments

@ninas880025
Copy link

Hello

I have this issue:
image 058

it sometimes can't load the image I put in my local directory.(sometimes it works)
this is my code: pptx.addNewSlide().addImage({x:1.75, y:1.81, w:7.2, h:2.31,path:'datalog/assets/img/KYEC.png'});

@ninas880025
Copy link
Author

more details abt image issue
image 059

@gitbrent gitbrent self-assigned this Dec 20, 2016
@gitbrent
Copy link
Owner

Hi,

Thanks for reporting this.

What version are you using?

Also note that if you are running this on your local browser, you'll need to enable local file access (e.g.: Chrome flag "--allow-file-access-from-files")

@ninas880025
Copy link
Author

ninas880025 commented Dec 21, 2016 via email

@gitbrent
Copy link
Owner

gitbrent commented Dec 22, 2016

Thanks.

The images not loading is related to local file access. However, the uncaught error you helpfully screen-grabbed is in the table building loop.

Could you show me the code you're using to specify a table by any chance?

@rikvdk
Copy link

rikvdk commented Dec 22, 2016

I have the same problem with an image not being loaded:

image_not_loaded

The problem could be the response from the server: 304 Not Modified. What happens is chrome sends the request with the header:

  • If-Modified-Since:[date]

The server in response says it hasn't changed with a 304 status code. I guess this isn't handled in the PptxGenJS code which makes it fail later on when the image is used.

EDIT: On further testing I now always seem to get this error even if I use a incognito window and get the image with a 200 response.
EDIT2: And now suddenly it works again. Will update if I find more info on when if happens.

gitbrent pushed a commit that referenced this issue Dec 22, 2016
@gitbrent
Copy link
Owner

Thanks again for all the information.

I've updated the library with fixes that should address all of the issues you've encountered. Please try again using the most recent pptxgen.js file.

@ninas880025
Copy link
Author

thanks for solving our issue. I had re-npm install pptxgenjs and allowed local file access but the same error message appeared again.

@ninas880025
Copy link
Author

ninas880025 commented Dec 23, 2016

this is my code for image:
image 062

this is how I define my table header using opts:
image 063
I loop through headerName, making the header with filling color

@gitbrent
Copy link
Owner

Oh, i should have asked how you were obtaining the library... I hadn't pushed an update to NPM yet, I had just staged the package file, so your update did not pull in any new files.

I've updated the NPM release to 1.1.3 now, so please update and let me know if these issues are now fixed.

@ninas880025
Copy link
Author

Hello,

I npm install the new version(1.1.3) and allowed local file access in chrome bur the error is the same:
image 065

could you help with this? thanks!

@gitbrent
Copy link
Owner

Okay, version 1.1.3-2 has been pushed to npm. Try that out and let me know.

  • The image onLoad error message now provides a complete (clickable from Chrome dev window) link to the image that couldn't be loaded for easy verification.
  • The second error was due to the empty string and/or null being the cell's value and/or text value and that issue is fixed now.

@ninas880025
Copy link
Author

Hi, both problems has been solved. thank you very much!

@gitbrent
Copy link
Owner

Good to hear!

Thanks for reporting these issues and working through them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants