View Single Post
Old 07-14-2009, 05:43 PM   #56
auroux
Junior Member
auroux began at the beginning.
 
Posts: 2
Karma: 18
Join Date: Jul 2009
Device: none
print to pdf shouldn't be that hard

Print to PDF shouldn't be that hard to port to iRex, if you're willing to discard TrueType text objects in the annotations. Xournal does most of its PDF export completely by hand without using any libraries -- the only exception is extracting subfonts from the TrueType system fonts for inclusion into the exported PDF, and that's presumably not a useful feature on iRex.

The bad news is that the two different printing systems (via libgnomeprint for printing to printers, and "by hand" for exporting PDF) share the same source code file, so you'll have to remove the bad parts by hand. In xo-print.c, you'll want to keep the function print_to_pdf() and everything it calls, but discard all the code for printing via libgnomeprint. In the 0.4.2.1 source code, you roughly want to keep lines 1-1400 of xo-print.c and discard everything after that. You'll still have some trouble with the functions new_pdffont() and embed_pdffont() -- one option is to also compile in sft.c from the source code of libgnomeprint. The more brutal option is to remove these two functions, and also remove what's inside
else if (item->type == ITEM_TEXT) {...}
(lines 1072 to end of pdf_draw_page()). (This will exclude text items from being exported, but will simplify your life). The Right Way is somewhere in between, but I'd certainly understand if you're not willing to look too closely at that portion of the code.

Contact me at (myusername)@math.mit.edu if you need more info / advice about how the code works. I don't have much time to spare and have no idea how iRex works so I won't get involved in details, but I'm always happy to clarify questions about the code.

Denis.
auroux is offline   Reply With Quote