Unable to view MICR font in print preview

筅森魡賤 提交于 2020-01-03 03:51:45

问题


I have written a code to print a cheque using MICR font, every thing works fine but when coming to print preview I am getting normal text but while printing the document I am getting the required in MICR font. How can I show MICR font in print preview

This is my code

PrivateFontCollection PFC = new PrivateFontCollection();
    PFC.AddFontFile(Server.MapPath("ADVMICR.TTF"));
    FontFamily fm = new FontFamily(PFC.Families[0].Name, PFC);
    Font PrintFont = new Font(fm, 12);

    PrintDocument pd = new PrintDocument();
    pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
    // Specify the printer to use.
    pd.PrinterSettings.PrinterName = "SnagIt 9";
    PrintPreviewDialog ppdlg = new PrintPreviewDialog();
    ppdlg.Document = pd;
    ppdlg.ShowDialog();

回答1:


Try this

ppdlg.PrintPreviewControl.Font = new Font("ADVMICR.TTF", 12);



来源:https://stackoverflow.com/questions/10946986/unable-to-view-micr-font-in-print-preview

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!