NetSurf
|
Implementation of paginated output. More...
#include "utils/config.h"
#include <assert.h>
#include <string.h>
#include <dom/dom.h>
#include "utils/utils.h"
#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/talloc.h"
#include "netsurf/content.h"
#include "netsurf/plotters.h"
#include "content/hlcache.h"
#include "css/utils.h"
#include "html/box.h"
#include "desktop/print.h"
#include "desktop/printer.h"
Go to the source code of this file.
Macros | |
#define | DEFAULT_PAGE_WIDTH 595 |
#define | DEFAULT_PAGE_HEIGHT 840 |
#define | DEFAULT_COPIES 1 |
Functions | |
bool | print_basic_run (hlcache_handle *content, const struct printer *printer, struct print_settings *settings) |
This function calls print setup, prints page after page until the whole content is printed calls cleaning up afterwise. More... | |
static struct hlcache_handle * | print_init (struct hlcache_handle *content, struct print_settings *settings) |
The content passed to the function is duplicated with its boxes, font measuring functions are being set. More... | |
static bool | print_apply_settings (hlcache_handle *content, struct print_settings *settings) |
The content is resized to fit page width. More... | |
bool | print_set_up (hlcache_handle *content, const struct printer *printer, struct print_settings *settings, double *height) |
This function prepares the content to be printed. More... | |
bool | print_draw_next_page (const struct printer *printer, struct print_settings *settings) |
This function draws one page, beginning with the height offset of done_height. More... | |
bool | print_cleanup (hlcache_handle *content, const struct printer *printer, struct print_settings *settings) |
Memory allocated during printing is being freed here. More... | |
struct print_settings * | print_make_settings (print_configuration configuration, const char *filename, const struct gui_layout_table *font_func) |
Generates one of the predefined print settings sets. More... | |
Variables | |
static float | page_content_width |
static float | page_content_height |
static struct hlcache_handle * | printed_content |
static float | done_height |
bool | html_redraw_printing = false |
int | html_redraw_printing_border = 0 |
int | html_redraw_printing_top_cropped = 0 |
Implementation of paginated output.
Definition in file print.c.
|
static |
The content is resized to fit page width.
content | The content to be printed |
settings | The settings for printing to use |
Definition at line 112 of file print.c.
References content_get_height(), content_get_width(), content_reformat(), MARGINBOTTOM, MARGINLEFT, MARGINRIGHT, print_settings::margins, MARGINTOP, NSLOG, page_content_height, page_content_width, print_settings::page_height, print_settings::page_width, print_settings::scale, and settings.
Referenced by print_set_up().
bool print_basic_run | ( | hlcache_handle * | content, |
const struct printer * | printer, | ||
struct print_settings * | settings | ||
) |
This function calls print setup, prints page after page until the whole content is printed calls cleaning up afterwise.
content | The content to be printed |
printer | The printer interface for the printer to be used |
settings | The settings for printing to use |
Definition at line 64 of file print.c.
References content_get_height(), done_height, print_cleanup(), print_draw_next_page(), print_set_up(), printed_content, and settings.
Referenced by pdf_button_clicked_cb().
bool print_cleanup | ( | hlcache_handle * | content, |
const struct printer * | printer, | ||
struct print_settings * | settings | ||
) |
Memory allocated during printing is being freed here.
content | The original content |
printer | The printer interface for the printer to be used |
settings | The print settings to use. |
Definition at line 228 of file print.c.
References hlcache_handle_release(), html_redraw_printing, print_settings::output, printer::print_end, printed_content, and settings.
Referenced by ami_print_cont(), gtk_print_signal_end_print(), and print_basic_run().
bool print_draw_next_page | ( | const struct printer * | printer, |
struct print_settings * | settings | ||
) |
This function draws one page, beginning with the height offset of done_height.
printer | The printer interface for the printer to be used |
settings | The settings for printing to use |
Definition at line 176 of file print.c.
References content_redraw_data::background_colour, clip(), content_redraw(), done_height, content_redraw_data::height, html_redraw_printing, html_redraw_printing_border, html_redraw_printing_top_cropped, redraw_context::interactive, nsoption_bool, page_content_height, page_content_width, printer::plotter, printer::print_next_page, printed_content, print_settings::priv, content_redraw_data::repeat_x, content_redraw_data::repeat_y, print_settings::scale, content_redraw_data::scale, settings, content_redraw_data::width, content_redraw_data::x, and content_redraw_data::y.
Referenced by ami_print_cont(), gtk_print_signal_draw_page(), and print_basic_run().
|
static |
The content passed to the function is duplicated with its boxes, font measuring functions are being set.
content | The content to be printed |
settings | The settings for printing to use |
Definition at line 94 of file print.c.
References hlcache_handle_clone(), and printed_content.
Referenced by print_set_up().
struct print_settings * print_make_settings | ( | print_configuration | configuration, |
const char * | filename, | ||
const struct gui_layout_table * | font_func | ||
) |
Generates one of the predefined print settings sets.
Setup print settings for print render operation.
configuration | the requested configuration |
filename | the filename or NULL |
font_func | font handling functions |
Definition at line 254 of file print.c.
References print_settings::copies, DEFAULT_COPIES, DEFAULT_EXPORT_SCALE, DEFAULT_MARGIN_BOTTOM_MM, DEFAULT_MARGIN_LEFT_MM, DEFAULT_MARGIN_RIGHT_MM, DEFAULT_MARGIN_TOP_MM, DEFAULT_PAGE_HEIGHT, DEFAULT_PAGE_WIDTH, print_settings::font_func, MARGINBOTTOM, MARGINLEFT, MARGINRIGHT, print_settings::margins, MARGINTOP, nsoption_int, print_settings::output, print_settings::page_height, print_settings::page_width, PRINT_DEFAULT, PRINT_OPTIONS, print_settings::scale, and settings.
Referenced by ami_print(), pdf_button_clicked_cb(), and print_button_clicked_cb().
bool print_set_up | ( | hlcache_handle * | content, |
const struct printer * | printer, | ||
struct print_settings * | settings, | ||
double * | height | ||
) |
This function prepares the content to be printed.
The current browser content is duplicated and resized, printer initialization is called.
content | The content to be printed |
printer | The printer interface for the printer to be used |
settings | The settings for printing to use |
height | updated to the height of the printed content |
Definition at line 148 of file print.c.
References content_get_height(), done_height, height, print_apply_settings(), printer::print_begin, print_init(), printed_content, and settings.
Referenced by ami_print(), gtk_print_signal_begin_print(), and print_basic_run().
|
static |
Definition at line 49 of file print.c.
Referenced by print_basic_run(), print_draw_next_page(), and print_set_up().
bool html_redraw_printing = false |
Definition at line 51 of file print.c.
Referenced by html_redraw_box(), html_redraw_inline_background(), html_redraw_text_decoration(), print_cleanup(), and print_draw_next_page().
int html_redraw_printing_border = 0 |
Definition at line 52 of file print.c.
Referenced by html_redraw_box(), and print_draw_next_page().
int html_redraw_printing_top_cropped = 0 |
Definition at line 53 of file print.c.
Referenced by html_redraw_box(), and print_draw_next_page().
|
static |
Definition at line 47 of file print.c.
Referenced by print_apply_settings(), and print_draw_next_page().
|
static |
Definition at line 47 of file print.c.
Referenced by print_apply_settings(), and print_draw_next_page().
|
static |
Definition at line 48 of file print.c.
Referenced by print_basic_run(), print_cleanup(), print_draw_next_page(), print_init(), and print_set_up().