Finally, bugfix done and dialogs all finished.
pdf->pair function is written. moving on to actual drawing part.