xps

How do you hide a WPF DocumentViewer's menu bars?

谁说胖子不能爱 提交于 2019-11-29 00:12:59
At the moment I have a DocumentViewer in a WPF window that displays an XPS file. I have created my own "Next Page" and "Previous Page" buttons and have set the DocumentViewer.Background property to be completely transparent. All that is left of the DocumentViewer's own controls is the menu bar at the top (displaying zoom settings, print, etc.) and the "Find" bar at the bottom. I would quite like to remove (or hide) both of these bars, but I can't seem to figure out how!? Also, when the document is loaded it defaults to a zoom level that doesn't display the entire page on screen, I need to

How to convert a XPS file to an image in high quality (rather than blurry low resolution)?

北慕城南 提交于 2019-11-28 21:32:01
I'm trying to convert an XPS with WPF. The idea is that these images can be loaded with silverlight 4, for this I am using the following code: // XPS Document XpsDocument xpsDoc = new XpsDocument(xpsFileName, System.IO.FileAccess.Read); FixedDocumentSequence docSeq = xpsDoc.GetFixedDocumentSequence(); // The number of pages PageCount = docSeq.References[0].GetDocument(false).Pages.Count; DocumentPage sizePage = docSeq.DocumentPaginator.GetPage(0); PageHeight = sizePage.Size.Height; PageWidth = sizePage.Size.Width; // Scale dimensions from 96 dpi to 600 dpi. double scale = 300/ 96; // Convert a

How Can I Check That A File Is A Valid XPS File With C#?

早过忘川 提交于 2019-11-28 10:42:11
问题 I have a WinForms application that processes XPS files. How can I check that the file the user has selected in the open dialog is a valid XPS file using C#? There WILL be files present with the .XPS extension that are not really XPS files. Since XPS files are really in the PKZIP format, I could check for the PKZIP byte signature but that would give false positives on ZIP archives. 回答1: The following will distinguish XPS files from other ZIP archives and non-ZIP files. It won't determine

Extract text from a XPS Document [closed]

元气小坏坏 提交于 2019-11-28 06:19:01
问题 i need to extract the text of a specific page from a XPS document. The extracted text should be written in a string. I need this to read out the extracted text using Microsofts SpeechLib. Please examples only in C#. Thanks 回答1: Add References to ReachFramework and WindowsBase and the following using statement: using System.Windows.Xps.Packaging; Then use this code: XpsDocument _xpsDocument=new XpsDocument("/path",System.IO.FileAccess.Read); IXpsFixedDocumentSequenceReader fixedDocSeqReader =

WPF to XPS to PDF

时光怂恿深爱的人放手 提交于 2019-11-27 21:25:35
I have implemented a report in standard WPF controls and have also implemented a DocumentPaginator to take these controls and convert them into a document for printing. I have also implemented some code which uses the document paginator to render the pages to images and write them out to a PDF using PDFSharp , however this does not allow for copying and pasting, also the image quality is questionable. I have experimented with the GhostXPS utility and was thinking of using it by saving out to an XPS document and then using GhostXPS to convert it to a PDF, this was promising, however the current

Xps printing from windows service

浪子不回头ぞ 提交于 2019-11-27 19:11:35
I'm trying to print XPS documents from a windows service on the .net framework. Since Microsoft does not support printing by using System.Drawing.Printing nor by using System.Printing (WPF), I'm using the native XPSPrint API. This is suggested to me by Aspose in http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/howto-print-a-document-on-a-server-via-the-xpsprint-api.html . When I try to print an XPS document from a windows service, the result contains strange characters instead of the text I want. I tried with different printers (including virtual printers like for

Using CMYK colours in WPF/XAML

醉酒当歌 提交于 2019-11-27 18:14:10
问题 Is there any way to specify CMYK colours directly in a XAML document? prefixing them with # character will create RGB colours, but how to specify a CMYK colour? Some notes: The question is NOT about converting from CMYK to RGB but to use real CMYK The purpose is to allow generated XPS documents (using System.Windows.Xps.Packaging for example) see the colour as CMYK and generate colour codes as "ContextColor /swopcmykprofile.icc a,b,c,d,e" not as "#aarrggbb" I have tried to define CMYK colours

“The calling thread must be STA, because many UI components require this.” Error in WPF?

寵の児 提交于 2019-11-27 17:01:01
问题 I am creating a xps document as below. Assembly assembly = Assembly.GetExecutingAssembly(); //read embedded xpsDocument file Stream helpStream = assembly.GetManifestResourceStream(resourceNameOfContext); if (helpStream != null) { Package package = Package.Open(helpStream); string inMemoryPackageName = "memorystream://" + topicName + ".xps"; Uri packageUri = new Uri(inMemoryPackageName); //Add package to PackageStore PackageStore.AddPackage(packageUri, package); docXps = new XpsDocument

Opening XPS document in .Net causes a memory leak

倖福魔咒の 提交于 2019-11-27 15:39:01
The following code snippet illustrates a memory leak when opening XPS files. If you run it and watch the task manager, it will grow and not release memory until the app exits. '****** Console application BEGINS. Module Main Const DefaultTestFilePath As String = "D:\Test.xps" Const DefaultLoopRuns As Integer = 1000 Public Sub Main(ByVal Args As String()) Dim PathToTestXps As String = DefaultTestFilePath Dim NumberOfLoops As Integer = DefaultLoopRuns If (Args.Count >= 1) Then PathToTestXps = Args(0) If (Args.Count >= 2) Then NumberOfLoops = CInt(Args(1)) Console.Clear() Console.WriteLine("Start

How do you hide a WPF DocumentViewer's menu bars?

妖精的绣舞 提交于 2019-11-27 15:17:27
问题 At the moment I have a DocumentViewer in a WPF window that displays an XPS file. I have created my own "Next Page" and "Previous Page" buttons and have set the DocumentViewer.Background property to be completely transparent. All that is left of the DocumentViewer's own controls is the menu bar at the top (displaying zoom settings, print, etc.) and the "Find" bar at the bottom. I would quite like to remove (or hide) both of these bars, but I can't seem to figure out how!? Also, when the