Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement