Image Viewer with C# .NET

45 pts.
Tags:
C#
C# .NET
Image Viewer using C# .NET
Hi all! I want to make an image viewer with following functionalities without using any third party controls. 1. Load multipage tiff image in picturebox. 2. Zoom,rotate left and rotate right. 3. moving between pages, 4. delete particular page 5. grayscal image and image cropping and convert tiff image into pdf. please help me and send me some useful code for this in c# .net .
ASKED: May 1, 2009  6:04 AM
UPDATED: January 13, 2014  3:39 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

Here are the code I have ever used to build web image viewers in c# .net:

using System.IO;
using System.Drawing.Printing;
using YiigoImage.Imaging;
using System.Web;
using YiigoImage.Imaging.WebControl;

// Add Open button to viewer
private void Open_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
{
WebViewer.Load(new FileSystemImageSource(new string[] {
openFileDialog1.FileName }, true), null);
}
}

// Add Zoom and Scale button to viewer
private void FitToWidth_Click(object sender, EventArgs e)
{
WebViewer.ImageControl.AutoZoom =
YiigoImage.Imaging.WebControl.AutoZoomMode.FitToWidth;
}
private void FitToHeight_Click(object sender, EventArgs e)
{
WebViewer.ImageControl.AutoZoom =
YiigoImage.Imaging.WebControl.AutoZoomMode.FitToHeight;
}
private void FullSize_Click(object sender, EventArgs e)
{
WebViewer.ImageControl.AutoZoom =
YiigoImage.Imaging.WebsControl.AutoZoomMode.None;
WebViewer.ImageControl.Zoom = 1.0;
}

// Add Scan button to viewer
private void acquisition1_ImageAcquired(object sender, AcquireEventArgs e)
{
WebViewer.Add(YiigoImage.FromBitmap(e.Image), "", "");
}
private void Scan_Click(object sender, EventArgs e)
{
foreach (Device dev in acquisition1.Devices)
{
if (dev.Identity.ProductName ==
tcbChooseScanner.SelectedItem.ToString())
{
dev.Acquire();
}
}
}

// Add Save button to viewer
private void Save_Click(object sender, EventArgs e)
{
if (saveFileDialog1.ShowDialog(this) == DialogResult.OK)
{
WebViewer.Save(saveFileDialog1.FileName, new TiffEncoder());
}
}

// Add a handler for the viewer
public class WebViewerHandler : WebViewerRequestHandler
{
}
//Add a new Web Form to your project and add HTML in your document's head;
<script src="WebViewer/jquery-1.6.1.min.js" type="text/javascript"></script>
<script src="WebViewer/jquery.easing.1.3.js" type="text/javascript"></script>
<script src="WebViewer/jquery-ui-1.8.14.custom.min.js" type="text/javascript">
</script>
<script src="WebViewer/atalaWebDocumentViewer.js" type="text/javascript">
</script>
<link href="WebViewer/atalaWebDocumentViewer.css" rel="Stylesheet" type="text/css" />

// Add HTML in your document's body;
<div id="_toolbar1" class="atala-document-toolbar" style="width: 670px;"></div>
<div id="_container1" class="atala-document-container" style="width: 670px;height: 500px;"></div>

// Add JavaScript code for initializing your viewer 
<script type="text/javascript" language="javascript">
var _docUrl = 'Yiigo_example.tif';
var _serverUrl = 'WebViewer.ashx';
var _viewer = new Atalasoft.Controls.WebDocumentViewer({
'parent': $('#_container1'), 'toolbarparent': $('#_toolbar1'), 'serverurl': _serverUrl, 'documenturl': _docUrl });
</script>

I hope it helps. Good luck.

Best regrads,
Arron

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Vikram99
    I need to see the answer
    10 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following