PreviewPage of Printing RRS feed

  • Question

  • when we preview document for Printing use Image in event of “GetPreviewPage”, the Image can't be displayed in window. my code is:

    m_printDocument = ref new PrintDocument();
     m_printDocument->GetPreviewPage += ref new Windows::UI::Xaml::Printing::GetPreviewPageEventHandler(this, &DirectXPage::GetPrintPreviewPage);


    void DirectXPage::GetPrintPreviewPage(Object^ sender, GetPreviewPageEventArgs^ e)
         int PageCount =  e->PageNumber;
         Image^ previewPageTemp = ref new Image();
         BitmapImage^pImage =  ref new BitmapImage(ref new  Windows::Foundation::Uri("ms-appx:///", "Assets/print_1.png"));
         previewPageTemp->Width = 200;
         previewPageTemp->Height =100;
         previewPageTemp->Source = pImage;
         m_printDocument->SetPreviewPage(PageCount, previewPageTemp);


    thanks first.


    Wednesday, June 27, 2012 6:52 AM

All replies

  • Just as a guess, I suspect that the image isn't loaded yet when you pass it to SetPreviewPage. Do you get the BitmapImage.ImageLoaded event before you call SetPreviewPage? Does the image show up if you preload it?


    Thursday, June 28, 2012 2:31 AM