%head %title Sample 35 - How to get fields and their data from PDF file %link(rel="stylesheet" type="text/css" href="/css/style.css") %script{:src=>'//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'} %body %h3{:style => 'text-align:center;'} %a{:href => '/'} GroupDocs Ruby SDK Samples %br/ Sample 35 - How to get fields and their data from PDF file .samplecontent{:style => 'padding:10px;'} %span.description This sample will show how to get fields and their data from PDF file programmatically and dynamically create HTML form using the data about fields. %br/ %br/ / %span.documentation %a{:href => '/docs/sample35.html'} Builtin documentation for this sample %br/ %br/ %p You entered: %p ClientID = #{(defined? userId) ? userId : ''} %p PrivateKey = #{(defined? privateKey) ? privateKey : ''} %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 => "#{(defined? userId) ? '//sample-35-how-to-get-fields-and-their-data-from-pdf-file/check' : '//sample-35-how-to-get-fields-and-their-data-from-pdf-file'}", :enctype => 'multipart/form-data', :method => 'post', :id=>'form'} %label{:for => 'clientId'} GroupDocs ClientID %br/ %input{:type=>'text', :name=>'clientId', :id=>'client_id', :value=>"#{(defined? userId) ? userId : ''}"} %br/ %label{:for => 'privateKey'} GroupDocs PrivateKey %br/ %input{:type=>'text', :name=>'privateKey', :id=>'private_key', :value=>"#{(defined? privateKey) ? privateKey : ''}"} %br/ %div.guid_radio{:style=>"#{(defined? userId) ? 'display:none' : 'display:block'}"} %input{:type=>'radio', :name=>'source', :value=>'guid'} File ID (GUID) %br/ %input{:type=>'radio', :name=>'source', :value=>'local', :checked=>'checked'}Upload local file %br/ %input{:type=>'radio', :name=>'source', :value=>'url'} Upload file from URL %br/ %div.fields{:style=>"#{(defined? userId) ? 'display:none' : 'display:block'}"} %div.guid_field{:style=>'display:none;'} %label{:for=>'fileId', :id=>'guid'} File ID (GUID) %br/ %input{:type=>'text', :name=>'fileId', :id=>'guid', :value=>"#{(defined? fileId) ? fileId : ''}"} %div.guid_field %label{:for=>'file'} Upload local file %br/ %input{:type=>'file', :name=>'file', :id=>'file'} %div.guid_field{:style=>'display:none;'} %label{:for=>'url', :id=>'url'} Upload file from URL %br/ %input{:type=>'text', :name=>'url', :id=>'url'} %label{:for => 'basePath'} Base Path %br/ %font{:color=>'grey'} (https://stage-api-groupdocs.dynabic.com) %br/ %input{:type=>'text', :name=>'basePath', :id=>'base_path', :value=>"#{(defined? base_path) ? base_path : ''}"} %br/ #{(defined? html) ? "
'submit', :id => 'button', :value => 'Make request'} %br/ %a{:href=>'/templates/test_all_fields2.pdf'} Download sample Pdf file %br/ %br/ %div{:style => 'padding:20px; border:1px solid black;'} %p Results: #result #{(defined? iframe) ? iframe : ''} = partial :_others_samples %script{:src=>'//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'} :javascript $(function($){ $('.guid_radio input').change(function(){ var elementIndex = $(this).parent().children('input').index($(this)); $('.guid_field').hide(); $('.guid_field').eq(elementIndex).show(); }); });