lillallol / outline-pdf

Adds collapsible outline to pdf and works both in nodejs and the browser.
MIT License
21 stars 0 forks source link

Does the library support Unicode? #2

Closed axipo closed 3 years ago

axipo commented 3 years ago

It seems that it doesn't support Unicode characters. Since I'm not a pdf expert, I don't know whether it's hard to support this feature. I found some info from pdf-lib project, and it looks like that there are many details to consider.

lillallol commented 3 years ago

@axipo Can you please provide me with a minimally reproducible example in which my module fails.

axipo commented 3 years ago

Sure, I replaced some demo code:

outlinePdf.outline = `
    1||Ω 1
    2|-|Some random title 2
    -3|--|Some random title 3
    4|---|Some random title 4
    5|---|Some random title 5
    6|-|Some random title 6
    7||Some random title 7
`;

And the output toc looks like: image

lillallol commented 3 years ago

@axipo I will try to find a solution but I think it will take some time. I will inform you when I am finished.

axipo commented 3 years ago

@lillallol Thanks very much. This project is the only solution to add TOC for pdf file on browser I found. 👍

lillallol commented 3 years ago

@axipo So I looked at the link you gave me. It does not work for the outline case so I opened an issue in pdf-lib. I am not expecting to get an answer back soon.

lillallol commented 3 years ago

@axipo I published a new patch. Check if it fixes your issue.

axipo commented 3 years ago

Yes, it works, thank you so much. @lillallol