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

demo: PDF export does not work with tablature #1371

Open
fheyen opened this issue Apr 29, 2023 · 2 comments
Open

demo: PDF export does not work with tablature #1371

fheyen opened this issue Apr 29, 2023 · 2 comments
Labels
demo concerning our demo (npm start)

Comments

@fheyen
Copy link

fheyen commented Apr 29, 2023

When trying to export OSMD to PDF, using the code provided in the demo, I found that the fret numbers of guitar tablature are not exported.

Demo looks like this:
demo

PDF like this:
pdf
Untitled Score.pdf

Here is the example MusicXML I used:
A min pent triplets.musicxml.txt

I know that PDF export is not a core feature, but this might be an issue within OSMD that's easy to fix.

@sschmidTU
Copy link
Contributor

sschmidTU commented Apr 29, 2023

I'm pretty sure this is an issue with the PDF exporting library, the library is not great overall unfortunately.
Maybe you can find and test a better one?
But yes, as you say, this is not considered a core OSMD feature, it's mostly a feature of the demo.

@sschmidTU sschmidTU added the demo concerning our demo (npm start) label May 23, 2023
@sschmidTU
Copy link
Contributor

sschmidTU commented May 23, 2023

It looks like jsPDF can't render <text> elements, probably because of UTF-8:

https://github.com/parallax/jsPDF#use-of-unicode-characters--utf-8

It also doesn't render the = 80 tempo text.
image

I've tried a few workarounds like setting the font to times, or loading a Times New Roman font from binary string and removing attributes from the text node, but I couldn't get text to render. Maybe svg2pdf isn't dealing with it and passing it to jspdf correctly, it seems to be an extension of jspdf, overwriting some code.

So, the best bet is probably still using better PDF/SVG libraries, since fonts like Times New Roman or Arial should be supported everywhere, the browser should probably handle loading the font.

By the way, here's a working fiddle/demo just using jspdf with a custom font:
https://codesandbox.io/s/jspdf-add-font-bm4xy

@sschmidTU sschmidTU changed the title OSMD demo: PDF export does not work with tablature demo: PDF export does not work with tablature Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
demo concerning our demo (npm start)
Projects
None yet
Development

No branches or pull requests

2 participants