It's a little off-topic but I wanted to say that the RGT extension is still primitive (version 0.x, text documents only) and doesn't allow to save in PDF yet. Actually, last year when I started this project, the "Save as PDF" wasn't ready in the OADL 1.2 version I used as a backplane. I think it's ready now in a later version but didn't have time to work on it.
And now back to your original programming.