IXpsFixedPageReader Интерфейс
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Определяет методы для чтения частей объекта 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
- Реализации
Примеры
В следующем примере показано, как получить коллекцию IXpsFixedPageReader из объекта IXpsFixedDocumentReader. В примере также показано, как использовать средство чтения с фиксированной страницей для добавления нового StoryFragment элемента, определяющего структуру документа страницы.
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()
Свойства
| Имя | Описание |
|---|---|
| ColorContexts |
Возвращает коллекцию всех контекстов цвета на странице. |
| Fonts |
Возвращает коллекцию всех шрифтов, используемых на странице. |
| Images |
Возвращает коллекцию всех изображений на странице. |
| PageNumber |
Возвращает номер страницы. |
| PrintTicket |
PrintTicketВозвращает объект , если билет существует, связанный с FixedPageним. |
| ResourceDictionaries |
Возвращает коллекцию всех словарей ресурсов для страницы. |
| StoryFragment |
StoryFragments Возвращает часть разметки пакета XPS. |
| Thumbnail |
Получает изображение эскиза, если эскиз существует, связанный с ним FixedPage. |
| Uri |
Возвращает универсальный идентификатор ресурса (URI) объекта FixedPage. |
| XmlReader |
XmlReader Получает значение для страницы. |
Методы
| Имя | Описание |
|---|---|
| AddStoryFragment() |
Добавляет элемент в StoryFragments пакет XPS. (Унаследовано от IStoryFragmentProvider) |
| GetColorContext(Uri) |
Возвращает контекст цвета для ресурса с указанным универсальным идентификатором ресурса (URI). |
| GetFont(Uri) |
Возвращает шрифт с указанным универсальным идентификатором ресурса (URI). |
| GetImage(Uri) |
Получает изображение с указанным универсальным идентификатором ресурса (URI). |
| GetResource(Uri) |
Возвращает ресурс с указанным универсальным идентификатором ресурса (URI). |
| GetResourceDictionary(Uri) |
Возвращает словарь ресурсов, имеющий указанный универсальный идентификатор ресурса (URI). |