C14.14: export HTML, HTML and folder, PDF (MuPDF story in the PDF worker) and plain text; print; rich copy
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
f1cb7eff99
commit
d7ded183ae
27 files changed
+1427
-24
No files matched your search
@@ -34,6 +34,7 @@ unsafe extern "C" {
|
||||
fn ely_watch_end(ctx: *mut Context) -> c_int;
|
||||
fn ely_check_pictures(ctx: *mut Context, doc: *mut Document) -> c_int;
|
||||
fn ely_print_copy(ctx: *mut Context, doc: *mut Document, raw: *const c_char, out: *const c_char, password: *const c_char) -> c_int;
|
||||
fn ely_html_pdf(ctx: *mut Context, dir: *const c_char, page: *const c_char, out: *const c_char) -> c_int;
|
||||
}
|
||||
|
||||
/// What MuPDF warned while opening the last file.
|
||||
@@ -56,6 +57,16 @@ impl Mupdf {
|
||||
done.map(|_| ())
|
||||
}
|
||||
|
||||
/// `page` in `dir` set as a PDF at `out`.
|
||||
pub fn html_pdf(&self, dir: &str, page: &str, out: &str) -> io::Result<()> {
|
||||
let (dir_c, page_c, out_c) = (text(dir)?, text(page)?, text(out)?);
|
||||
let done = checked(unsafe { ely_html_pdf(self.ctx, dir_c.as_ptr(), page_c.as_ptr(), out_c.as_ptr()) });
|
||||
if done.is_err() {
|
||||
clean(out.as_ref());
|
||||
}
|
||||
done.map(|_| log::info!("pdf-worker: set an HTML page as a PDF"))
|
||||
}
|
||||
|
||||
pub fn repaired(&self, doc: &Open) -> io::Result<bool> {
|
||||
checked(unsafe { ely_repaired(self.ctx, doc.0) }).map(|repaired| repaired != 0)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user