当前位置: 首页>>代码示例>>C#>>正文


C# XpsDocument.GetFixedDocumentSequence方法代码示例

本文整理汇总了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;
        }
开发者ID:Leth3,项目名称:pract,代码行数:25,代码来源:PreviewWindow.xaml.cs

示例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);
 }
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:7,代码来源:Window2.xaml.cs

示例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();
 }
开发者ID:ssickles,项目名称:archive,代码行数:7,代码来源:Xps.xaml.cs

示例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);
         }
     }
 }
开发者ID:jeffBunce,项目名称:Math-Monkeys-3.0,代码行数:34,代码来源:frmParentReport.cs

示例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());
        }
开发者ID:BlueForeverI,项目名称:DocumentEditorWpf,代码行数:28,代码来源:PdfConvertor.cs

示例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);
                
            }
        }
开发者ID:ittray,项目名称:LocalDemo,代码行数:27,代码来源:XpsAnnotations.xaml.cs

示例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();
 }
开发者ID:ivan-danilov,项目名称:XpsPrinting,代码行数:8,代码来源:PrintManager.cs

示例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();
        }
开发者ID:bhattvishal,项目名称:CalendarSyncplus,代码行数:9,代码来源:HelpView.xaml.cs

示例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;
        }
开发者ID:ClassroomPresenter,项目名称:CP3,代码行数:57,代码来源:XPSDeckIO.cs

示例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();
     }
 }
开发者ID:WilliamCopland,项目名称:YPILIS,代码行数:9,代码来源:XpsDocumentViewer.xaml.cs

示例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();
        }
开发者ID:dingxinbei,项目名称:OLdBck,代码行数:10,代码来源:UCFixedDocument.xaml.cs

示例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();
        }
开发者ID:Ceasius,项目名称:University,代码行数:11,代码来源:MarkingTool.xaml.cs

示例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);
        }
开发者ID:MarcoMedrano,项目名称:WinR,代码行数:13,代码来源:SettingsView.xaml.cs

示例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");
     }
 }
开发者ID:codehulk75,项目名称:Labels,代码行数:13,代码来源:HelpWindow.xaml.cs

示例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();
 }
开发者ID:kubaszostak,项目名称:KSz.Shared,代码行数:13,代码来源:Xps.cs


注:本文中的XpsDocument.GetFixedDocumentSequence方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。