SHARE
TWEET

Untitled

a guest Jun 25th, 2019 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class WebservicesTestBlock extends BlockBase {
  2.  
  3.     public function build() {
  4.  
  5.         $form = Drupal::formBuilder()->getForm('Drupalwebservices_testFormWebservicesTestForm');
  6.         return $form;
  7.  
  8.     }
  9.  
  10. }
  11.      
  12. public function submitForm(array &$form, FormStateInterface $form_state) {
  13.  
  14.  
  15.     // here is the code that returns pdf dats
  16.  
  17.         header("Content-Type: application/pdf");
  18.         header("Content-Disposition: attachment; filename=test.pdf");
  19.         header('Content-Transfer-Encoding: binary');
  20.         //header("Cache-Control", "max-age=0");
  21.         header('Accept-Ranges: bytes');
  22.         ob_clean();
  23.         flush();
  24.         echo ($test->body);
  25.         exit;
  26.  
  27.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top