Windows Vista Forums

Re: DocumentViewer, annotations and XPS

  1. #1


    Jack Davis Guest

    Re: DocumentViewer, annotations and XPS

    Hi Jens,

    In answer to your questions:

    For #1: I'm not certain if we understand your question. If you're
    looking to do a "stamp" type annotation using an image as a background
    on the annotation, you may be able to do this through styling to set a
    background image. An Annotation Styling sample has just been added to
    the SDK and will be available shortly at MSDN on-line. A preliminary
    version of the annotations styling sample is available at Derek
    Mehlhorn's blog at http://blogs.msdn.com/mehlhorn/default.aspx.

    For #2: Yes, DocumentViewer does automatically virtualize content, so
    only the pages visible are loaded into memory at runtime. For an
    example of dynamically creating and writing an XPS document see the
    "Creating an XPS Document Sample" at
    http://windowssdk.msdn.microsoft.com.../ms771596.aspx.

    For #3: Yes, DocumentViewer supports Hyperlink navigation when it is
    inside an object that is a NavigationService
    (http://windowssdk.msdn.microsoft.com....windows.navig
    ation.navigationservice.aspx), such as Frame
    (http://windowssdk.msdn.microsoft.com....windows.contr
    ols.frame.aspx) or NavigationWindow
    (http://windowssdk.msdn.microsoft.com...ms615518.aspx). You
    can attach an event handler to the Frame.Navigating
    (http://windowssdk.msdn.microsoft.com....windows.contr
    ols.frame.navigating.aspx) event or NavigationWindow.Navigating
    (http://windowssdk.msdn.microsoft.com....windows.navig
    ation.navigationwindow.navigating.aspx) event for special handling of
    hyperlink navigations. (For more information see the Navigation
    Overview at
    http://windowssdk.msdn.microsoft.com.../ms750478.aspx.

    Thanks for your interest in .NET 3.0!

    Jack Davis
    Microsoft Windows Client SDK

    -----Original Message-----
    From: Jens
    Posted At: Friday, September 29, 2006 1:53 AM
    Posted To: microsoft.public.windows.developer.winfx.avalon
    Conversation: DocumentViewer, annotations and XPS
    Subject: DocumentViewer, annotations and XPS

    Hi all,

    I had a quick look at the DocumentViewer control and the usage samples
    in
    SDK. It is a promising approach for my application to build a viewer
    showing
    various document formats by first convertig them to XPS and use this
    control
    for display and print. Some general question regarding the design of my
    application:

    1) Annotations
    The samples also demonstrates using annotations. But I have the
    requirement
    to display an extendes set of custom annotations (graphical objects,
    stamps,
    etc.) Is it intended by the design to integrate custom annotations in
    the
    framework? What would be the way to do this? Derive from
    System.Windows.Annotations.Annotation?

    2) dynamic XPS creation at runtime
    When I have documents containings several thousands of pages it is not
    feasible to download them completely.
    Does the control suppport dynamic generation of individual pages at
    runtime?
    Is there a mechanism like UI virtualization built in to support this?
    The
    scenario is: User triggers command display page 3411, application should
    render this single page to XPS and display it.

    3) Hyperlinks
    Does the XPS spec and the DocumentViewer control support some form of
    hyperlink where the application intecepts the activation of the
    hyperlink and
    processes it.

    Any help hints or available sample code would be appreciated.

    Thanks Jens








      My System SpecsSystem Spec

  2. #2


    Jens Guest

    Re: DocumentViewer, annotations and XPS

    Hi Jack,

    thank you for your detailed answer, this helped a lot!

    Regarding #1 your proposal sounds promising. I will have to become more
    familiar with this.

    For #3 this sounds exactly what I looked for.

    Regarding #2 I studied the sample, understood more about the architecture
    :-) but now have to state more precisely my requirements. XpsCreate shows me
    how to dynamically create a FixedDoc on the fly. This is the first part of a
    solution for my problem. Let's assume I have a document containing 50.000
    pages (yes they really exist). Using the approach of the sample I would
    create a FixedDocument but would need 50000 calls of
    fixedDocument.Pages.Add(pageContent). Each pageContent instance has text and
    other elements. Even if the DocumentViewer control renders only the visible
    pages I feel that creating all these objects consumes very much time and
    memory. What I think of is a design where I create the page content of
    individual pages only on demand. If I understood well this is the task of the
    Paginator class, so I would need my own DocumentPaginator class overriding
    the GetPage() and GetPageAsync() methods. The implementation of my subclass
    would generate the page object on demand and return it as result of a
    GetPage() call. But my problem is that I see no way to make FixedDocument
    aware of my Paginator (only get, no set property). I would not even need a
    FixedDocument at all: the control requires only a paginator. But trying this
    results in an exception that the control only supports FixedDocuments and
    FlowDocuments... why? (see also my post from 10/17/2006 and sorry for
    duplicating the info, I got lost between forums and newsgroups of MSDN).

    Another limitation I see is that it seems that all pages of a FixedDocument
    must have the same size. In this way even mixing portrait and landscape pages
    would not be possible inside of a FixedDocument.

    Thanks again
    Jens

      My System SpecsSystem Spec

Re: DocumentViewer, annotations and XPS

Similar Threads
Thread Thread Starter Forum Replies Last Post
Annotations on scanned documents? Blue Max Vista print fax & scan 0 17 May 2007
Looking for feedback for WPF Annotations Svetlana Simova Avalon 0 04 Oct 2006
DocumentViewer, annotations and XPS Jens Avalon 0 29 Sep 2006
How to apply BitmapEffect to pages displayed inside DocumentViewer =?Utf-8?B?Q3RB?= Avalon 0 31 Jul 2006
DocumentViewer print preview shivaprasad@techie.com Avalon 0 11 Jan 2006