如何在SaveFileDialog中保存pdf formet? [英] How to save pdf formet in SaveFileDialog?
本文介绍了如何在SaveFileDialog中保存pdf formet?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在SaveFileDialog中保存图像和pdf formet?
how to save image and pdf formet in SaveFileDialog?
public static bool SaveDIBAs( string picname, IntPtr bminfo, IntPtr pixdat )
{
SaveFileDialog sd = new SaveFileDialog();
sd.FileName = picname;
sd.Title = "Save bitmap as...";
sd.Filter = "Bitmap file (*.bmp)|*.bmp|TIFF file (*.tif)|*.tif|JPEG file (*.jpg)|*.jpg|PNG file (*.png)|*.png|GIF file (*.gif)|*.gif|All files (*.*)|*.*";
sd.FilterIndex = 1;
if( sd.ShowDialog() != DialogResult.OK )
return false;
Guid clsid;
if( ! GetCodecClsid( sd.FileName, out clsid ) )
{
MessageBox.Show( "Unknown picture format for extension " + Path.GetExtension( sd.FileName ),
"Image Codec", MessageBoxButtons.OK, MessageBoxIcon.Information );
return false;
}
IntPtr img = IntPtr.Zero;
int st = GdipCreateBitmapFromGdiDib( bminfo, pixdat, ref img );
if( (st != 0) || (img == IntPtr.Zero) )
return false;
st = GdipSaveImageToFile( img, sd.FileName, ref clsid, IntPtr.Zero );
GdipDisposeImage( img );
return st == 0;
}
推荐答案
你可以使用iTextsharp。参见这里的示例表格..
http://www.c-sharpcorner .com / uploadfile / c8b468 / save-pdf-and-ms-word-file-in-C-Sharp / [ ^ ]
另见..
http://stackoverflow.com/questions/ 12153969 / save-as-pdf-file-button-c-sharp [ ^ ]
You can use iTextsharp for that.See example form here..
http://www.c-sharpcorner.com/uploadfile/c8b468/save-pdf-and-ms-word-file-in-C-Sharp/[^]
Also see..
http://stackoverflow.com/questions/12153969/save-as-pdf-file-button-c-sharp[^]
这篇关于如何在SaveFileDialog中保存pdf formet?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文