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
  • 51,252
  • 26
  • 196
  • 186
Roshan Yengul
  • 11
  • 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
  • 3,445
  • 27
  • 35