views:

367

answers:

5

I'm working on application in Java that will maintain database of song lyrics in plain text and print out some songbooks/chordbooks(that is create PDF file from selected songs). I was planing that the Java application will generate source code for pdflatex and after compiling this source user will get PDF file.

Lately I've run into a lot of problems because of latex limitation: fixed memory size (some pictures will also be drawn to PDF) - error when exceeded, no way to query end of line or and of page dynamically, it's very hard to override latex placement algorithm in a complex way,... see also some my other questions regarding latex. I come to conclusion that latex is not good option for automated PDF generation.

So I need replacement. I need to be able to typeset:

  • Chords over lyrics when the lyrics are in variable char width so I need to be able to measure text width
  • Chord diagrams that means I'll have to draw quite complex pictures
  • Each song on separate double page
  • Different fonts etc.

Thanks for all answers

+1  A: 

Here are some PDF open source APIs http://java-source.net/open-source/pdf-libraries

This has been asked many time, You might want to look at this post

Romain Hippeau
Thank you. I expected that there will be some libraries to directly output PDF but I don't know which is best for my purpose. That's why I've stated my specific needs. Can you give some advice in respect to them please ?
drasto
@drasto You have a very unique need - I doubt many people have done this that are also programmers. I have googled for pdf creation of music and not found much, my music experience is limited to playing the trumpet back in grade school and jr high. You might need to do a little experimentation of your own here.
Romain Hippeau
I've given up trying to force latex to do the job. I'm using iText now and so far it does the job. I miss latex's automatic words hypernation and its even harder to typeset with iText then to write latex macros but so far it did everything I need. It is much more adaptable then latex.
drasto
+1  A: 

IText is a free library which offers lots of capabilities for creating PDFs programmatically.

mark stephens
A: 

why not just use lilypond with latex? it's meant for typesetting music.

Mica
Because Lilipond does not what I want my program to do - lack features, does not format music automatically... And My program will be more specific, only for guitar chords over lyrics.
drasto
+1  A: 

Rather than try to manage/calculate the complexities of the desired layout, you could try Docmosis. It will let you layout a document as a template using doc or odt formats. This means if you could make a doc or odt look like you want, you can turn it into a template and get Docmosis to render it as a PDF. Text and images can be placed inside or outside tables which makes layout fairly easy to manage.

jowierun
A: 

ConTeXt is another TeX system, but it is easier to control the layout than with LaTeX. For drawing you could use PGF/TikZ or MetaPost. Support for both is available in ConTeXt. With ConTeXt's built in Lua scripting you could draw the chords automatically, assuming you have them stored in some sort of data structure.

Shin