문제

현재 저장 및 인쇄 두 개의 컨트롤을 사용자에게 제공하고 있습니다.사용자가 저장을 선택하면 WPF 디스플레이의 영역이 패키징되어 XPSDocumentWriter를 통해 전송되고 사용자가 메시지가 표시되고 새 XPS 문서에 서명하도록 권장합니다.사용자가 인쇄를 선택하면 PrintDialog.PrintVisual이 사용자가 선택한 프린터와 동일한 영역을 인쇄합니다. Microsoft XPS 문서 작성자가 프린터 선택 중 하나라는 점을 제외하고는

모든 것이 좋습니다.XPS 문서 작성기의 사용자 선택을 방지하거나 가로 챌 수있는 방법이 있으며 사용자가 XPS 문서에 서명하라는 메시지를 표시 할 수 있도록 저장 방법으로 전송할 수 있습니까?

도움이 되었습니까?

해결책

Disclaimer: I've never used PrintDialog before, but it looks like something like this might work:

System.Windows.Controls.PrintDialog printDialog = new PrintDialog();
if (printDialog.ShowDialog() == true)
{
    PrintQueue selectedQueue = printDialog.PrintQueue;
    if (selectedQueue.Name == "Microsoft XPS Document Writer")
    {
        // Run your XPS save & sign code
    }
    else
    {
        // Run your printDialog.PrintVisual() code
    }
}

I don't really like having the printer name hard-coded (I assume it varies with language settings). Possibly there is a better property of PrintQueue that you can use to identify this printer.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top