我正在尝试将我的位图保存为.pdf文件。它不起作用。我没有收到错误,但它没有打开保存.pdf文件的对话框。
下面是我的代码:
PdfDocument doc = new PdfDocument();
for (int iCnt = 0; iCnt < nPaginasPDF; iCnt++)
{
doc.Pages.Add(new PdfPage());
XGraphics xgr = XGraphics.FromPdfPage(doc.Pages[iCnt]);
XImage img = XImage.FromFile("C:\\" + (iCnt+1) + ".bmp"); (In this directory have these image files)
xgr.DrawImage(img, panel1.ClientRectangle);
}
using (var Stream = saveFileDialog1.OpenFile())
{
doc.Save(Stream);
}
doc.Close();发布于 2013-03-01 20:50:22
SaveFileDialog的OpenFile方法打开由具有读/写权限的SaveFileDialog.Filename属性文件返回的文件。
要在保存前选择文件,必须先使用ShowDialog方法。您是否调试并检查过带断点的Stream的值?
https://stackoverflow.com/questions/15158107
复制相似问题