0

I am generating PDF document using iText API in Java. It is running fine on Mozila and MSIE. But when I am removing,

response.setHeader("content-disposition: attachment", "inline; filename=myFile.pdf");

this part of code from my servlet it is running fine on Chrome as well. But as soon as I add this code and try to run it on Chrome it is giving me error saying 'Failed to load PDF document'.

I need to use above part of code in order to give dynamic name to each PDF generated. How could I achieve this?

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Roshan Yengul
  • 21
  • 1
  • 7

1 Answers1

2

I think that should be

response.setHeader("content-disposition", "inline; filename=myFile.pdf");

or instead of inline you can use attachment, but not both. See this answer.

Community
  • 1
  • 1
AlexDev
  • 4,049
  • 31
  • 36