create the api for the display list

This commit is contained in:
saqib mir
2026-06-22 16:23:59 +05:30
parent caf3feea15
commit 23b162f3c2
8 changed files with 161 additions and 3 deletions
+8 -1
View File
@@ -428,7 +428,14 @@ PYBIND11_MODULE(pdfengine, m) {
.def("page_to_device", &pdfengine::PdfPage::pageToDevice,
py::arg("page_point"), py::arg("device_width"), py::arg("device_height"), py::arg("rotate") = 0)
.def("device_to_page", &pdfengine::PdfPage::deviceToPage,
py::arg("device_point"), py::arg("device_width"), py::arg("device_height"), py::arg("rotate") = 0);
py::arg("device_point"), py::arg("device_width"), py::arg("device_height"), py::arg("rotate") = 0)
.def("extract_display_list", [](const pdfengine::PdfPage& self) {
return get_or_throw(self.extractDisplayListJson());
})
.def("extract_image_xobject", [](const pdfengine::PdfPage& self, const std::string& name) {
auto res = get_or_throw(self.extractImageXObject(name));
return py::bytes(reinterpret_cast<const char*>(res.data()), res.size());
}, py::arg("name"));
py::class_<pdfengine::PdfDocument, std::shared_ptr<pdfengine::PdfDocument>>(m, "PdfDocument")
.def_static("load_from_file", [](const std::string& path, const std::string& password) {