summaryrefslogtreecommitdiff
path: root/src/pdf.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/pdf.zig')
-rw-r--r--src/pdf.zig7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/pdf.zig b/src/pdf.zig
index b7e12fe8..a12be0b1 100644
--- a/src/pdf.zig
+++ b/src/pdf.zig
@@ -726,6 +726,13 @@ pub const Document = struct {
document.* = undefined;
}
+ pub fn openBytes(bytes: []const u8) !Document {
+ var page_count: c_int = 0;
+ const handle = c.pardes_pdf_open_memory(bytes.ptr, bytes.len, &page_count) orelse
+ return error.OpenFailed;
+ return .{ .handle = handle, .pages = @intCast(page_count) };
+ }
+
/// Load and flatten the PDF-native outline/bookmarks. MuPDF's temporary
/// tree and the bridge's flat view are both dropped before this returns.
pub fn outline(