fix index error in AddPdf