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

TypeError: Cannot read properties of null (reading '2') #211

Open
Prashant15062019 opened this issue Sep 2, 2023 · 4 comments
Open

TypeError: Cannot read properties of null (reading '2') #211

Prashant15062019 opened this issue Sep 2, 2023 · 4 comments

Comments

@Prashant15062019
Copy link

index.txt

I am getting Type error while converting the HTML text

Env
Node v16
OS: Mac
Library version: 1.8.0

@xgg94
Copy link

xgg94 commented Jan 3, 2024

I get the same error, did you find a solution?

@Prashant15062019
Copy link
Author

no but what i did was first convert it to pdf and then to html file

@LancerComet
Copy link

This is because during the processing of the image, a certain edge case involving the image's URL occurred, causing the library to treat URLs that are not base64 as base64, such as relative paths starting with /.

The solution is to replace the image's URL with an absolute path, or manually download the image, generate its base64 and use it as the src in the corresponding img element.

@LancerComet
Copy link

LancerComet commented Apr 16, 2024

I see there are some src attributes that start with "/media/" in your index.txt, which cause the exception. You have to convert them into base64 manually.

An example:

image

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

No branches or pull requests

3 participants