IXpsFixedPageReader 介面
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
定義讀取 部分 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
- 實作
範例
以下範例展示了如何從 取得IXpsFixedPageReaderIXpsFixedDocumentReader集合。 範例也展示了如何利用固定頁閱讀器新增 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()
屬性
| 名稱 | Description |
|---|---|
| ColorContexts |
會收集頁面上所有的色彩上下文。 |
| Fonts |
會收集該頁面上所有使用的字體。 |
| Images |
會收集頁面上所有圖片的集合。 |
| PageNumber |
拿到頁碼。 |
| PrintTicket |
若存在與 相關聯PrintTicket的 工單,則得到 FixedPage。 |
| ResourceDictionaries |
會取得該頁面所有資源字典的集合。 |
| StoryFragment |
它會拿 StoryFragments 到 XPS 套件的標記部分。 |
| Thumbnail |
取得縮圖影像,若存在縮圖,該縮圖與 相關聯 FixedPage。 |
| Uri |
取得 的統一資源識別碼(URI) FixedPage。 |
| XmlReader |
有 XmlReader 一篇專頁。 |
方法
| 名稱 | Description |
|---|---|
| AddStoryFragment() |
為 XPS 套件新增一個 StoryFragments 元素。 (繼承來源 IStoryFragmentProvider) |
| GetColorContext(Uri) |
取得具有指定統一資源識別碼(URI)的資源的色彩上下文。 |
| GetFont(Uri) |
取得具有指定統一資源識別碼(URI)的字型。 |
| GetImage(Uri) |
取得具有指定統一資源識別碼(URI)的映像檔。 |
| GetResource(Uri) |
取得具有指定統一資源識別碼(URI)的資源。 |
| GetResourceDictionary(Uri) |
取得具有指定統一資源識別碼(URI)的資源字典。 |