groupdocs-viewer-cloud / groupdocs-viewer-cloud-java

Java SDK to communicate with GroupDocs.Viewer REST API. View or render Word, Excel, PowerPoint, CAD, Visio, PDF, OpenDocument, email & image formats.
https://products.groupdocs.cloud/viewer/java
MIT License
2 stars 3 forks source link

groupdocs API isn't working always returns API Exception #4

Closed mrcodecloud closed 3 years ago

mrcodecloud commented 3 years ago

@vladimir-litvinchik I am trying to build a sample android app for rendering the dwg files, but always getting API Exception error. Here is my sample app repo, can you please help? https://github.com/RAZA-ABBBASI/dwgviewer

Screenshot at Aug 10 18-41-31
vladimir-litvinchik commented 3 years ago

@RAZA-ABBBASI

Thank you for posting the link to your repository. I have reproduced the issue. Please try performing the following steps:

  1. In your build.gradle file change implementation 'com.groupdocs:groupdocs-viewer-cloud:21.8' to implementation 'com.groupdocs:groupdocs-viewer-cloud-android:21.8' the groupdocs-viewer-cloud-android works better with Android Apps
  2. Take three-layouts.dwf file and place it in the root of your default storage at the Dashboard
  3. Update code in the MainActivity.java and set the path to the file you want to process
    FileInfo fileInfo = new FileInfo(); 
    fileInfo.setFilePath("three-layouts.dwf");
  4. Run the app

In case you would like to upload a file from a device you'll need to upload a file to the storage first. Check this test as an example.

mrcodecloud commented 3 years ago

@vladimir-litvinchik Thank you so much for the response, I am late here but got it through a hard way that we first need the file to be tested at the storage first. Now I am looking into the file uploading part and will update you with the results. Thanks again for your prompt response.

mrcodecloud commented 3 years ago

Also I am curious, how I can use the response to view the rendered file in android?

vladimir-litvinchik commented 3 years ago

@RAZA-ABBBASI

The simplest scenario I can think of:

  1. Upload a file into storage
  2. Process it by calling createView - this method will convert the file e.g. to HTML and place the output in your storage in the viewer folder
  3. Download output page(s) using file API
  4. Render output page(s) in your Android App using the corresponding component e.g. WebView

Here is an example that includes the second and third steps.

mrcodecloud commented 3 years ago

Thanks I am looking into it now.

mrcodecloud commented 3 years ago

@vladimir-litvinchik The code snippet you shared above is for testing Test. Can you please share how I can upload file to the groupdocs cloud?

vladimir-litvinchik commented 3 years ago

@RAZA-ABBBASI

You can upload a file to storage by using FileApi like so

Configuration configuration = new Configuration("app-sid", "app-key");
FileApi fileApi = new FileApi(configuration);

File file = getFile();
fileApi.uploadFile(new UploadFileRequest(path, file, null));

Here are some tests that are using FileApi.

mrcodecloud commented 3 years ago

Not sure, why I am always getting an exception file not found I updated the repo, can you please have a look at it? MainActivity2.kt is the file we are working on now.

vladimir-litvinchik commented 3 years ago

@RAZA-ABBBASI

For the sake of simplicity, I have created a sample application https://github.com/vladimir-litvinchik/converting-file-to-html-and-downloading-output-with-cloud-sdk where you can find all the steps that have to be performed including uploading a file to storage and downloading the output.

mrcodecloud commented 3 years ago

@vladimir-litvinchik Thanks for your support. I just finished my sample app which performs the following

  1. File selection from the storage
  2. Uploading the selected file to the groupdocs storage
  3. Rendering the DWG file
  4. Downloading the output file from groupdocs storage
  5. Viewing the downloaded HTML file You can find the source code here, https://github.com/RAZA-ABBBASI/dwgviewer

It will be great help for the groupdocs android users, if you share it at groupdocs github examples page.

vladimir-litvinchik commented 3 years ago

@RAZA-ABBBASI

Great to hear that you have finished the sample app!

It will be great help for the groupdocs android users, if you share it at groupdocs github examples page.

Do you mean adding a sample Android project that uses SDK to https://github.com/groupdocs-viewer-cloud?

mrcodecloud commented 3 years ago

Yes, Please

vladimir-litvinchik commented 3 years ago

@RAZA-ABBBASI

I believe that it does make sense. We'll consider adding a sample app to the list of samples. Thank you for your suggestion!