Share via


IXpsFixedPageReader Interfaccia

Definizione

Definisce metodi per la lettura delle parti di un oggetto 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
Implementazioni

Esempio

Nell'esempio seguente viene illustrato come ottenere una IXpsFixedPageReader raccolta da un IXpsFixedDocumentReaderoggetto . L'esempio illustra anche come usare il lettore a pagina fissa per aggiungere un nuovo StoryFragment oggetto che definisce la struttura del documento della pagina.

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()

Proprietà

ColorContexts

Ottiene un insieme di tutti gli spazi colore sulla pagina.

Fonts

Ottiene un insieme di tutti i tipi di carattere utilizzati sulla pagina.

Images

Ottiene un insieme di tutte le immagini sulla pagina.

PageNumber

Ottiene il numero della pagina.

PrintTicket

Ottiene un oggetto PrintTicket, se esiste un ticket, associato a FixedPage.

ResourceDictionaries

Ottiene un insieme di tutti i dizionari delle risorse per la pagina.

StoryFragment

Ottiene la StoryFragments parte del markup di un pacchetto XPS.

Thumbnail

Ottiene l'immagine di anteprima, se esiste un'anteprima, associata a FixedPage.

Uri

Ottiene l'URI (Uniform Resource Identifier) di FixedPage.

XmlReader

Ottiene un oggetto XmlReader della pagina.

Metodi

AddStoryFragment()

Aggiunge un elemento a un StoryFragments pacchetto XPS.

(Ereditato da IStoryFragmentProvider)
GetColorContext(Uri)

Ottiene il contesto colore per la risorsa con l'URI (Uniform Resource Identifier) specificato.

GetFont(Uri)

Ottiene il tipo di carattere con l'URI (Uniform Resource Identifier) specificato.

GetImage(Uri)

Ottiene l'immagine con l'URI (Uniform Resource Identifier) specificato.

GetResource(Uri)

Ottiene la risorsa con l'URI (Uniform Resource Identifier) specificato.

GetResourceDictionary(Uri)

Ottiene il dizionario risorse con l'URI (Uniform Resource Identifier) specificato.

Si applica a