pdfextractghostscriptmusic-notation

How can I extract music notation from a PDF?


I am trying to render a PDF with another embedded font for musical notation and I don't know how to do it.

I am trying to rasterize a music staff in a PDF and I realized that the PDF is rendering the musical notation bad because of the embeded font. Then I want to try with another font.

I extract text with ghostscript, or convert PDF to PS and edit the .ps, but I believe if I can understand how to re-redender the PDF...

gs -dBATCH -dNOPAUSE -sDEVICE=txtwrite -sOutputFile=Betlem_pdf.txt Betlem.pdf

iconv.exe -f MACROMAN -t UTF-8 Betlem_pdf.txt > Betlem_pdf_txt_utf8.txt

enscript.exe -f Petrucci40 Betlem_pdf_txt_utf8.txt -o Betlem_pdf_txt_utf8.ps

gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=Betlem_2.pdf Betlem_pdf_txt_utf8.ps

The expected result is to see the same staff than in the original PDF but with another font. But I don't know what I am doing...

http://www.xn--estudiantladolaina-lvb.com/partitures/baixa/pdf/26


Solution

  • The PDF you linked does not have fonts for the music notes. The music notes are PDF shape/image objects. Best you can do here is use a OCR (optical character recognition) for the PDF and hope that OCR supports music notes.