IXpsFixedDocumentReader 인터페이스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
문서의 파트를 읽는 방법과 제한된 형식의 FixedDocument 문서 쓰기에 대한 메서드를 정의합니다.
public interface class IXpsFixedDocumentReader : System::Windows::Xps::Packaging::IDocumentStructureProvider
public interface IXpsFixedDocumentReader : System.Windows.Xps.Packaging.IDocumentStructureProvider
type IXpsFixedDocumentReader = interface
interface IDocumentStructureProvider
Public Interface IXpsFixedDocumentReader
Implements IDocumentStructureProvider
- 구현
예제
다음 예제에서는이 인터페이스를 구현 하는 개체에 대 한 참조를 가져오는 방법을 보여 줍니다.
private void SignatureDefinitionCommandHandler(object sender, RoutedEventArgs e)
{
SignatureDefinition sigDefDialog = new SignatureDefinition();
if (sigDefDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
XpsSignatureDefinition signatureDefinition = new XpsSignatureDefinition();
signatureDefinition.RequestedSigner = sigDefDialog.RequestedSigner.Text;
signatureDefinition.Intent = sigDefDialog.Intent.Text;
signatureDefinition.SigningLocale = sigDefDialog.SigningLocale.Text;
try
{
signatureDefinition.SignBy = DateTime.Parse(sigDefDialog.SignBy.Text);
}
catch (FormatException)
{
}
signatureDefinition.SpotId = Guid.NewGuid();
IXpsFixedDocumentSequenceReader docSeq = _xpsDocument.FixedDocumentSequenceReader; //_xpsDocument is type System.Windows.Xps.Packaging.XpsDocument
IXpsFixedDocumentReader doc = docSeq.FixedDocuments[0];
doc.AddSignatureDefinition(signatureDefinition);
doc.CommitSignatureDefinition();
InitializeSignatureDisplay();
}
}
Private Sub SignatureDefinitionCommandHandler(sender As Object, e As RoutedEventArgs)
Using sigDefDialog As New SignatureDefinition()
If sigDefDialog.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
Dim signatureDefinition As New XpsSignatureDefinition With {
.RequestedSigner = sigDefDialog.RequestedSigner.Text,
.Intent = sigDefDialog.Intent.Text,
.SigningLocale = sigDefDialog.SigningLocale.Text
}
Try
signatureDefinition.SignBy = Date.Parse(sigDefDialog.SignBy.Text)
Catch e1 As FormatException
End Try
signatureDefinition.SpotId = Guid.NewGuid()
Dim docSeq As IXpsFixedDocumentSequenceReader = _xpsDocument.FixedDocumentSequenceReader '_xpsDocument is type System.Windows.Xps.Packaging.XpsDocument
Dim doc As IXpsFixedDocumentReader = docSeq.FixedDocuments(0)
doc.AddSignatureDefinition(signatureDefinition)
doc.CommitSignatureDefinition()
InitializeSignatureDisplay()
End If
End Using
End Sub
다음 예제에서는 컬렉션의 각 페이지에 액세스 하기 위해 컬렉션을 가져오는 IXpsFixedDocumentReader 방법을 IXpsFixedDocumentReader 보여 있습니다FixedDocument.
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()
속성
| Name | Description |
|---|---|
| DocumentNumber |
에 있는 FixedDocumentSequence문서의 0부터 시작하는 위치를 가져옵니다. |
| DocumentStructure |
있는 |
| FixedPages |
판독기의 FixedPage 컬렉션을 가져옵니다. 각 페이지에 대해 하나의 판독기입니다 FixedDocument. |
| PrintTicket |
PrintTicket에 연결된 (있는 경우)를 FixedDocument가져옵니다. |
| SignatureDefinitions |
에 연결된 FixedDocument모든 서명 정의의 컬렉션을 가져옵니다. |
| Thumbnail |
썸네일이 있는 경우 썸네일 이미지와 연결된 FixedDocument썸네일 이미지를 가져옵니다. |
| Uri |
의 URI(Uniform Resource Identifier)를 FixedDocument가져옵니다. |
메서드
| Name | Description |
|---|---|
| AddDocumentStructure() |
|
| AddSignatureDefinition(XpsSignatureDefinition) |
에 지정된 값을 XpsSignatureDefinitionFixedDocument추가합니다. |
| CommitSignatureDefinition() |
패키지를 플러시하고 패키지 Stream 에 XpsSignatureDefinition 커밋합니다. |
| GetFixedPage(Uri) |
FixedPage 지정된 URI(Uniform Resource Identifier)를 사용하는 판독기를 가져옵니다. |
| RemoveSignatureDefinition(XpsSignatureDefinition) |
에서 지정된 XpsSignatureDefinition 값을 FixedDocument제거합니다. |