locked
In Windows Store apps, try to print out pdf with image as background, but will be empty after page.2?

    Question

  • I got this simple code:

    https://github.com/beryah/Yo/tree/master/PrintTest/PrintTest

    And see it print result document: http://1drv.ms/1BLETQY

    only P.1 has the right bg image, others don't have any bg image. Does anyone know how to solve it? thank you so much!

    Monday, April 13, 2015 9:24 AM

Answers

  • Dear Franklin,

    Thank you so much for your reply. I tried but failed... don't know why I did wrong.. it seems easy.

    Here is my modified code and the printed pdf file:  1drv.ms/1FECdaz

     Could you help me to check it? thank you again.


    My fault, we also need to set ImageSource for ImageBrush:

    <ImageBrush x:Name="imgBrush" Stretch="Fill" ImageSource="ms-appx:///Assets/Print_BG.png"/>

    Code Behind:

    public PrintPage()       
    {         
                this.InitializeComponent();
                imgBrush.ImageSource = new BitmapImage(
                    new Uri("ms-appx:///Assets/Print_BG.png"));  
    }


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Aya Hsu Wednesday, April 15, 2015 12:58 AM
    Tuesday, April 14, 2015 1:29 PM
    Moderator

All replies

  • Hi Aya,

    >>only P.1 has the right bg image, others don't have any bg image

    We need to set ImageBrush.ImageSource from code behind:

    PrintPage.xaml:

    <ImageBrush x:Name="imgBrush" Stretch="Fill"/>

    Code Behind:

    public PrintPage()       
    {
                
                this.InitializeComponent();
                imgBrush.ImageSource = new BitmapImage(
                    new Uri("ms-appx:///Assets/Print_BG.png"));
            
    }

    Screenshot:


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, April 14, 2015 9:50 AM
    Moderator
  • Dear Franklin,

    Thank you so much for your reply. I tried but failed... don't know why I did wrong.. it seems easy.

    Here is my modified code and the printed pdf file:  1drv.ms/1FECdaz

     Could you help me to check it? thank you again.

    Tuesday, April 14, 2015 10:59 AM
  • Dear Franklin,

    Thank you so much for your reply. I tried but failed... don't know why I did wrong.. it seems easy.

    Here is my modified code and the printed pdf file:  1drv.ms/1FECdaz

     Could you help me to check it? thank you again.


    My fault, we also need to set ImageSource for ImageBrush:

    <ImageBrush x:Name="imgBrush" Stretch="Fill" ImageSource="ms-appx:///Assets/Print_BG.png"/>

    Code Behind:

    public PrintPage()       
    {         
                this.InitializeComponent();
                imgBrush.ImageSource = new BitmapImage(
                    new Uri("ms-appx:///Assets/Print_BG.png"));  
    }


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Aya Hsu Wednesday, April 15, 2015 12:58 AM
    Tuesday, April 14, 2015 1:29 PM
    Moderator
  • Hi, Franklin

    Thank you so much! It works well now! I appreciate of your great help~~

    Wednesday, April 15, 2015 12:59 AM