pub trait TableDrawing {
// Required methods
fn draw_table(
&mut self,
page_id: ObjectId,
table: Table,
position: (f32, f32),
) -> Result<()>;
fn add_table_to_page(
&mut self,
page_id: ObjectId,
table: Table,
) -> Result<()>;
fn create_table_content(
&self,
table: &Table,
position: (f32, f32),
) -> Result<Vec<Object>>;
fn draw_table_with_pagination(
&mut self,
page_id: ObjectId,
table: Table,
position: (f32, f32),
) -> Result<PagedTableResult>;
fn draw_table_with_hook(
&mut self,
page_id: ObjectId,
table: Table,
position: (f32, f32),
hook: Option<&mut dyn TaggedCellHook>,
) -> Result<()>;
fn draw_table_with_pagination_and_hook(
&mut self,
page_id: ObjectId,
table: Table,
position: (f32, f32),
hook: Option<&mut dyn TaggedCellHook>,
) -> Result<PagedTableResult>;
}Expand description
Extension trait for lopdf::Document to add table drawing capabilities
Required Methods§
Sourcefn draw_table(
&mut self,
page_id: ObjectId,
table: Table,
position: (f32, f32),
) -> Result<()>
fn draw_table( &mut self, page_id: ObjectId, table: Table, position: (f32, f32), ) -> Result<()>
Sourcefn add_table_to_page(&mut self, page_id: ObjectId, table: Table) -> Result<()>
fn add_table_to_page(&mut self, page_id: ObjectId, table: Table) -> Result<()>
Add a table to a page with automatic positioning
This method will find an appropriate position on the page for the table
Sourcefn create_table_content(
&self,
table: &Table,
position: (f32, f32),
) -> Result<Vec<Object>>
fn create_table_content( &self, table: &Table, position: (f32, f32), ) -> Result<Vec<Object>>
Create table content operations without adding to document
Useful for custom positioning or combining with other content
Sourcefn draw_table_with_pagination(
&mut self,
page_id: ObjectId,
table: Table,
position: (f32, f32),
) -> Result<PagedTableResult>
fn draw_table_with_pagination( &mut self, page_id: ObjectId, table: Table, position: (f32, f32), ) -> Result<PagedTableResult>
Draw a table with automatic page wrapping
This method will automatically create new pages as needed when the table exceeds the available space on the current page. Header rows will be repeated on each new page if configured.
§Arguments
page_id- The object ID of the starting pagetable- The table to drawposition- The (x, y) position of the table’s top-left corner
§Returns
Returns a PagedTableResult with information about pages used
Sourcefn draw_table_with_hook(
&mut self,
page_id: ObjectId,
table: Table,
position: (f32, f32),
hook: Option<&mut dyn TaggedCellHook>,
) -> Result<()>
fn draw_table_with_hook( &mut self, page_id: ObjectId, table: Table, position: (f32, f32), hook: Option<&mut dyn TaggedCellHook>, ) -> Result<()>
Draw a table with an optional tagged-cell hook.
Existing rendering behavior is unchanged when hook is None.
Sourcefn draw_table_with_pagination_and_hook(
&mut self,
page_id: ObjectId,
table: Table,
position: (f32, f32),
hook: Option<&mut dyn TaggedCellHook>,
) -> Result<PagedTableResult>
fn draw_table_with_pagination_and_hook( &mut self, page_id: ObjectId, table: Table, position: (f32, f32), hook: Option<&mut dyn TaggedCellHook>, ) -> Result<PagedTableResult>
Draw a paginated table with an optional tagged-cell hook.
Existing rendering behavior is unchanged when hook is None.