How to save Pdfsharp pdfDocument to a file path

◇◆丶佛笑我妖孽 提交于 2020-02-24 11:37:13

问题


I am using the pdfsharp for my project..

I am trying to save the converted PdfDocument object to a pdf file in a specified path..

i do have this method

public static PdfDocument ConvertTiff2Pdf(string docpath)
{
var pdfDoc = Tiff2Pdf(docpath);

            return pdfDoc;

}

this will return PdfDocument and I want to save it to a "C:\temp\docname.pdf" folder..

how can do it with csharp without using the http response.. because i have to first store it on the server then use.. please help me..


回答1:


Just call the "void Save(string path)" method for your PdfDocument.

You can also save to a MemoryStream if you need both local file and http response. You can copy the stream to a local file and use stream.ToArray() for the http response.

Sample code (http response only) is here: http://www.pdfsharp.net/wiki/Clock-sample.ashx



来源:https://stackoverflow.com/questions/6194280/how-to-save-pdfsharp-pdfdocument-to-a-file-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!