xpsdocument

XpsDocument GetFixedDocumentSequence return null for files generated by a specific computer

牧云@^-^@ 提交于 2019-12-10 18:53:31
问题 Solidworks generate "EDRWX" files. Usually, those are opened with Microsoft XPS viewer. Issue : An application use .net XPSDocument to open them and do some manipulation with them before printing. The faulting method is "GetFixedDocumentSequence". It returns null with files generate from a specific computer. It does so even when the application is running on the specific computer. But it is working fine with file generated by other computer. When trying to open the file with XPS document

creating an XPS Document from a FlowDocument and attach it on the fly

梦想与她 提交于 2019-12-09 17:17:46
问题 I have a FlowDocument that I want to convert to an XPS Document and attach it to an e-mail and send it all together. I'm using this code public static MemoryStream FlowDocumentToXPS(FlowDocument flowDocument, int width, int height) { MemoryStream stream = new MemoryStream(); using (Package package = Package.Open(stream, FileMode.Create, FileAccess.ReadWrite)) { using (XpsDocument xpsDoc = new XpsDocument(package, CompressionOption.Maximum)) { XpsSerializationManager rsm = new

How do I get WPF's DocumentViewer to release its file lock on the source XPS Document?

丶灬走出姿态 提交于 2019-12-04 19:02:19
问题 After showing an XPS file in the WPF DocumentViewer, and closing the DocumentViewer instance, the XPS file is locked and I cannot delete it. I need to release the lock on the XPS file so I can delete it, write another one with the same name, and optionally display that new XPS file in a new DocumentViewer instance. I need to do this in the same app instance - without having to close the app (this is a Print Preview scenario). In other words, how would I get the following code to run without

creating an XPS Document from a FlowDocument and attach it on the fly

若如初见. 提交于 2019-12-04 04:30:17
I have a FlowDocument that I want to convert to an XPS Document and attach it to an e-mail and send it all together. I'm using this code public static MemoryStream FlowDocumentToXPS(FlowDocument flowDocument, int width, int height) { MemoryStream stream = new MemoryStream(); using (Package package = Package.Open(stream, FileMode.Create, FileAccess.ReadWrite)) { using (XpsDocument xpsDoc = new XpsDocument(package, CompressionOption.Maximum)) { XpsSerializationManager rsm = new XpsSerializationManager(new XpsPackagingPolicy(xpsDoc), false); DocumentPaginator paginator = (

Saving a FixedDocument to an XPS file causes memory leak

爷,独闯天下 提交于 2019-12-03 17:19:55
问题 I have created a .NET Windows Service which performs certain actions and generates reports. These reports are XPS documents which I save in a certain directory. Being familiar with WPF, the way I have chosen to create the reports is to instantiate a System.Windows.Documents.FixedDocument , adding FixedPage objects with content as required. My problem is that the Service memory usage goes up and up and up over time as it runs. At first, I went through my code rigorously, ensuring all

How do I get WPF's DocumentViewer to release its file lock on the source XPS Document?

我是研究僧i 提交于 2019-12-03 12:40:49
After showing an XPS file in the WPF DocumentViewer, and closing the DocumentViewer instance, the XPS file is locked and I cannot delete it. I need to release the lock on the XPS file so I can delete it, write another one with the same name, and optionally display that new XPS file in a new DocumentViewer instance. I need to do this in the same app instance - without having to close the app (this is a Print Preview scenario). In other words, how would I get the following code to run without throwing an exception at the "File.Delete(tempXpsFile);" statement? var tempXpsFile = @"c:\path\to

Saving a FixedDocument to an XPS file causes memory leak

强颜欢笑 提交于 2019-12-03 06:20:47
I have created a .NET Windows Service which performs certain actions and generates reports. These reports are XPS documents which I save in a certain directory. Being familiar with WPF, the way I have chosen to create the reports is to instantiate a System.Windows.Documents.FixedDocument , adding FixedPage objects with content as required. My problem is that the Service memory usage goes up and up and up over time as it runs. At first, I went through my code rigorously, ensuring all disposable objects were disposed, etc, and other obvious memory leak candidates, but still had the problem. I

Blank pages when implementing DocumentPaginator

那年仲夏 提交于 2019-12-02 09:49:45
I'm trying to implement a Paginator like this: public class MyPaginator : DocumentPaginator{ // ommitting details... public override DocumentPage GetPage(int pageNumber) { DocumentPage page = new DocumentPage(canvas); return page; } } It compiles, it runs, but the page is blank (white). the 'canvas' is an instance of System.Windows.Controls.Canvas. When I put it in a on-screen container like ScrollViewer it renders perfectly. XpsDocument _xpsDocument = CreateXpsDoc(myPaginatorInstance); The only thing that is working is that the page's size is set to the size of the canvas. What am I missing?

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

Printing BlockUIContainer to XpsDocument/FixedDocument

无人久伴 提交于 2019-11-28 20:54:17
Question How do you print a FlowDocument that have BlockUIContainer ? How can I force a Measure/Update/Arrange on a FlowDocument? Background I have a generated FlowDocument with paragraphs of text with a few Rectangle elements filled DrawingBrushes from a resource dictionary and BlockUIContainer with custom controls. The document renders correctly when viewed in any of the FlowDocument* controls HOWEVER when the document is converted to a FixedDocument/XpsDocument, none of the Rectangle or BlockUIContainer elements render. I'm almost certain it is because the control has not been measured