mirror of
https://github.com/docusealco/docuseal
synced 2026-11-08 15:42:32 -05:00
process pdf v2
This commit is contained in:
1 parent
785eb789ad
commit
f9669b0e16
9 files changed
+59
-458
No files matched your search
@@ -6,24 +6,6 @@ module PdfUtils
|
||||
|
||||
module_function
|
||||
|
||||
def encrypted?(data, password: nil)
|
||||
HexaPDF::Document.new(io: StringIO.new(data), decryption_opts: { password: })
|
||||
|
||||
false
|
||||
rescue HexaPDF::EncryptionError
|
||||
true
|
||||
end
|
||||
|
||||
def decrypt(data, password)
|
||||
decrypted_io = StringIO.new
|
||||
|
||||
Pdfium::Document.open_bytes(data, password) do |doc|
|
||||
doc.save(decrypted_io, flags: Pdfium::FPDF_REMOVE_SECURITY)
|
||||
end
|
||||
|
||||
decrypted_io.tap(&:rewind).read
|
||||
end
|
||||
|
||||
def merge(io_files)
|
||||
merged_content = StringIO.new
|
||||
|
||||
|
||||
Reference in new issue
Block a user