Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
pdf-reader-extract-images
Advanced tools
ExtractImages
Based upon the Example from Pdf::Reader, battle hardened in our applicant tracking system with tens of thousands of PDFs.
Add this line to your application's Gemfile:
gem 'pdf-reader-extract-images'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install pdf-reader-extract-images
require 'pdf-reader-extract-images'
reader = PDF::Reader.new(pdf)
images = Pdf::Reader::ExtractImages.extract_all(reader)
# pass an image limit to ignore gigantic image-only pdfs
images = Pdf::Reader::ExtractImages.extract_all(reader, limit: 50)
# [
# {
# :filename => "1-1-Im1.jpg",
# :width => 1772,
# :height => 591
# :blob => "....",
# }
# ]
# OR you can just scan a single Pdf::Reader Page
reader.pages.each do |page|
images = Pdf::Reader::ExtractImages.extract_from_pdf_page(page)
end
There are some PDFs which have tons of images. Make sure to limit the timeout of an extraction somehow.
Also some PDFs product hundreds of images. Make sure to limit further processing down the line
Unfortunately, there is no public test suite. We have a private test suite that tests live pdfs which we cannot share. If you'd like to contribute problematic PDFs, feel free to open PR!
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that pdf-reader-extract-images demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.