I am trying to allow users to annotate a document using a touchscreen before saving or printing the document. Essentially, I am assembling the document in code with three parts - an ImageBrush with a "picture" of some dynamic text created in a third party application, an ImageBrush with a blank form (transparent background), and a stroke collection representing the input from the touchscreen. I know this is not the preferred way of creating an XPS, however I have no runtime access to the dynamic text to generate it as TextBlocks, etc. The document is defined in XAML like this:
<Viewbox x:Name="viewboxDocView" Grid.Row="0">
<FixedPage x:Name="fixedPage" Width="720" Height="960" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10">
<InkCanvas x:Name="inkCanvas" Width="720" Height="960" HorizontalAlignment="Center" VerticalAlignment="Center" ></InkCanvas>
</FixedPage>
</Viewbox>
In code behind, I am setting the FixedPage background to show the dynamic text, and the InkCanvas background to show the transparent form.
inkCanvas.Background = myImageBrush;
fixedPage.Background = myOtherImageBrush;
It shows up beautifully in my application, saves fine as an XPS file, and displays beautifully in both XPS Viewer and Microsoft Reader. The only problem is that when I try to print from any of these applications, the page image is tiny. The two images print in their entirety and scale down, and the Strokes appear full size but get cropped on most printers so that only the upper-left portion is visible.
I explicitly define the page dimensions as 720 x 960 because 960 * 1/96" = 10 inches and 720 * 1/96" = 7.5 inches, forcing a minimum of 0.5" margin on an 8.5x11" page. When I print, the image is exactly 2.4" x 3.2", which means that the printer resolution is 960 / 3.2 = 300 dpi, not 96 dpi as expected. I know that printers normally do use 300 dpi, so this isn't entirely surprising, but I thought that the whole point of the FixedDocument was the WYSIWYG concept as described here.
Is there a way to explictly define the page as 7.5" x 10" (or 8.5" x 11" with centered content) so that it will print properly? It seems that when I start resizing things in XAML or trying to use transforms, it screws up the on-screen display, which is ultimately more important to the application.