内存不足,无法继续执行程序。将流文档转换为PDF(长时间运行的应用程序)时 [英] Insufficient memory to continue the execution of the program. when converting flow document to PDF ( long running application )

查看:436
本文介绍了内存不足,无法继续执行程序。将流文档转换为PDF(长时间运行的应用程序)时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨专家,


     我有一个很长的打印应用程序。完成该过程需要一天以上的时间。它正在将水晶报告转换为pdf并将文档转换为pdf 最后一个pdf将返回。这是工作流程。要将
流量文档转换为pdf,我将转换为固定文档,然后转换为 图像然后到pdf。但是有一段时间我得到的内存不足以在转换为固定文档时继续执行程序异常。



 我正在使用的代码是



    Fl

    var   paginator  = (( IDocumentPaginatorSource )idbSource).DocumentPaginator; 
             var   package  =  System.IO.Packaging。 Package .Open( new   MemoryStream (),  FileMode .Create,  FileAccess .ReadWrite);
            的 VAR   packUri  =  new   Uri " pack:/ /temp.xps" );
            的 PackageStore .RemovePackage(packUri);
            的 PackageStore .AddPackage(packUri,&NBSP ;包);
             var   xps  =  new   XpsDocument (包,  CompressionOption .NotCompressed,  packUri.ToString());
            的 XpsDocument .CreateXpsDocumentWriter(XPS)。写(分页程序);
            的固定文档  DOC1  =&NBSP ; xps.GetFixedDocumentSequence()。引用[0] .GetDocument( true );

    



如果有人可以帮助我,我们非常感谢。 


解决方案

您好Vishnu,


关于将流程文档转换为pdf,有人说您可以使用第三方工具执行此操作,请查看以下主题:


https://stackoverflow.com/questions/9182137/whats-the-best-way-to-convert-a-flowdocument-into-pdf


Github中有样本,你也可以看看:


https://github.com/neurospeech/xaml-to-pdf/blob/master/NeuroSpeech.XamlToPDF/Xaml/FlowDocumentConverter.cs




最好的问候,


Cherry


Hi Experts ,

      I have a long printing application . It takes more than one day to complete the process . It is converting crystal reports to pdf and flow documents to pdf  and at last a single pdf will return . This is the work flow. For converting flow document to pdf i am converting to fixed document then to  image and then to pdf . But some time i am getting Insufficient memory to continue the execution of the program exception when converting to fixed document .

  Code i am using is

    Fl

  var paginator = ((IDocumentPaginatorSource)idbSource).DocumentPaginator;
            var package = System.IO.Packaging.Package.Open(new MemoryStream(), FileMode.Create, FileAccess.ReadWrite);
            var packUri = new Uri("pack://temp.xps");
            PackageStore.RemovePackage(packUri);
            PackageStore.AddPackage(packUri, package);
            var xps = new XpsDocument(package, CompressionOption.NotCompressed, packUri.ToString());
            XpsDocument.CreateXpsDocumentWriter(xps).Write(paginator);
            FixedDocument doc1 = xps.GetFixedDocumentSequence().References[0].GetDocument(true);

    

If any one can help me in this it is highly appreciated. 

解决方案

Hi Vishnu,

About converting flow document to pdf, someone said that you can do this using Third party tool, please look the following thread:

https://stackoverflow.com/questions/9182137/whats-the-best-way-to-convert-a-flowdocument-into-pdf

And there are sample in Github, you can also take a look:

https://github.com/neurospeech/xaml-to-pdf/blob/master/NeuroSpeech.XamlToPDF/Xaml/FlowDocumentConverter.cs

Best Regards,

Cherry


这篇关于内存不足,无法继续执行程序。将流文档转换为PDF(长时间运行的应用程序)时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆