Save the printer name in the file, not the index.
When you restart the program and read back the printer name. Then loop thru all printers to find which one has the saved name (It could have been removed or renamed) and use that printer.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…