Class: VivlioStarter::CLI::PdfCommands::PdfPagesExporter
- Inherits:
-
Object
- Object
- VivlioStarter::CLI::PdfCommands::PdfPagesExporter
- Defined in:
- lib/vivlio_starter/cli/pdf.rb
Overview
PDF をページごとの JPEG に切り出す
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(options, cli_input = nil, pdf_to_jpeg: ::VivlioStarter::Pdf::PdfToJpeg) ⇒ PdfPagesExporter
constructor
A new instance of PdfPagesExporter.
Constructor Details
#initialize(options, cli_input = nil, pdf_to_jpeg: ::VivlioStarter::Pdf::PdfToJpeg) ⇒ PdfPagesExporter
Returns a new instance of PdfPagesExporter.
395 396 397 398 399 |
# File 'lib/vivlio_starter/cli/pdf.rb', line 395 def initialize(, cli_input = nil, pdf_to_jpeg: ::VivlioStarter::Pdf::PdfToJpeg) @options = || {} @cli_input = cli_input @pdf_to_jpeg = pdf_to_jpeg end |
Instance Method Details
#call ⇒ Object
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 |
# File 'lib/vivlio_starter/cli/pdf.rb', line 401 def call apply_verbose pdf_path = resolve_pdf_path ensure_input_exists!(pdf_path) ensure_pdf_pages_tools! output_dir = output_dir_for(pdf_path) Common.log_action("PDFをJPEG画像に切り出しています…(入力: #{pdf_path} → 出力: #{output_dir}/)") images = pdf_to_jpeg.convert( pdf_path, output_dir:, dpi: normalized_dpi, quality: normalized_quality, pages: [:pages] ) Common.log_result("#{images.size} ページを画像化しました(#{output_dir}/)", status: :success) { pdf_path:, output_dir:, images: } end |