Image Cleanup using JavaScript
Image Cleanup using JavaScript
Hi team,
Hope you all are doing good. There is project "asp.net-mvc_razor_app" in your Sample DocuVieware in which I see image Clean and libraries that were using in it was DeleteBlackBorders, AutoDeskew, RemoveHolePunch and many other by the help of GdPictureImaging.
How can I use this at Client Side in JavaScript using DocuViewareAPI or something like that.
Hope you all are doing good. There is project "asp.net-mvc_razor_app" in your Sample DocuVieware in which I see image Clean and libraries that were using in it was DeleteBlackBorders, AutoDeskew, RemoveHolePunch and many other by the help of GdPictureImaging.
How can I use this at Client Side in JavaScript using DocuViewareAPI or something like that.
Re: Image Cleanup using JavaScript
Hello,
You will need to use the same logic as the razor sample:
- Implement custom buttons in the client
- These buttons call a PostCustomServerAction to ask the server to launch a method
- In your Global.asax.cs you will need to get the actionName parameter of the PostCustomServerAction
- Depending on the actionName you will need to launch the associated method
And in the method, you will need to get the client's loaded document, apply the modification on it, and load it back to the client.
Here are the needed methods:
Create a custom button: https://www.docuvieware.com/guides/aspn ... utton.html
Create a custom snap-in: https://www.docuvieware.com/guides/aspn ... napIn.html
PostCustomServerAction: https://www.docuvieware.com/guides/aspn ... ction.html
Get the loaded PDF server-side: https://www.docuvieware.com/guides/aspn ... vePDF.html
Get the loaded image server-side: https://www.docuvieware.com/guides/aspn ... Image.html
All the image modifications documentation: https://www.gdpicture.com/guides/gdpict ... ments.html
Load your modified image on the viewer: https://www.docuvieware.com/guides/aspn ... Image.html
Load your modified PDF on the viewer: https://www.docuvieware.com/guides/aspn ... rePdf.html
If you need any help, let me know.
With best,
Fabio
You will need to use the same logic as the razor sample:
- Implement custom buttons in the client
- These buttons call a PostCustomServerAction to ask the server to launch a method
- In your Global.asax.cs you will need to get the actionName parameter of the PostCustomServerAction
- Depending on the actionName you will need to launch the associated method
And in the method, you will need to get the client's loaded document, apply the modification on it, and load it back to the client.
Here are the needed methods:
Create a custom button: https://www.docuvieware.com/guides/aspn ... utton.html
Create a custom snap-in: https://www.docuvieware.com/guides/aspn ... napIn.html
PostCustomServerAction: https://www.docuvieware.com/guides/aspn ... ction.html
Get the loaded PDF server-side: https://www.docuvieware.com/guides/aspn ... vePDF.html
Get the loaded image server-side: https://www.docuvieware.com/guides/aspn ... Image.html
All the image modifications documentation: https://www.gdpicture.com/guides/gdpict ... ments.html
Load your modified image on the viewer: https://www.docuvieware.com/guides/aspn ... Image.html
Load your modified PDF on the viewer: https://www.docuvieware.com/guides/aspn ... rePdf.html
If you need any help, let me know.
With best,
Fabio
Re: Image Cleanup using JavaScript
Hi Fabio,
I am facing problem during PostCustomServerAction call to server. At FrontEnd, I clicked on Twain Acquisition button(at toolbar) and then click on acquire button. Until now everything works perfect. Now, when I click on my custom button which calls PostCustomServerAction and when it comes to server side, I am unable to read multiple pages that were scanned. I am only able to read one image.
How can I read all pages at once?
I am facing problem during PostCustomServerAction call to server. At FrontEnd, I clicked on Twain Acquisition button(at toolbar) and then click on acquire button. Until now everything works perfect. Now, when I click on my custom button which calls PostCustomServerAction and when it comes to server side, I am unable to read multiple pages that were scanned. I am only able to read one image.
How can I read all pages at once?
Re: Image Cleanup using JavaScript
Hello,
That is because the Image ID relates to only one image/page. If you want to apply a modification on your multipage image, you need to loop on every page and apply the modification.
With best,
Fabio
That is because the Image ID relates to only one image/page. If you want to apply a modification on your multipage image, you need to loop on every page and apply the modification.
With best,
Fabio
Re: Image Cleanup using JavaScript
Hi,
So, If I want to save that tiff image (all pages) to my local path then which method needs to be called?
So, If I want to save that tiff image (all pages) to my local path then which method needs to be called?
Re: Image Cleanup using JavaScript
Hi,
You can directly call the js dedicated Save method: https://www.docuvieware.com/guides/aspnet/Save.html
You can also call the server method to save it as a Tiff: https://www.docuvieware.com/guides/aspn ... sTIFF.html
With best,
Fabio
You can directly call the js dedicated Save method: https://www.docuvieware.com/guides/aspnet/Save.html
You can also call the server method to save it as a Tiff: https://www.docuvieware.com/guides/aspn ... sTIFF.html
With best,
Fabio
Re: Image Cleanup using JavaScript
Hi again,
I developed an example of a simple method to let you check the image mechanism:
With best,
Fabio
I developed an example of a simple method to let you check the image mechanism:
Code: Select all
int pagesNb = e.docuVieware.PageCount;
int pageToProcess = 1;
GdPictureStatus status = e.docuVieware.GetNativePDF(out GdPicturePDF gdpicturePDF);
if (status != GdPictureStatus.OK)
{
throw new Exception("Unable to obtain native PDF. Status: " + status.ToString());
}
while (pageToProcess <= pagesNb)
{
status = gdpicturePDF.SelectPage(pageToProcess);
if (status == GdPictureStatus.OK)
{
int pageImageId = gdpicturePDF.ExtractPageImage(1);
status = gdpicturePDF.GetStat();
if (status == GdPictureStatus.OK)
{
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
status = gdpictureImaging.FxNegative(pageImageId);
if (status == GdPictureStatus.OK)
{
string imageResName = gdpicturePDF.GetPageImageResName(0);
status = gdpicturePDF.ReplaceImage(imageResName, pageImageId, false);
}
GdPictureDocumentUtilities.DisposeImage(pageImageId);
}
}
else
throw new Exception("Unable to process the PDF page. Status: " + status.ToString());
}
e.docuVieware.RedrawPages(new int[] { pageToProcess });
pageToProcess++;
}
Fabio
Re: Image Cleanup using JavaScript
Thanks for your response. It helps me alot
Who is online
Users browsing this forum: No registered users and 1 guest