本文整理汇总了C#中XpsDocument.GetFixedDocumentSequence方法的典型用法代码示例。如果您正苦于以下问题:C# XpsDocument.GetFixedDocumentSequence方法的具体用法?C# XpsDocument.GetFixedDocumentSequence怎么用?C# XpsDocument.GetFixedDocumentSequence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XpsDocument
的用法示例。
在下文中一共展示了XpsDocument.GetFixedDocumentSequence方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PreviewWindow
public PreviewWindow(CustomDocumentPaginator documentPaginator)
{
InitializeComponent();
//xps
stream = new MemoryStream();
Package package = Package.Open(stream, FileMode.Create, FileAccess.ReadWrite);
var uri = new Uri(@"memorystream://myXps.xps");
//already in packagestore, so remove
if (PackageStore.GetPackage(uri) != null)
{
PackageStore.RemovePackage(uri);
}
PackageStore.AddPackage(uri, package);
var xpsDoc = new XpsDocument(package);
xpsDoc.Uri = uri;
XpsDocument.CreateXpsDocumentWriter(xpsDoc).Write(documentPaginator);
FixedDocumentSequence fds = xpsDoc.GetFixedDocumentSequence();
dv1.Document = (IDocumentPaginatorSource)fds;
}
示例2: Window2_Loaded
void Window2_Loaded(object sender, RoutedEventArgs e)
{
//throw new NotImplementedException();
XpsDocument xpsdoc = new XpsDocument("xml.xps", System.IO.FileAccess.Read);
FixedDocumentSequence fds = xpsdoc.GetFixedDocumentSequence();
documentViewer.Document = fds.References[0].GetDocument(true);
}
示例3: Window_Loaded
private void Window_Loaded(object sender, EventArgs e)
{
XpsDocument doc = new XpsDocument("test.xps", FileAccess.ReadWrite);
docViewer.Document = doc.GetFixedDocumentSequence();
doc.Close();
}
示例4: btnPrint_Click
private void btnPrint_Click(object sender, EventArgs e)
{
//REFACTOR ME
dtgParentReport.Update();
System.Windows.Controls.PrintDialog printDialog = new System.Windows.Controls.PrintDialog();
Nullable<bool> print = printDialog.ShowDialog();
if (print == true)
{
try
{
XpsDocument xpsDocument = new XpsDocument("C:\\FixedDocumentSequence.xps", FileAccess.ReadWrite);
FixedDocumentSequence fixedDocSeq = xpsDocument.GetFixedDocumentSequence();
printDialog.PrintDocument(fixedDocSeq.DocumentPaginator, "Test print job");
}
catch (UnauthorizedAccessException e1)
{
const string message =
"Unauthoried to access that printer.";
const string caption = "Unauthoried Access";
var result = MessageBox.Show(message, caption,
MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
catch (PrintDialogException e2)
{
const string message =
"Unknow error occurred.";
const string caption = "Error Printing";
var result = MessageBox.Show(message, caption,
MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
}
示例5: SaveToPdf
public static void SaveToPdf(this FlowDocument flowDoc, string filename)
{
MemoryStream xamlStream = new MemoryStream();
XamlWriter.Save(flowDoc, xamlStream);
File.WriteAllBytes("d:\\file.xaml", xamlStream.ToArray());
IDocumentPaginatorSource text = flowDoc as IDocumentPaginatorSource;
xamlStream.Close();
MemoryStream memoryStream = new MemoryStream();
Package pkg = Package.Open(memoryStream, FileMode.Create, FileAccess.ReadWrite);
string pack = "pack://temp.xps";
PackageStore.AddPackage(new Uri(pack), pkg);
XpsDocument doc = new XpsDocument(pkg, CompressionOption.SuperFast, pack);
XpsSerializationManager rsm = new XpsSerializationManager(new XpsPackagingPolicy(doc), false);
DocumentPaginator pgn = text.DocumentPaginator;
rsm.SaveAsXaml(pgn);
MemoryStream xpsStream = new MemoryStream();
var writer = new XpsSerializerFactory().CreateSerializerWriter(xpsStream);
writer.Write(doc.GetFixedDocumentSequence());
MemoryStream outStream = new MemoryStream();
NiXPS.Converter.XpsToPdf(xpsStream, outStream);
File.WriteAllBytes("file.pdf", outStream.ToArray());
}
示例6: window_Loaded
private void window_Loaded(object sender, RoutedEventArgs e)
{
doc = new XpsDocument("ch19.xps", FileAccess.ReadWrite);
docViewer.Document = doc.GetFixedDocumentSequence();
service = AnnotationService.GetService(docViewer);
if (service == null)
{
Uri annotationUri = PackUriHelper.CreatePartUri(new Uri("AnnotationStream", UriKind.Relative));
Package package = PackageStore.GetPackage(doc.Uri);
PackagePart annotationPart = null;
if (package.PartExists(annotationUri))
{
annotationPart = package.GetPart(annotationUri);
}
else
{
annotationPart = package.CreatePart(annotationUri, "Annotations/Stream");
}
// Load annotations from the package.
AnnotationStore store = new XmlStreamStore(annotationPart.GetStream());
service = new AnnotationService(docViewer);
service.Enable(store);
}
}
示例7: ShowXpsPreview
private static void ShowXpsPreview(XpsDocument xpsDocument)
{
var previewWindow = new Window();
var docViewer = new DocumentViewer();
previewWindow.Content = docViewer;
docViewer.Document = xpsDocument.GetFixedDocumentSequence();
previewWindow.ShowDialog();
}
示例8: HelpView_OnLoaded
private void HelpView_OnLoaded(object sender, RoutedEventArgs e)
{
var directory = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
directory = Path.Combine(directory, "UserGuide");
var fileName = Path.Combine(directory, "HowToUseGuide.xps");
var doc = new XpsDocument(fileName, FileAccess.Read);
HelpDocumentViewer.Document = doc.GetFixedDocumentSequence();
}
示例9: OpenXPS
public static DeckModel OpenXPS(string file)
{
try
{
Misc.ProgressBarForm progressForm = new UW.ClassroomPresenter.Misc.ProgressBarForm("Opening \"" + file + "\"...");
progressForm.Show();
//Open Xps Document
XpsDocument xpsDocument = null;
xpsDocument = new XpsDocument(file, FileAccess.Read);
//Create two DocumentPaginators for the XPS document. One is for local display, the other one is for the delivery to students.
DocumentPaginator paginator = xpsDocument.GetFixedDocumentSequence().DocumentPaginator;
//Create Deck Model
Guid deckGuid = Guid.NewGuid();
DeckModel deck = new DeckModel(deckGuid, DeckDisposition.Empty, file);
using (Synchronizer.Lock(deck.SyncRoot))
{
deck.IsXpsDeck = true;
//Iterate over all pages
for (int i = 0; i < paginator.PageCount; i++)
{
DocumentPage page = paginator.GetPage(i);
SlideModel newSlideModel = CreateSlide(page, deck);
//Create a new Entry + reference SlideModel
TableOfContentsModel.Entry newEntry = new TableOfContentsModel.Entry(Guid.NewGuid(), deck.TableOfContents, newSlideModel);
//Lock the TOC
using (Synchronizer.Lock(deck.TableOfContents.SyncRoot))
{
//Add Entry to TOC
deck.TableOfContents.Entries.Add(newEntry);
}
//Update the Progress Bar
progressForm.UpdateProgress(0, paginator.PageCount , i+1);
}
}
//Close Progress Bar
progressForm.Close();
return deck;
}
catch (Exception e)
{
System.Diagnostics.Trace.WriteLine(e.ToString());
}
GC.Collect();
return null;
}
示例10: ViewDocument
public void ViewDocument(string fileName)
{
if (System.IO.File.Exists(fileName) == true)
{
XpsDocument xpsDocument = new XpsDocument(fileName, System.IO.FileAccess.Read);
this.Viewer.Document = xpsDocument.GetFixedDocumentSequence();
xpsDocument.Close();
}
}
示例11: OnLoaded
public void OnLoaded(object sender, RoutedEventArgs args)
{
XpsDocument document = new XpsDocument(Window1.CombineFileInCurrentDirectory("CSharp 3.0 Specification.xps"), System.IO.FileAccess.Read);
FixedDocument doc = new FixedDocument();
FixedDocumentSequence fixedDoc = document.GetFixedDocumentSequence();
viewer.Document = fixedDoc;
viewer.FitToHeight();
}
示例12: MarkingTool
public MarkingTool(MainUI main)
{
this.InitializeComponent();
// Insert code required on object creation below this point.
this.main = main;
doc = main.curDoc.getXPSCopy();
if (doc != null)
docView.Document = doc.GetFixedDocumentSequence();
}
示例13: LoadQuickStartToDocummentViewer
private void LoadQuickStartToDocummentViewer()
{
string fileName = @"Quick Start Guide.xps";
XpsDocument document = new XpsDocument(fileName, FileAccess.Read);
this.documentViewer.Document = document.GetFixedDocumentSequence();
document.Close();
this.documentViewer.FitToWidth();
var contentHost = this.documentViewer.Template.FindName("PART_ContentHost", this.documentViewer) as ScrollViewer;
var grid = contentHost?.Parent as Grid;
grid?.Children.RemoveAt(0);
}
示例14: HelpWindow
public HelpWindow()
{
InitializeComponent();
try
{
XpsDocument doc = new XpsDocument("zLabels User Guide.xps", FileAccess.Read);
documentViewer.Document = doc.GetFixedDocumentSequence();
}
catch(Exception ex)
{
MessageBox.Show("Couldn't open help document.\n" + ex.Message, "Even Help Can't Help");
}
}
示例15: XpsPaginator
public XpsPaginator(byte[] xpsDocument, string xpsPackageUri)
{
var packageUri = new Uri(xpsPackageUri);
package = PackageStore.GetPackage(packageUri);
if (package == null)
{
stream = new MemoryStream(xpsDocument);
package = Package.Open(stream, FileMode.Open, FileAccess.Read);
PackageStore.AddPackage(packageUri, package);
}
document = new XpsDocument(package, CompressionOption.Fast, xpsPackageUri);
Sequence = document.GetFixedDocumentSequence();
}