title: pdftk Error: Failed to open PDF file:
body: <p>I am using <code>pdftk</code> library to extract the form fields from the pdf .Everything is just running fine except the one issue that i got a pdf file <a href="http://www.uscis.gov/sites/default/files/files/form/i-9.pdf" rel="noreferrer">pdf file link</a>. which causes the error is given bellow</p>
  
  <pre><code>Error: Failed to open PDF file: 
     http://www.uscis.gov/sites/default/files/files/form/i-9.pdf
  Done.  Input errors, so no output created.
  </code></pre>
  
  <p>command for this is </p>
  
  <pre><code>root@ri8-MS-7788:/home/ri-8# pdftk http://192.168.1.43/form/i-9.pdf dump_data_fields
  </code></pre>
  
  <p>the same command is working for all other forms . </p>
  
  <p><strong>Attempt1</strong></p>
  
  <p>I have tried to encrypt the pdf to unsafe version but it produce the same error . here is the command</p>
  
  <pre><code>pdftk http://192.168.1.43/forms/i-9.pdf input_pw foopass output /var/www/forms/un-i-9.pdf
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p>this is my full function to handle this </p>
  
  <pre><code>public function Formanalysis($pdfname) 
      {
           $pdffile=Yii::app()-&gt;getBaseUrl(true).'/uploads/forms/'.$pdfname;
          exec("pdftk ".$pdffile." dump_data_fields 2&gt;&amp;1", $output,$retval);
          //got an error for some pdf if these are secure 
          if(strpos($output[0],'Error') !== false)
          {
              $unsafepdf=Yii::getPathOfAlias('webroot').'/uploads/forms/un-'.$pdfname;
              //echo "pdftk ".$pdffile." input_pw foopass output ".$unsafepdf;
              exec("pdftk ".$pdffile." input_pw foopass output ".$unsafepdf);
              exec("pdftk ".$unsafepdf." dump_data_fields 2&gt;&amp;1", $outputunsafe,$retval);
              return $outputunsafe ;
              //$response=array('0'=&gt;'error','error'=&gt;$output[0]);
              //return $response;
  
          }
  
          //if (strpos($output[0],'Error') !== false){ echo  "error to run" ; }   // this is the option to handle error 
          return $output;
  
      }
  </code></pre>