Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9221327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:33:20+00:00 2026-06-18T03:33:20+00:00

I am uploading a PDF in my Rails application using Carrierwave . My aim

  • 0

I am uploading a PDF in my Rails application using Carrierwave. My aim is to convert each page in the PDF to an PNG and ensure that each of these PNGs resides in the uploads directory which Carrierwave creates based on my model etc.

Current progress is that I am able to upload a PDF, convert it to a series of PNGs in the temporary directory that Carrierwave creates but I am unable to work out the correct approach to moving these converted PNGs into the designated uploads directory:

"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"

UPDATE – Added below my current attempt and error code

My current code is as follows:

def extract(format)
  cache_stored_file! if !cached?
  images = Magick::ImageList.new(current_path)
  images.write File.dirname( current_path ) << "/" << filename
end

def filename
  super != nil ? super.split('.').first + '.png' : super
end

All attempts to move the files using any approach to the uploads directory results in some sort of ‘no such file or directory’ Error. For example using:

images.each do |f|
  FileUtils.mv f.filename, File.join("#{Rails.root}/#{store_dir}", "image-0.png")
end

Errno::ENOENT (No such file or directory - 
(/Users/reggie/ExampleApp/public/uploads/tmp/20120611-2259-7520-3647/image-0.png,
 /Users/reggie/ExampleApp/public/uploads/painting/image/39/image-0.png))

Any suggestions would be welcomed to help me get through this wall I have hit.

Just as a side note as to why I am not using the manipulate logic, example code (see below) results in the same as above i.e. converted files in the temporary directory created by Carrierwave, however all the converted images remain with the .pdf file extension.

manipulate!(:format => :png) do |img|
  img
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T03:33:21+00:00Added an answer on June 18, 2026 at 3:33 am

    Well, your main problem is that your storing folder don’t exist.

    Carrierwave path construction is relative to “public” folder.

    You should use something like this in your uploader:

    process :generate_png
    
    protected
    def generate_png
        manipulate! do |image, index|
            image.format = 'png'
            image.write("#{Rails.root}/public/#{store_dir}/image-#{index}.png")
            ...
        end
    end
    

    To remove those files use a callback.

    before :remove, :clear_uploader 
    
    protected
    def clear_uploader
       ...
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm uploading a pdf file from an iOS application to a Rails application. The
I'm developing a Ruby on Rails application that requires file uploading/downloading. For the upload
Using a custom DevExpress application our users are uploading PDF files which get stored
I have a rails 3 app that allows users to share files by uploading
We are using FTPWebRequest class in my project to upload PDF files. For uploading
I have got this WebService that allows uploading/downloading any docs (mostly .docx, .doc, .pdf)
we are using prawn to generate pdf file in our rails 3 app. Now
I am uploading a PDF using the codeigniter upload library, the PDF is uploaded
It has been discovered that several users have been uploading secured (password protected) .pdf's
I'm looking for a way to convert PDF documents that our clients will be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.