windows - Print layout is not covered whole layout of the xaml page? -
i working on windows universal app. have issue regarding print functionality in uwp.in issue when click on print button prints invoice page dynamic designed print not covered whole page layout.
i putting xaml code.
<grid background="white"> <grid name="gridpopup" visibility="visible" background="white"> <grid.rowdefinitions> <rowdefinition height="50"></rowdefinition> <rowdefinition height="200"></rowdefinition> <rowdefinition height="*"></rowdefinition> <rowdefinition height="78"></rowdefinition> <rowdefinition height="150"></rowdefinition> </grid.rowdefinitions> <stackpanel orientation="horizontal" margin="10,10,0,0" grid.row="0"> <textblock fontfamily="arial narrow" text=" print order :" fontsize="20" height="50" verticalalignment="bottom" foreground="#fff05929" fontweight="bold" margin="0,0,0,-10"/> <textblock x:name="invoice_inc_id" fontfamily="arial narrow" text="{binding id" fontsize="20" height="40" verticalalignment="top" foreground="#fff05929" fontweight="bold"/> </stackpanel> <stackpanel grid.row="1" borderbrush="lightgray" borderthickness="0,1,0,2"> <image name="logo" height="70" margin="220,10,220,0"/> <stackpanel orientation="horizontal" margin="10,35,0,0" height="36"> <textblock fontfamily="arial narrow" text=" customer name: " fontsize="18" height="30" verticalalignment="top" foreground="black" margin="0,6,0,0"/> <textblock margin="15,7,0,0" name="invoice_customername" fontfamily="arial narrow" text="{binding customer_name}" fontsize="18" height="24" verticalalignment="top" foreground="black" /> </stackpanel> <stackpanel orientation="horizontal" margin="12,10,-2,0" height="36" horizontalalignment="left" > <textblock fontfamily="arial narrow" text=" phone/email : " fontsize="18" height="40" verticalalignment="bottom" foreground="black" margin="0,-4,0,0"/> <textblock margin="15,-5,0,0" name="invoicecustomeremail" fontfamily="arial narrow" text="{binding customer_email}" fontsize="18" height="36" verticalalignment="top" foreground="black" width="210" /> </stackpanel> </stackpanel> <listview grid.row="2" name="lstinvoice" ishittestvisible="false" borderbrush="lightgray" borderthickness="0,0,0,1"> <listview.background> <imagebrush stretch="fill" imagesource="images/loginimages/gradient_bg.png"/> </listview.background> <listview.headertemplate> <datatemplate> <grid margin="0,5,0,8" height="25"> <grid.columndefinitions> <columndefinition width="400"></columndefinition> <columndefinition width="200"></columndefinition> <columndefinition width="200"></columndefinition> </grid.columndefinitions> <textblock grid.column="0" text="name" foreground="#ff020202" fontsize="24" fontweight="bold" fontfamily="raavi" selectionhighlightcolor="#ffe05022" verticalalignment="center" margin="25,0,2,3" height="31"></textblock> <textblock grid.column="1" text="quantity" foreground="#ff040404" fontsize="24" fontweight="bold" fontfamily="raavi" selectionhighlightcolor="#ffe05022" verticalalignment="center" horizontalalignment="right" margin="0,0,-5,-9"></textblock> <textblock grid.column="2" text="price" foreground="#ff080808" fontsize="24" fontweight="bold" fontfamily="raavi" selectionhighlightcolor="#ffe05022" verticalalignment="center" horizontalalignment="right" margin="0,0,30,-9"></textblock> </grid> </datatemplate> </listview.headertemplate> <listview.itemtemplate> <datatemplate> <stackpanel grid.row="2"> <grid> <grid.columndefinitions> <columndefinition width="400"></columndefinition> <columndefinition width="200"></columndefinition> <columndefinition width="200"></columndefinition> </grid.columndefinitions> <textblock grid.column="0" fontfamily="arial narrow" text="{binding name}" fontsize="18" height="40" verticalalignment="center" foreground="black" margin="10,0,0,0" width="400" textwrapping="wrap"/> <textblock grid.column="1" fontfamily="arial narrow" text="{binding ordered_qty}" fontsize="18" height="40" verticalalignment="center" horizontalalignment="right" foreground="black" margin="0,0,28,0" width="auto"/> <textblock grid.column="2" fontfamily="arial narrow" text="{binding unit_price}" fontsize="18" height="40" verticalalignment="center" horizontalalignment="right" foreground="black" margin="0,0,40,0" width="auto"/> </grid> </stackpanel> </datatemplate> </listview.itemtemplate> </listview> <grid grid.row="3" grid.rowspan="2" name="disscount_pnl_detail" width="450" verticalalignment="top" horizontalalignment="left"> <grid.rowdefinitions> <rowdefinition height="22"></rowdefinition> <rowdefinition height="22"></rowdefinition> <rowdefinition height="22"></rowdefinition> <rowdefinition height="22"></rowdefinition> <rowdefinition height="22"></rowdefinition> </grid.rowdefinitions> <grid.columndefinitions> <columndefinition width="300"></columndefinition> <columndefinition width="150"></columndefinition> </grid.columndefinitions> <textblock fontfamily="arial narrow" text="sub total : " grid.row="0" grid.column="0" fontsize="18" textalignment="right" foreground="black" height="22" /> <textblock name="invoice_subtotal" grid.row="0" grid.column="1" text="$0.00" horizontalalignment="left" textalignment="right" foreground="#ffff3400" fontsize="20" /> <textblock fontfamily="arial narrow" text="discount : " grid.column="0" grid.row="1" fontsize="18" textalignment="right" foreground="black" height="22" /> <textblock text="$0.00" name="invoice_discount" grid.column="1" grid.row="1" horizontalalignment="left" textalignment="right" foreground="#ffff3400" fontsize="20" /> <textblock fontfamily="arial narrow" text="tax : " grid.row="2" grid.column="0" fontsize="18" textalignment="right" foreground="black" height="22" /> <textblock text="$0.00" name="invoice_tax" grid.row="2" grid.column="1" horizontalalignment="left" textalignment="right" foreground="#ffff3400" fontsize="20" /> <textblock fontfamily="arial narrow" text="shipping , handling : " fontsize="18" foreground="black" textalignment="right" grid.row="3" grid.column="0" /> <textblock name="invoice_shippingcharge" text="$0.00" horizontalalignment="left" foreground="#ffff3400" textalignment="right" fontsize="20" grid.row="3" grid.column="1" /> <textblock fontfamily="arial narrow" text="grand total :" fontsize="22" foreground="black" textalignment="right" fontweight="bold" grid.row="4" grid.column="0"/> <textblock name="invoice_grandtotal" text="$0.00" horizontalalignment="left" foreground="#ffff3400" fontsize="20" textalignment="right" grid.row="4" grid.column="1" /> </grid> </grid> </grid> </page>
to fix issue, can set fontfamily
textblock
. once add fontfamily
in textblock
, printed properly.
we can set fontfamily
in textblock
<textblock name="invoice_subtotal" fontfamily="arial narrow" .../>
1 one. or textblock
s using "arial narrow" font, can set in style target textblock
s in grid
like
<grid name="gridpopup" background="white" visibility="visible"> <grid.resources> <style targettype="textblock"> <setter property="fontfamily" value="arial narrow" /> </style> </grid.resources> ... </grid>
Comments
Post a Comment