Display a PDF file in a browser

I need to display a XML file and a PDF file in a browser. XML file is working, but PDF file not.

My code:

How must be getPdf() modified?



How do you display the xml file in a browser? Your code only shows how you download it and turn it into a String.
For starters you will probably not want to convert the pdf file to a String, but keep it as an Array[Byte] or something like that. The raw contents of a pdf file are not human readable Strings.

Thank you for your answer. Excuse me, I’m new in Scala:


I have changed the type for getPdf:

with a Scala compiler error:

What is wrong?