@@ -368,24 +368,196 @@ The API is completely independent of your operating system, database system or d
368368
369369{{< tabs "example1-sdk">}}
370370{{< tab "C#" >}}
371- {{< gist groupdocscloud caf8bcd223759d65afaa07436f251820 Viewer_CSharp_Get_Supported_Formats.cs >}}
371+
372+ ``` csharp
373+ using GroupDocs .Viewer .Cloud .Sdk .Api ;
374+ using GroupDocs .Viewer .Cloud .Sdk .Client ;
375+ using System ;
376+
377+ namespace GroupDocs .Viewer .Cloud .Examples .CSharp
378+ {
379+ // Get All Supported Formats
380+ class Get_All_Supported_Formats
381+ {
382+ public static void Run ()
383+ {
384+ var configuration = new Configuration (Common .MyAppSid , Common .MyAppKey );
385+
386+ var apiInstance = new InfoApi (configuration );
387+
388+ try
389+ {
390+ // Get supported file formats
391+ var response = apiInstance .GetSupportedFileFormats ();
392+
393+ foreach (var entry in response .Formats )
394+ {
395+ Console .WriteLine (string .Format (" {0}: {1}" , entry .FileFormat , string .Join (" ," , entry .Extension )));
396+ }
397+ }
398+ catch (Exception e )
399+ {
400+ Console .WriteLine (" Exception while calling InfoApi: " + e .Message );
401+ }
402+ }
403+ }
404+ }
405+ ```
406+
372407{{< /tab >}}
373- {{< tab "PHP">}}
374- {{< gist groupdocscloud 59f66e2a32e4f47157573d93b6c824cd Viewer_PHP_Get_All_File_Formats.php >}}
408+ {{< tab "PHP" >}}
409+
410+ ``` php
411+ //TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
412+ $configuration = new GroupDocs\Viewer\Configuration();
413+ $configuration->setAppSid($sid);
414+ $configuration->setAppKey($key);
415+
416+ $viewerApi = new GroupDocs\Viewer\ViewerApi($configuration);
417+
418+ try {
419+ $request = new GroupDocs\Viewer\Model\Requests\GetSupportedFileFormatsRequest();
420+ $response = $viewerApi->getSupportedFileFormats($request);
421+
422+ foreach ($response->getFormats() as $key => $format) {
423+ echo $format->getFileFormat() . " - " . $format->getExtension(), "\n";
424+ }
425+ } catch (Exception $e) {
426+ echo "Something went wrong: ", $e->getMessage(), "\n";
427+ }
428+
429+ ```
430+
375431{{< /tab >}}
376- {{< tab "Java">}}
377- {{< gist groupdocscloud e86f05aeed57101c77e399f1c80b99b5 Viewer_Java_Get_All_Supported_Formats.java >}}
432+ {{< tab "Java" >}}
433+
434+ ``` java
435+
436+ // TODO: Get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required).
437+ String appSid = " xxxx" ;
438+ String appKey = " xxx-xx" ;
439+
440+ ViewerApi apiInstance = new ViewerApi (appSid, appKey);
441+ try {
442+ FormatCollection response = apiInstance. getSupportedFileFormats();
443+
444+ if (response. getFormats(). size() > 0 ) {
445+ for (Format format : response. getFormats()) {
446+ System . out. println(" Format: " + format. toString());
447+ }
448+ }
449+ System . out. println(" Executed Successfully" );
450+ } catch (ApiException e) {
451+ System . err. println(" Exception when calling ViewerApi" );
452+ e. printStackTrace();
453+ }
454+ ```
455+
378456{{< /tab >}}
379- {{< tab "Ruby">}}
380- {{< gist groupdocscloud cb1b9fbd2cc419d83ca2c2dd1d7fcfc5 Viewer_Ruby_Get_All_Supported_Formats.rb >}}
457+ {{< tab "Ruby" >}}
458+
459+ ``` ruby
460+ # Load the gem
461+ require ' groupdocs_viewer_cloud'
462+ require ' common_utilities/Utils.rb'
463+
464+ class File_Formats
465+ def self .Get_All_Supported_File_Formats ()
466+
467+ # Getting instance of the API
468+ api = Common_Utilities .Get_InfoApi_Instance ()
469+
470+ # Retrieve supported file-formats
471+ response = api.get_supported_file_formats()
472+
473+ # Print out supported file-formats
474+ puts (" Supported file-formats:" )
475+ response.formats.each do |format |
476+ puts (" #{ format .file_format} (#{ format .extension} )" )
477+ end
478+ end
479+ end
480+ ```
481+
381482{{< /tab >}}
382- {{< tab "Node.js">}}
383- {{< gist groupdocscloud f96d4c7dbf8cb43ec3d6717a7309d3b8 Viewer_Node_Get_All_Supported_Formats.js >}}
483+ {{< tab "Node.js" >}}
484+
485+ ``` js
486+ " use strict" ;
487+ class Viewer_Node_Get_All_Supported_Formats {
488+ static Run () {
489+ // retrieve supported file-formats
490+ infoApi .getSupportedFileFormats ()
491+ .then (function (response ) {
492+ console .log (" Supported file-formats:" );
493+ response .formats .forEach (function (format ) {
494+ console .log (format .fileFormat + " (" + format .extension + " )" );
495+ });
496+ })
497+ .catch (function (error ) {
498+ console .log (" Error: " + error .message );
499+ });
500+ }
501+ }
502+ module .exports = Viewer_Node_Get_All_Supported_Formats;
503+ ```
504+
384505{{< /tab >}}
385- {{< tab "Python">}}
386- {{< gist groupdocscloud 46af986198f1d3f84ef2db07ef9a56f9 Viewer_Python_Get_All_Supported_Formats.py >}}
506+ {{< tab "Python" >}}
507+
508+ ``` python
509+ # Import modules
510+ import groupdocs_viewer_cloud
511+ from Common_Utilities.Utils import Common_Utilities
512+
513+ class Viewer_Python_Get_All_Supported_Formats :
514+
515+ @ classmethod
516+ def Run (self ):
517+ # Create instance of the API
518+ api = Common_Utilities.Get_InfoApi_Instance()
519+
520+ try :
521+ # Retrieve supported file-formats
522+ response = api.get_supported_file_formats()
523+
524+ # Print out supported file-formats
525+ print (" Supported file-formats:" )
526+ for fileformat in response.formats:
527+ print (' {0} ({1} )' .format(fileformat.file_format, fileformat.extension))
528+ except groupdocs_viewer_cloud.ApiException as e:
529+ print (" Exception when calling get_supported_viewer_types: {0} " .format(e.message))
530+ ```
531+
387532{{< /tab >}}
388- {{< tab "Android">}}
389- {{< gist groupdocscloud 6e9d8e6b54cde933baba15e2a645a57a Viewer_Android_Get_Supported_Formats.java >}}
533+ {{< tab "Android" >}}
534+
535+ ``` java
536+ package examples.Supported_File_Formats ;
537+
538+ import com.groupdocs.cloud.viewer.client.* ;
539+ import com.groupdocs.cloud.viewer.model.* ;
540+ import com.groupdocs.cloud.viewer.api.InfoApi ;
541+ import examples.Utils ;
542+
543+ public class Viewer_Android_Get_Supported_Formats {
544+
545+ public static void main (String [] args ) {
546+
547+ InfoApi apiInstance = new InfoApi (Utils . AppSID , Utils . AppKey );
548+ try {
549+ FormatsResult response = apiInstance. getSupportedFileFormats();
550+
551+ for (Format format : response. getFormats()) {
552+ System . out. println(format. getFileFormat());
553+ }
554+ } catch (ApiException e) {
555+ System . err. println(" Exception while calling InfoApi:" );
556+ e. printStackTrace();
557+ }
558+ }
559+ }
560+ ```
561+
390562{{< /tab >}}
391563{{< /tabs >}}
0 commit comments