title: Add image using Prawn, got error: Prawn::Errors::UnsupportedImageType, PNG uses unsupported interlace method
body: <p>I used Prawn to create pdf file, I want to put the logo in file. I have looked at this site <a href="http://www.idyllic-software.com/blog/creating-pdf-using-prawn-in-ruby-on-rails/" rel="nofollow">Creating pdf</a> to reference how to add image.</p>
  
  <p>This is my code in <code>ExamResultPdf.rb</code> file to generate pdf:</p>
  
  <pre><code>  def initialize(exam, view)
      super(top_margin: 70)
      @exam = exam
      exam_number # line 9, I removed codes are not relevant
    end
  
    def exam_number
      logo_path = "#{Rails.root}/app/assets/images/logo_hoasen.png"
      image logo_path, height: 200, width: 200
      text "Examination Result \##{@exam.id}", size: 30, style: :bold
    end
  </code></pre>
  
  <p>But when I go to page <code>/result.pdf</code>, it has error:</p>
  
  <pre><code>Prawn::Errors::UnsupportedImageType in ExamsController#result
  PNG uses unsupported interlace method
  
  # Trace
  app/pdfs/exam_result_pdf.rb:18:in `exam_number'
  app/pdfs/exam_result_pdf.rb:9:in `initialize'
  app/controllers/exams_controller.rb:43:in `new'
  app/controllers/exams_controller.rb:43:in `block (2 levels) in result'
  app/controllers/exams_controller.rb:40:in `result'
  </code></pre>
  
  <p>My <code>exams_controller</code>:</p>
  
  <pre><code>def result
      @exam = Exam.find(params[:id])
      @general_exam = GeneralExam.where(id: @exam.general_exam_id).first
      @topic_questions = TopicQuestion.where(general_exam_id: @general_exam.id)
      @exam_result = ExamResult.where(exam_id: @exam.id, user_id: @exam.user_id).first
  
      respond_to do |format|
        format.html
        format.pdf do
          pdf = ExamResultPdf.new(@exam, view_context) # line 43
          send_data pdf.render, filename: "exam_result_#{@exam.id}",
                                    type: "application/pdf",
                             disposition: "inline"
        end
      end
    end
  </code></pre>
  
  <p>So I want to ask why I got this error, Prawn is not support png file? How can I put image in pdf file? </p>
  
  <p><strong>Update</strong></p>
  
  <p>I have used <code>jpg</code> or <code>jpeg</code> file, but it did not work too.</p>