Display pdf from attachments in HTML Portlet

Hi,

Is there a possible way to display a document in HTML Portlet (for example a pdf) from attachments with a REST API o something else without download the file, only need to view in portlet

We tried

<!DOCTYPE html>
<html>
<head>
    <title>Mostrar PDF</title>
</head>
<body>
    <embed src="base_url_ppm/itg/servlet/Document?ID=31190&viewOnly=TRUE" width="600" height="500" type="application/pdf">
</body>
</html>

 and

<!DOCTYPE html>
<html>
<head>
    <title>Mostrar PDF</title>
</head>
<body>
    <embed src="base_url_ppm/itg/rest2/attachments/31190/content" width="600" height="500" type="application/pdf">
</body>
</html>

But this starts the download without viewing pdf

  • Suggested Answer

    0  

    Hi Perla,

    Unfortunately there doesn't seems to be a built-in way in PPM today that will allow you to embed PDF attachments in a web page.

    Either you use /itg/servlet/Document?ID=30000 and there will be a Content-Disposition header that will for download as attachment with the right file name, or you can use /itg/rest2/attachments/30000/content and will instead always have a Content-Type header of application/octet-stream which will not allow the document to be embedded.

    Feel free to submit an Idea to provide a way that will allow these documents to be embedded - or another way could be to write your own JSP that will get the file contents and return it with the appropriate headers that will allow it ot be embedded.