How to expand on "PDF macro ext" to add Table, lines and shapes

Hi
I have been using the “PDF macro ext” for my results. Some time I need to present results in tabular format. Lining up the text by counting and adding spaces does not produce organized results. The macro lacks the ability to add tables, lines and shapes.
I was wondering how can I expand on the macro to add add tables, lines and shapes.
All suggestion are greatly appreciated.

Two suggestions:
First, PDF functionality in ImageJ is provided through a java library called iText. I haven’t used [PDF macro ext] (http://imagejdocu.tudor.lu/doku.php?id=plugin:utilities:pdf_macro_extension:start) but it looks like a wrapper around that library so that the ImageJ macro language can call a select subset of functions. If you want to jump into one of the [other scripting languages] (http://fiji.sc/Scripting), some (all?) can access java methods directly. I’ve done this with Python/Jython, but I believe JavaScript also can, and it is more similar to the macro language.

If you try this method, some internet searching will find links with [example java code] (http://www.mysamplecode.com/2012/10/create-table-pdf-java-and-itext.html). It requires a bit of effort learning how to call java from the other language, but it’s been worth it for me.

Second suggestion, that you may have already tried as part of “counting and adding spaces”: In order for this approach to work you need to use a monospaced font rather than a proportionally spaced one. The PDF macro wiki page linked above has an Ext.setFont function, and one of the font choices is courier, which typically allows lining things up by spaces. Won’t be as pretty as the first option, but might work.

3 Likes

Thank you for the advice. I will try it.