#1
Posted
:
Wednesday, October 11, 2017 7:05:08 PM(UTC)
Groups: Registered
Posts: 7
Thanks: 3 times
I am using web side of Lead Tools V 19 with HTML and JS. I am looking for a way to save content from imageviewer which has been scanned. Is there are way to say the content directly using Raster?
Any help is highly appreciated.
Thanks,
Lawrence
#2
Posted
:
Friday, October 13, 2017 10:00:45 AM(UTC)
Groups: Registered
Posts: 119
Was thanked: 4 time(s) in 4 post(s)
Hello Lawrence,
I see that you also came in to our live chat sessions that we provide and spoke with my colleague Walter regarding this same issue. Unfortunately this is not a way in which the browser can interact with disk because of security reasons. As he did mention, if you are wanting to save the file scanned in as a RasteImage you could do a simple Right-Click / Save As on the image within the ImageViewer.
The other option to accomplishing this would be to have a service set up in which you can send the image scanned in and save it locally using our RasterCodecs.Save() Method. As Walter also mentioned, this can be done in the RasterController.cs which can be found in the BasicDemos.sln in our JavaScript examples folder.
If you have any other questions regarding, feel free to hop back into our live chat or you can always email us at
support@leadtools.comNick Villalobos
Developer Support Engineer
LEAD Technologies, Inc.
#3
Posted
:
Monday, October 23, 2017 8:09:36 AM(UTC)
Groups: Registered
Posts: 7
Thanks: 3 times
Code:] private saveImageBtn_Click(e: JQueryEventObject): void {
var param: any = new Object();
param.filename = "C:/kapil.pdf"; // Get from dialog
param.format = "146"; // Get from dialog
$.get(this._scanningService.runCommand("SaveToLocal", param, null));
}
private void SaveToLocal(SaveToLocalParams saveParams)
{
try
{
RasterImage page = null;
RasterCodecs codecs = new RasterCodecs();
// Check to see how many pages have been scanned
TwainStatus status = this.ScanningService.GetStatus(saveParams.Id, saveParams.UserData);
for (int pageNumber =1; pageNumber <= status.PagesCount; pageNumber++)
{
// Save the page by appending it to the end of the file
page = this.ScanningService.GetImage(saveParams.Id, pageNumber);
if (page != null)
{
Console.WriteLine("Saving codec");
//codecs.Save(page, saveParams.FileName, saveParams.Format, 0, 1, 1, -1, CodecsSavePageMode.Append);
codecs.Save(page, saveParams.FileName, RasterImageFormat.PdfLeadMrc, 0,1,-1,-1,CodecsSavePageMode.Append);
}
}
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
I am using the above code for saving. Is this correct way or is this another option?
The code does not add when there multiple files.. Is there something missing?
#4
Posted
:
Friday, October 27, 2017 8:53:12 AM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 199
Was thanked: 28 time(s) in 28 post(s)
Hello Lawrence,
In order to get saving to work, your client-side code looks great, but there is some extra server-side coding needed. The actual scanning service source code can be found at “C:\LEADTOOLS 19\Examples\DotNet\CS\Leadtools.WebScanning.Host”. In order to add a function to be called via the client-side runCommand function, you need to locate the “CommandCallBack” function in the ServiceHost.cs file in the project I linked to. Here is how I modified your code to get saving to work (see Screenshot_1.png). Then I made a private function just below that “CommandCallBack” function called “SaveToLocal”. I mostly kept the code you had, but the parts I changed are highlighted (see Screenshot_2.png). The most important change was the format you are saving to, from my testing the PdfLeadMrc format doesn’t appear to support multiple pages. I recommend using either RasPdfG4 (CCITT Group 4 compression is best for 1 BPP) or RasPdfJpeg411 (Jpeg 4.1.1 compression, one of the best 24bit color compressions), you can see other supported formats here. Once you get those changes made, you can build and run the project, then switch back to your JS project and view it in a web browser.
Edited by moderator Tuesday, November 7, 2017 4:01:23 PM(UTC)
| Reason: Not specified
Anthony Northrup
Developer Support Engineer
LEAD Technologies, Inc.
1 user thanked Anthony Northrup for this useful post.
#5
Posted
:
Friday, October 27, 2017 10:54:39 PM(UTC)
Groups: Registered
Posts: 7
Thanks: 3 times
Thanks Mate... I figured it out...
Thanks for the Help.
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.