Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, October 11, 2017 7:05:08 PM(UTC)
Lawrence Noronha

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
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Friday, October 13, 2017 10:00:45 AM(UTC)
Nick Villalobos

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.com
Nick Villalobos
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 
#3 Posted : Monday, October 23, 2017 8:09:36 AM(UTC)
Lawrence Noronha

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)
Anthony Northrup

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.

File Attachment(s):
CAS-60701-R4F2L3.zip (42kb) downloaded 300 time(s).

Edited by moderator Tuesday, November 7, 2017 4:01:23 PM(UTC)  | Reason: Not specified

Anthony Northrup
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
thanks 1 user thanked Anthony Northrup for this useful post.
Lawrence Noronha on 10/28/2017(UTC)
 
#5 Posted : Friday, October 27, 2017 10:54:39 PM(UTC)
Lawrence Noronha

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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.067 seconds.