%h3{:style => "text-align:center;"} %a{:href => "/"} GroupDocs Ruby SDK Samples \- Sample18 .samplecontent{:style => "padding:10px;"} %span.description %i This sample will show how to use %b ConvertFile method to convert Doc to Docx, Docx to Doc, Docx and DOC to PDF and PPT to PDF, HTML to DOC and DOCX using GroupDocs Ruby SDK. When you use optional parameter "Callback URL" - additional logic will be involved: POST request from GroupDocs API server will be handled by convert_callback action. Also from result page an AJAX request will be sent to backend to check if callback was handled and result file was downloaded. If yes, then AJAX request will return a link to the file. %br/ %br/ %span.documentation %a{:href => "/docs/sample18.html"} Builtin documentation for this sample %br/ %br/ %p You entered: %p ClientID = #{(defined? userId) ? userId : ""} %p PrivateKey = #{(defined? privateKey) ? privateKey : ""} %p FileId = #{(defined? fileId) ? fileId : ""} %p %font{:color => "red"} #{(defined? err) ? err : ""} %br/ #requestForm{:style => "padding:20px; border:1px solid black;"} %p Enter data for request and press "Make request" button %form{:action => "/sample18", :method => "post"} %label{:for => "client_id"} GroupDocs ClientID %br/ %input{:type=>"text", :name=>"client_id"} %br/ %label{:for => "private_key"} GroupDocs PrivateKey %br/ %input{:type=>"text", :name=>"private_key"} %br/ %label{:for => "file_id"} GroupDocs FileID %br/ %input{:type=>"radio", :name=>"sourse", :value=>"guid", :id=>"id", :onClick=>"display('guid');", :checked=>"checked"} File ID (GUID) %br/ %input{:type=>"radio", :name=>"sourse", :value=>"local", :id=>"localField", :onClick=>"display('local');"}Upload local file %br/ %input{:type=>"radio", :name=>"sourse", :value=>"url", :id=>"urlField", :onClick=>"display('url');"} Upload file from URL %br/ %label{:for=>'fileId', :id=>"guid"} File ID (GUID) %br/ %input{:type=>'text', :name=>'fileId', :id=>"guidfield", :value=>""} %label{:for=>'url', :style=>"display:none;", :id=>"url"} Upload file from URL %br/ %input{:type=>'text', :name=>'url', :value=>"", :id=>"urlfield", :style=>"display:none;"} %label{:for=>'file', :id=>"file", :style=>"display:none;"} Upload local file %br/ %input{:type=>'file', :name=>'file', :id=>"filefield", :style=>"display:none;"} %br/ %label{:for=>"convert_type"} Result file type %select{:name=>"convert_type", :id=>"convert_type"} %option{:value => "doc"}Doc %option{:value => "docx"}Docx %option{:value => "pdf"}PDF %option{:value => "ppt"}PPT %option{:value => "txt"}TXT %br/ %br/ %label{:for=>"callback"} Callback URL %span.optional (Optional) %br/ %font{:color=>"grey"} (For test Callback you can use this URL: http://groupdocs-ruby-samples.herokuapp.com/sample18/convert_callback) %input{:type=>"text", :size=>"70", :value=>"", :name=>"callback"} %br/ %br/ %input{:type => "submit", :value => "Make request"} %br/ %a{:href=>"/templates/testdocument.html"} Download sample HTML file 1 %br/ %a{:href=>"/templates/base-simple_source.html"} Download sample HTML file 2 %br/ %a{:href=>"/templates/sampledoc3.html"} Download sample HTML file 3 %br/ %br/ %div{:style => "padding:20px; border:1px solid black;"} %p Results: #{(defined? iframe) ? iframe : ""} %div#result #{(defined? message) ? message : ""} %div{:style => "padding:10px;"} Choose another one sample: %ul %li %a{:href => "/sample1"} Sample1 - How to login to GroupDocs using the API %li %a{:href => "/sample2"} Sample2 - How to list files within GroupDocs Storage using the Storage API %li %a{:href => "/sample3"} Sample3 - How to upload a file to GroupDocs using the Storage API %li %a{:href => "/sample4"} Sample4 - How to download a file from GroupDocs Storage using the Storage API %li %a{:href => "/sample5"} Sample5 - How to copy / move a file using the GroupDocs Storage API %li %a{:href => "/sample6"} Sample6 - How to add a Signature to a document in GroupDocs Signature %li %a{:href => "/sample7"} Sample7 - How to create a list of thumbnails for a document %li %a{:href => "/sample8"} Sample8 - How to return a URL representing a single page of a Document %li %a{:href => "/sample9"} Sample9 - How to generate an embedded Viewer URL for a Document %li %a{:href => "/sample10"} Sample10 - How to share a document to other users %li %a{:href => "/sample11"}Sample11 - How programmatically create and post an annotation into document. How to delete the annotation %li %a{:href => "/sample12"}Sample12 - How to list all annotations from document %li %a{:href => "/sample13"}Sample13 - How to add collaborator to doc with annotations %li %a{:href => "/sample14"}Sample14 - How to check the list of shares for a folder %li %a{:href => "/sample15"}Sample15 - How to check the number of document's views %li %a{:href => "/sample16"}Sample16 - How to insert Assembly questionary into webpage %li %a{:href => "/sample17"}Sample17 - How to upload a file into the storage and compress it into zip archive %li %a{:href => "/sample18"}Sample18 - How to convert Doc to Docx, Docx to Doc, Docx to PDF, PPT to PDF %li %a{:href => "/sample19"}Sample19 - How to Compare documents using Ruby SDK %li %a{:href => "/sample20"}Sample20 - How to Get Compare Change list for document using Ruby SDK %li %a{:href => "/sample21"}Sample21 - How to Create and Upload Envelop to GroupDocs account using Ruby SDK %li %a{:href => "/sample22"}Sample22 - How create or update user and add him to collaborators using PHP SDK %li %a{:href => "/envelope-sample"}Envelope sample - How to use envelope and signature API %script{:src=>"//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"} :javascript $(document).ready(setTimeout(check, 5000)); function check() { if (($("input[name=callbackUrl]").val() != "")) { $.ajax({ type: 'GET', url: '/sample18/check', success: function (data) { $('#result').html( data ); }, dataType: "text" }); } } function display(_element_id) { if (_element_id == "guid") { var element1 = document.getElementById("file"); var element2 = document.getElementById("filefield"); var element3 = document.getElementById("url"); var element4 = document.getElementById("urlfield"); var element5 = document.getElementById("guid"); var element6 = document.getElementById("guidfield"); element1.style.display = "none"; element2.style.display = "none"; element3.style.display = "none"; element4.style.display = "none"; element5.style.display = "inline"; element6.style.display = "inline"; } if (_element_id == "local") { var element1 = document.getElementById("file"); var element2 = document.getElementById("filefield"); var element3 = document.getElementById("url"); var element4 = document.getElementById("urlfield"); var element5 = document.getElementById("guid"); var element6 = document.getElementById("guidfield"); element1.style.display = "inline"; element2.style.display = "inline"; element3.style.display = "none"; element4.style.display = "none"; element5.style.display = "none"; element6.style.display = "none"; } if (_element_id == "url") { var element1 = document.getElementById("url"); var element2 = document.getElementById("urlfield"); var element3 = document.getElementById("file"); var element4 = document.getElementById("filefield"); var element5 = document.getElementById("guid"); var element6 = document.getElementById("guidfield"); element1.style.display = "inline"; element2.style.display = "inline"; element3.style.display = "none"; element4.style.display = "none"; element5.style.display = "none"; element6.style.display = "none"; } }