You are viewing limited content. For full access, please sign in.

Question

Question

Laserfiche SDK - Resize image/Zoom to part of image

asked on March 10, 2017 Show version history

Hi all,


I'm using LF SDK to export a page of a document(tiff).  One of the images I am testing has a size of 14400x9696(this will vary).  When I export to stream and display in div it sometimes crashes Chrome(Aw Snap error).  I've been looking for a property or method to use in LF help and only see Property Attributes which allows to get/set image height & width.  PageInfo has ImageHeight & ImageWidth but only allows get.  I've tried a workaround that gets the image, then in asp .net gets thumbnail and resize to 3600x2424 just to see what happens and although it did not crash chrome I do not think this is ideal(but less than this the resolution degrades).  I need to resize the image via SDK and then zoom in on parts of the image(that are not visible) so that it is visible to the user; like in LF Client Document Viewer, you can zoom in/zoom out(icon on toolbar) on parts of the image.  I do not know if only the zoom on the toolbar in LF document viewer can be accessed.  Any ideas or suggestions?  Thanks in advance!Code:

//srvc:

Laserfiche.DocumentServices.DocumentExporter de = new Laserfiche.DocumentServices.DocumentExporter();
DocumentInfo di = Document.GetDocumentInfo(ID, repoSession);
de.PageFormat = DocumentPageFormat.Tiff;
de.ExportPages(di, new Laserfiche.RepositoryAccess.PageSet("1"), stream);

//handler:
                    byte[] byteArray = new byte[0];
                    myImg = System.Drawing.Image.FromStream(myList[ctr].myDocImg);
                    using (System.Drawing.Image resizedImg = myImg.GetThumbnailImage(3600, 2424, new System.Drawing.Image.GetThumbnailImageAbort(myCallBack), IntPtr.Zero)) //1/4 of original
                    {
                        resizedImg.Save(stream, ImageFormat.Jpeg);
                        stream.WriteTo(context.Response.OutputStream);
                        byteArray = stream.ToArray();
                        context.Response.OutputStream.Write(byteArray, 0, byteArray.Length);
                    }

 

 

0 0

Replies

replied on March 11, 2017

Are you using Laserfiche Web Client (formerly Laserfiche Web Access)? The document viewer in Web Client already supports zooming and panning.

Browsers are not designed to natively handle images of these sizes. It is the web server (or image cache server) that must do the work of cutting a large image into tiles, and the reassemble these images on the client-side (web page, using HTML and JavaScript) for viewing. This is what Laserfiche Web Client has implemented in the document image viewer.

Aside from Laserfiche Web Client, Laserfiche WebLink also uses a similar approach.

To extract (crop) parts of an image using System.Drawing.Bitmap, use Bitmap.Clone method. Link to MSDN documentation:

https://msdn.microsoft.com/en-us/library/ms141944(v=vs.110).aspx

Laserfiche SDK contains a library called Laserfiche Imaging that performs similar tasks.

If you are using SDK to

0 0
replied on March 13, 2017

Hi Ryan!

We are not using Web Access/WebLink.  We are using LF Desktop Client 9.0 and are creating a custom app to view the data.  I have used the LF CAT for a previous add-in and know that you can access the toolbar to add a custom button.  I'll review the clone method to see if this is something that I can use as a resolve for the latter of my problem and I'll get back to you.

 

Thanks.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.