(function ($) {
// jQuery plugin to prevent double submission of forms
$.fn.preventDoubleSubmission = function () {
$(this).on('submit', function (e) {
var $form = $(this);
if ($form.data('submitted') === true) {
// Previously submitted - don't submit again
e.preventDefault();
} else {
// Mark it so that the next submit can be ignored
$form.data('submitted', true);
}
});
// Keep chainability
return this;
};
})(jQuery);
$("form").preventDoubleSubmission();
2015年5月13日 星期三
2015年5月12日 星期二
tiff 兩頁切割法 (適用任何需要合併的寫法)
var fd = new FrameDimension(image.FrameDimensionsList[0]);
for (int i = 2; i < image.GetFrameCount(fd); i+=2)
{
using (MemoryStream oMemoryStream = new MemoryStream())
using (MemoryStream oMemoryStream2 = new MemoryStream())
{
image.SelectActiveFrame(fd, i);
image.Save(oMemoryStream, ImageFormat.Tiff);
System.Drawing.Image tiff = System.Drawing.Image.FromStream(oMemoryStream);
Encoder encoder = Encoder.SaveFlag;
ImageCodecInfo encoderInfo = ImageCodecInfo.GetImageEncoders().First(a => a.MimeType == "image/tiff");
EncoderParameters encoderParameters = new EncoderParameters(1);
encoderParameters.Param[0] = new EncoderParameter(encoder, (long)EncoderValue.MultiFrame);
tiff.Save(oMemoryStream2, encoderInfo, encoderParameters);
encoderParameters.Param[0] = new EncoderParameter(encoder, (long)EncoderValue.FrameDimensionPage);
image.SelectActiveFrame(fd, i+1);
image.Save(oMemoryStream, ImageFormat.Tiff);
System.Drawing.Image tiff2 = System.Drawing.Image.FromStream(oMemoryStream);
tiff.SaveAdd(tiff2, encoderParameters);
encoderParameters.Param[0] = new EncoderParameter(encoder, (long)EncoderValue.Flush);
tiff.SaveAdd(encoderParameters); // 此時 oMemoryStream2 即為合併的圖檔
}
}
for (int i = 2; i < image.GetFrameCount(fd); i+=2)
{
using (MemoryStream oMemoryStream = new MemoryStream())
using (MemoryStream oMemoryStream2 = new MemoryStream())
{
image.SelectActiveFrame(fd, i);
image.Save(oMemoryStream, ImageFormat.Tiff);
System.Drawing.Image tiff = System.Drawing.Image.FromStream(oMemoryStream);
Encoder encoder = Encoder.SaveFlag;
ImageCodecInfo encoderInfo = ImageCodecInfo.GetImageEncoders().First(a => a.MimeType == "image/tiff");
EncoderParameters encoderParameters = new EncoderParameters(1);
encoderParameters.Param[0] = new EncoderParameter(encoder, (long)EncoderValue.MultiFrame);
tiff.Save(oMemoryStream2, encoderInfo, encoderParameters);
encoderParameters.Param[0] = new EncoderParameter(encoder, (long)EncoderValue.FrameDimensionPage);
image.SelectActiveFrame(fd, i+1);
image.Save(oMemoryStream, ImageFormat.Tiff);
System.Drawing.Image tiff2 = System.Drawing.Image.FromStream(oMemoryStream);
tiff.SaveAdd(tiff2, encoderParameters);
encoderParameters.Param[0] = new EncoderParameter(encoder, (long)EncoderValue.Flush);
tiff.SaveAdd(encoderParameters); // 此時 oMemoryStream2 即為合併的圖檔
}
}
訂閱:
文章 (Atom)
input 連結 datalist 用程式控制彈出選項
範例: nextTick(() => document.querySelector('input').showPicker()); ※僅支援現代瀏覽器
-
1. 設定檔案下載儲存位置為 C:\Users\%username%\AppData\Local\Google\Chrome\User Data\Default\Cache 2. 勾選"下載每個檔案前詢問儲存位置" 3. 針對不要下載的檔案類型於第一...
-
自動設定欄寬 sheet.Cells.AutoFitColumns(3, 20); // 必須設定 min 跟 max 才會正常作用 凍結欄位 sheet.View.FreezePanes(4, 4); 標題列 ws.PrinterSettings.RepeatRo...
-
使用 FreeSpire.XLS ... ep.Save(); using (var workbook = new Workbook()) using (var memStream = new MemoryStream()) { workbook.LoadFromSt...