RuntimeError (JPEG marker not found!):

Hi,   while generating the PDF file , i am getting following error.. please help for me.

RuntimeError (JPEG marker not found!):   C:/Ruby/lib/ruby/gems/1.8/gems/pdf-writer-1.1.8/lib/pdf/writer/ graphics/imageinfo.rb:176:in ` measure_JPEG'   C:/Ruby/lib/ruby/gems/1.8/gems/pdf-writer-1.1.8/lib/pdf/writer/ graphics/imageinfo.rb:174:in ` loop'   C:/Ruby/lib/ruby/gems/1.8/gems/pdf-writer-1.1.8/lib/pdf/writer/ graphics/imageinfo.rb:174:in ` measure_JPEG'   C:/Ruby/lib/ruby/gems/1.8/gems/pdf-writer-1.1.8/lib/pdf/writer/ graphics/imageinfo.rb:85:in `_ _send__'   C:/Ruby/lib/ruby/gems/1.8/gems/pdf-writer-1.1.8/lib/pdf/writer/ graphics/imageinfo.rb:85:in `i nitialize'   C:/Ruby/lib/ruby/gems/1.8/gems/pdf-writer-1.1.8/lib/pdf/writer/ graphics.rb:574:in `new'   C:/Ruby/lib/ruby/gems/1.8/gems/pdf-writer-1.1.8/lib/pdf/writer/ graphics.rb:574:in `add_image'

  lib/purchase_pdf.rb:52:in `draw_background_image'   lib/purchase_pdf.rb:40:in `draw'   lib/purchase_pdf.rb:17:in `draw'   lib/purchase_pdf.rb:16:in `each'   lib/purchase_pdf.rb:16:in `draw'   lib/purchase_pdf.rb:13:in `draw'   lib/purchase_pdf.rb:8:in `render'   app/controllers/purchases_controller.rb:32:in `show'   app/controllers/purchases_controller.rb:28:in `show'   C:/Ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'   C:/Ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'   C:/Ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'   C:/Ruby/lib/ruby/1.8/webrick/server.rb:162:in `start'   C:/Ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'   C:/Ruby/lib/ruby/1.8/webrick/server.rb:95:in `start'   C:/Ruby/lib/ruby/1.8/webrick/server.rb:92:in `each'   C:/Ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'   C:/Ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'   C:/Ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'

Rendered rescues/_trace (218.0ms) Rendered rescues/_request_and_response (16.0ms) Rendering rescues/layout (internal_server_error)

Hi, while generating the PDF file , i am getting following error.. please help for me.

That sounds like the jpeg file you gave the library didn't look like a jpeg file.

Fred

Hi Frederick,

still i am getting same problem. actually it happens, draw an image to pdf file.

Action Controller: Exception caught

RuntimeError in PurchasesController#show

JPEG marker not found!

RAILS_ROOT: C:/Documents and Settings/Madusudana Rao/Desktop/latest_r3

Application Trace | Framework Trace | Full Trace

C:/Ruby/lib/ruby/gems/1.8/gems/pdf-writer-1.1.0/lib/pdf/writer/graphics/imageinfo.rb:176:in `measure_JPEG'
C:/Ruby/lib/ruby/gems/1.8/gems/pdf-writer-1.1.0/lib/pdf/writer/graphics/imageinfo.rb:174:in `loop'
C:/Ruby/lib/ruby/gems/1.8/gems/pdf-writer-1.1.0/lib/pdf/writer/graphics/imageinfo.rb:174:in `measure_JPEG'
C:/Ruby/lib/ruby/gems/1.8/gems/pdf-writer-1.1.0/lib/pdf/writer/graphics/imageinfo.rb:85:in `__send__'
C:/Ruby/lib/ruby/gems/1.8/gems/pdf-writer-1.1.0/lib/pdf/writer/graphics/imageinfo.rb:85:in `initialize'
C:/Ruby/lib/ruby/gems/1.8/gems/pdf-writer-1.1.0/lib/pdf/writer/graphics.rb:574:in `new'
C:/Ruby/lib/ruby/gems/1.8/gems/pdf-writer-1.1.0/lib/pdf/writer/graphics.rb:574:in `add_image'
C:/Documents and Settings/Madusudana Rao/Desktop/latest_r3/lib/purchase_pdf.rb:50:in `draw_background_image'
C:/Documents and Settings/Madusudana Rao/Desktop/latest_r3/lib/purchase_pdf.rb:38:in `draw'
C:/Documents and Settings/Madusudana Rao/Desktop/latest_r3/lib/purchase_pdf.rb:17:in `draw'
C:/Documents and Settings/Madusudana Rao/Desktop/latest_r3/lib/purchase_pdf.rb:16:in `each'
C:/Documents and Settings/Madusudana Rao/Desktop/latest_r3/lib/purchase_pdf.rb:16:in `draw'
C:/Documents and Settings/Madusudana Rao/Desktop/latest_r3/lib/purchase_pdf.rb:13:in `draw'
C:/Documents and Settings/Madusudana Rao/Desktop/latest_r3/lib/purchase_pdf.rb:8:in `render'
C:/Documents and Settings/Madusudana Rao/Desktop/latest_r3/app/controllers/purchases_controller.rb:31:in `show'
C:/Documents and Settings/Madusudana Rao/Desktop/latest_r3/app/controllers/purchases_controller.rb:28:in `show'

Request

Parameters:

 {"format"=>"pdf",
"id"=>"4"}

Show session dump

Response

Headers:

 {"Content-Type"=>"application/pdf",
"Cache-Control"=>"no-cache"}

Regards, Kanikanti Mobile: 571-296-7842