Note that there are some explanatory texts on larger screens.

plurals
  1. POscan & save as PDF in c#
    primarykey
    data
    text
    <p>IM using the TWAIN Scanner &amp; gdiplus.dll.</p> <p>i scanned the file , and can save as image format like *.jpg, *.bmp</p> <p>but it is not allow to save as in PDF format. Showing an error unknown format picture.</p> <p>this is the code,</p> <hr> <p>public static bool SaveDIBAs(string picname, IntPtr bminfo, IntPtr pixdat) {</p> <pre><code> SaveFileDialog sd = new SaveFileDialog(); sd.FileName = picname; sd.Title = "Save bitmap as..."; sd.Filter = "PDF (*.pdf)|*.pdf"; sd.Filter = "Bitmap file (*.bmp)|*.bmp|TIFF file (*.tif)|*.tif|JPEG file (*.jpg)|*.jpg|PNG file (*.png)|*.png|PDF file (*.pdf)|*.pdf|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; } [DllImport("gdiplus.dll", ExactSpelling=true)] internal static extern int GdipCreateBitmapFromGdiDib( IntPtr bminfo, IntPtr pixdat, ref IntPtr image ); [DllImport("gdiplus.dll", ExactSpelling=true, CharSet=CharSet.Unicode)] internal static extern int GdipSaveImageToFile( IntPtr image, string filename, [In] ref Guid clsid, IntPtr encparams ); [DllImport("gdiplus.dll", ExactSpelling=true)] internal static extern int GdipDisposeImage( IntPtr image ); } </code></pre> <hr> <pre><code> ****The above code doesnt allow to save as in PDF format.**** </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload