iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hi Guys,Does ReportingService support viewing of PDF from file? Say we download a binary (byte[]) and save it as PDF in a local or temporary folder using LocalStorageService. Can we load it up to be viewed by the user using ReportingService?Please advise. Many thanks!
Hello,I got news from the developer team regarding this scenario.The developer team has provided the feature to get / download the PDF file from local machine.I will try to show you the (example) step by step to implement / use this new feature.In this example, I will try to modify the Reporting Samples for Android. You also can get the Reporting Samples from this link.I have attached the Crosslight nightly build that contain this new feature.Before we start to implement the feature, we should update the Crosslight assembly first.After I update the Crosslight assembly, I prepare the PDF file that to be loaded.I add the PDF file under ‘ReportingSamples.Android’ project, in ‘Resources -> raw’ folder.The next step is I modified the content of ‘AppInitializer.cs’ file in ‘Infrastructure’ folder.Here’s the line that I changed:
From:public void InitializeServices(IApplicationHost appHost){ ServiceProvider.AddService<IReportingService, ReportingService>();} To: public void InitializeServices(IApplicationHost appHost) { ServiceProvider.AddService<IReportingService, LocalReportingService>(); }
The last step is I added new file, named ‘LocalReportingService.cs’, under ‘Services’ folder.Here’s the content of the ‘LocalReportingService.cs’:
public class LocalReportingService : ReportingService { public override void ExecuteLoadReportAsync(IReportViewModel reportViewModel, Action<byte[]> onSuccess, Action<Exception> onFail = null) { // You could create your own code to load the PDF file in this function try { Resources resources = Application.Context.Resources; // To get the PDF File Stream stream = resources.OpenRawResource(Resource.Raw.Example); byte[] bytes = GetBytes(stream); onSuccess.Invoke(bytes); } catch (Exception e) { onFail.Invoke(e); } } public static byte[] GetBytes(Stream input) { byte[] buffer = new byte[16 * 1024]; using (MemoryStream ms = new MemoryStream()) { int read; while ((read = input.Read(buffer, 0, buffer.Length)) > 0) { ms.Write(buffer, 0, read); } return ms.ToArray(); } } }
I attached the modified page as well.Hope this helps.NB: Please note that nightly build (pre-release version of hotfix) is not tested for regression. We hope you can collaborate and test it in your project.Regards,Hans K.
Hello,Currently, Crosslight hasn’t provide the feature to download a binary (byte[]) / PDF from local storage.However, you could download the binary (byte[]) from the report server.For further information regarding Crosslight reporting service, you could see in this Intersoft’s article below:http://intersoftpt.wordpress.com/2014/06/18/video-tutorial-getting-started-with-crosslight-reporting-service/Hope this helps.Regards,Hans K.
Hey Hans,Thanks for the feedback. We apologize if we were not clear; however, we'd like to know if any service in Crosslight has a component (e.g. ReportingService) that allows an app to view PDF files from a cache or temporary folder on the device. That is to say, the PDF file has already been downloaded from a server. In general, PDF files can be downloaded from any web service, regardless if it's a Reporting Service from Crosslight or not (e.g. it could be SSRS). The question is... how can we let the user view the downloaded PDF file using Crosslight? Is this something that is already supported by using ReportViewModelBase, considering the View used by Crosslight to display the report is a WebView component?As a workaround, we could actually create a custom xib file for iOS or custom axml for Android, etc. and use a WebView control or the like. With that, we could specify the location of the downloaded PDF file, a local Uri to be specific. But if this approach can be implemented with existing Crosslight services or components, then we will be very glad to know how. That is our hope for opening this thread.Please advise. Thanks!
Hello,
I have forwarded this scenario to the developer team.They will consider this as a feature request.
I will let you know about the update regarding this scenario.
Thank you very much.
Regards,Hans K.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname