Yii Framework Forum: How to display PDF file in Yii2 web app page view? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How to display PDF file in Yii2 web app page view? i have one text filed named "audit_report" for storing audit r

#1 User is offline   HarshEcho 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 25-September 16

Posted 11 January 2017 - 03:36 AM

I have one text field for storing images named 'audit_report'.I stored PDF files in folder and saved file name in db.I could display jpeg and png files.But how to display PDF file?
0

#2 User is offline   newbiedo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 68
  • Joined: 28-June 12

Posted 13 January 2017 - 06:52 PM

View PostHarshEcho, on 11 January 2017 - 03:36 AM, said:

I have one text field for storing images named 'audit_report'.I stored PDF files in folder and saved file name in db.I could display jpeg and png files.But how to display PDF file?



In my Yii1 site, I have some static pdf's and clicking a link to the file opens them in the browser. I don't know under what scenario you are displaying yours, but I would guess that in some controller action you would call
return $this->render($yourpath."/".$yourpdf);


You may need to customize a layout for this to work.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users