mirror of
https://github.com/docusealco/docuseal
synced 2026-11-04 14:42:32 -05:00
improve flatten
This commit is contained in:
1 parent
5308e3e15b
commit
3d93bbe5aa
1 file changed
+14
@@ -1763,6 +1763,20 @@ class Pdfium
|
||||
def flatten(flag = Pdfium::FLAT_NORMALDISPLAY)
|
||||
ensure_not_closed!
|
||||
|
||||
load_page_view
|
||||
|
||||
l_ptr, b_ptr, r_ptr, t_ptr = Array.new(4) { FFI::MemoryPointer.new(:float) }
|
||||
|
||||
left, bottom, right, top = box.map(&:to_f)
|
||||
|
||||
if Pdfium.FPDFPage_GetMediaBox(page_ptr, l_ptr, b_ptr, r_ptr, t_ptr).zero?
|
||||
Pdfium.FPDFPage_SetMediaBox(page_ptr, left, bottom, right, top)
|
||||
end
|
||||
|
||||
if Pdfium.FPDFPage_GetCropBox(page_ptr, l_ptr, b_ptr, r_ptr, t_ptr).zero?
|
||||
Pdfium.FPDFPage_SetCropBox(page_ptr, left, bottom, right, top)
|
||||
end
|
||||
|
||||
result = Pdfium.FPDFPage_Flatten(page_ptr, flag)
|
||||
|
||||
if result == Pdfium::FLATTEN_FAIL
|
||||
|
||||
Reference in new issue
Block a user