簡體   English   中英

解壓Ruby中的PDF文件

[英]Decompress PDF file in Ruby

我正在制作一個可以分析 PDF 文件中的圖形的程序。 我幾乎讓它按照我想要的方式工作,我正在嘗試使用 AWS Lambda 自動化腳本。

在我的本地機器上使用mutool完成了這項工作,但這似乎不適用於 AWS。

command = "mutool clean -d #{input_path} #{output_path}"
system command

當我在我的 lambda function 中運行它時, output_path文件仍然為空。 如何在不使用 mutool/system 命令的情況下解壓縮 PDF 文件?

gem install pdf-reader

require 'pdf-reader'
reader = PDF::Reader.new(input_path)
content = reader.pages.first.raw_content
File.write(output_path, content)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM