IXpsFixedPageReader Interfejs

Definicja

Definiuje metody odczytywania części obiektu FixedPage.

public interface class IXpsFixedPageReader : System::Windows::Xps::Packaging::IStoryFragmentProvider
public interface IXpsFixedPageReader : System.Windows.Xps.Packaging.IStoryFragmentProvider
type IXpsFixedPageReader = interface
    interface IStoryFragmentProvider
Public Interface IXpsFixedPageReader
Implements IStoryFragmentProvider
Implementuje

Przykłady

W poniższym przykładzie pokazano, jak uzyskać IXpsFixedPageReader kolekcję z obiektu IXpsFixedDocumentReader. W przykładzie pokazano również, jak używać czytnika stałych stron w celu dodania nowego StoryFragment elementu definiującego strukturę dokumentu strony.

ShowStatus("   Getting FixedDocumentSequenceReader.");
IXpsFixedDocumentSequenceReader fixedDocSeqReader =
    xpsDocument.FixedDocumentSequenceReader;

ShowStatus("   Getting FixedDocumentReaders.");
ICollection<IXpsFixedDocumentReader> fixedDocuments =
    fixedDocSeqReader.FixedDocuments;

ShowStatus("   Getting FixedPageReaders.");
IEnumerator<IXpsFixedDocumentReader> enumerator =
    fixedDocuments.GetEnumerator();
enumerator.MoveNext();
ICollection<IXpsFixedPageReader> fixedPages =
    enumerator.Current.FixedPages;

// Add a document structure to each fixed page.
int i = 0;
foreach (IXpsFixedPageReader fixedPageReader in fixedPages)
{
    XpsResource pageStructure;
    ShowStatus("   Adding page structure resource:\n       '" +
                       Filename(_fixedPageStructures[i]) + "'");
    try
    {   // Add a new StoryFragment to hold the page structure.
        pageStructure = fixedPageReader.AddStoryFragment();
    }
    catch (System.InvalidOperationException)
    {
        MessageBox.Show(xpsUnstructuredFile +
            "\n\nDocument structure cannot be added.\n\n" +
            Filename(xpsUnstructuredFile) + " might already " +
            "contain an existing document structure.",
            "Cannot Add Document Structure",
            MessageBoxButton.OK, MessageBoxImage.Error);
        break;
    }

    // Copy the page structure to the new StoryFragment.
    WriteResource(pageStructure, _fixedPageStructures[i++]);
}

ShowStatus("   Saving and closing the new document.\n");
xpsDocument.Close();
ShowStatus("   Getting FixedDocumentSequenceReader.")
Dim fixedDocSeqReader As IXpsFixedDocumentSequenceReader = xpsDocument.FixedDocumentSequenceReader

ShowStatus("   Getting FixedDocumentReaders.")
Dim fixedDocuments As ICollection(Of IXpsFixedDocumentReader) = fixedDocSeqReader.FixedDocuments

ShowStatus("   Getting FixedPageReaders.")
Dim enumerator As IEnumerator(Of IXpsFixedDocumentReader) = fixedDocuments.GetEnumerator()
enumerator.MoveNext()
Dim fixedPages As ICollection(Of IXpsFixedPageReader) = enumerator.Current.FixedPages


' Add a document structure to each fixed page.
Dim i As Integer = 0
For Each fixedPageReader As IXpsFixedPageReader In fixedPages
    Dim pageStructure As XpsResource
    ShowStatus("   Adding page structure resource:" & vbLf & "       '" & Filename(_fixedPageStructures(i)) & "'")
    Try
        pageStructure = fixedPageReader.AddStoryFragment()
    Catch e2 As InvalidOperationException
        System.Windows.MessageBox.Show(xpsUnstructuredFile & vbLf & vbLf & "Document structure cannot be added." & vbLf & vbLf & Filename(xpsUnstructuredFile) & " might already " & "contain an existing document structure.",
                        "Cannot Add Document Structure",
                        MessageBoxButton.OK,
                        MessageBoxImage.Error)
        Exit For
    End Try

    ' Copy the page structure to the new StoryFragment.
    WriteResource(pageStructure, _fixedPageStructures(i))
    i += 1
Next fixedPageReader

ShowStatus("   Saving and closing the new document." & vbLf)
xpsDocument.Close()

Właściwości

ColorContexts

Pobiera kolekcję wszystkich kontekstów kolorów na stronie.

Fonts

Pobiera kolekcję wszystkich czcionek używanych na stronie.

Images

Pobiera kolekcję wszystkich obrazów na stronie.

PageNumber

Pobiera numer strony.

PrintTicket

Pobiera element PrintTicket, jeśli istnieje bilet, który jest skojarzony z elementem FixedPage.

ResourceDictionaries

Pobiera kolekcję wszystkich słowników zasobów dla strony.

StoryFragment

StoryFragments Pobiera część znaczników pakietu XPS.

Thumbnail

Pobiera obraz miniatury, jeśli istnieje miniatura, która jest skojarzona z elementem FixedPage.

Uri

Pobiera jednolity identyfikator zasobu (URI) obiektu FixedPage.

XmlReader

Pobiera element XmlReader dla strony.

Metody

AddStoryFragment()

StoryFragments Dodaje element do pakietu XPS.

(Odziedziczone po IStoryFragmentProvider)
GetColorContext(Uri)

Pobiera kontekst koloru dla zasobu, który ma określony jednolity identyfikator zasobu (URI).

GetFont(Uri)

Pobiera czcionkę, która ma określony jednolity identyfikator zasobu (URI).

GetImage(Uri)

Pobiera obraz, który ma określony jednolity identyfikator zasobu (URI).

GetResource(Uri)

Pobiera zasób, który ma określony jednolity identyfikator zasobu (URI).

GetResourceDictionary(Uri)

Pobiera słownik zasobów, który ma określony jednolity identyfikator zasobu (URI).

Dotyczy