IXpsFixedPageReader Interface
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Définit des méthodes pour lire les parties d’un 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
- Implémente
Exemples
L’exemple suivant montre comment obtenir une IXpsFixedPageReader collection à partir d’un IXpsFixedDocumentReader. L’exemple montre également comment utiliser le lecteur de page fixe pour ajouter un nouveau StoryFragment qui définit la structure du document de la page.
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()
Propriétés
| Nom | Description |
|---|---|
| ColorContexts |
Obtient une collection de tous les contextes de couleur de la page. |
| Fonts |
Obtient une collection de toutes les polices utilisées sur la page. |
| Images |
Obtient une collection de toutes les images de la page. |
| PageNumber |
Obtient le numéro de page. |
| PrintTicket |
Obtient le PrintTicket, s’il existe un ticket, associé au FixedPage. |
| ResourceDictionaries |
Obtient une collection de tous les dictionnaires de ressources de la page. |
| StoryFragment |
Obtient la StoryFragments partie du balisage d’un package XPS. |
| Thumbnail |
Obtient l’image miniature, si une miniature existe, associée au FixedPage. |
| Uri |
Obtient l’URI (Uniform Resource Identifier) du FixedPage. |
| XmlReader |
Obtient une XmlReader pour la page. |
Méthodes
| Nom | Description |
|---|---|
| AddStoryFragment() |
Ajoute un élément à un StoryFragments package XPS. (Hérité de IStoryFragmentProvider) |
| GetColorContext(Uri) |
Obtient le contexte de couleur de la ressource qui a l’URI (Uniform Resource Identifier) spécifié. |
| GetFont(Uri) |
Obtient la police qui a l’URI (Uniform Resource Identifier) spécifié. |
| GetImage(Uri) |
Obtient l’image qui a l’URI (Uniform Resource Identifier) spécifié. |
| GetResource(Uri) |
Obtient la ressource qui a l’URI (Uniform Resource Identifier) spécifié. |
| GetResourceDictionary(Uri) |
Obtient le dictionnaire de ressources qui a l’URI (Uniform Resource Identifier) spécifié. |