NetSurf
Data Structures | Enumerations | Functions | Variables
print.h File Reference

Conception: Generalized output-in-pages. More...

#include <stdbool.h>
#include <libcss/libcss.h>
Include dependency graph for print.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  print_settings
 Settings for a print - filled in by print_make_settings or 'manually' by the caller. More...
 

Enumerations

enum  { MARGINLEFT = 0 , MARGINRIGHT = 1 , MARGINTOP = 2 , MARGINBOTTOM = 3 }
 
enum  print_configuration { PRINT_DEFAULT , PRINT_OPTIONS }
 Predefined printing configuration names. More...
 

Functions

bool print_basic_run (struct hlcache_handle *, const struct printer *, struct print_settings *)
 This function calls print setup, prints page after page until the whole content is printed calls cleaning up afterwise. More...
 
bool print_set_up (struct 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 (struct hlcache_handle *, const struct printer *, struct print_settings *settings)
 Memory allocated during printing is being freed here. More...
 
struct print_settingsprint_make_settings (print_configuration configuration, const char *url, const struct gui_layout_table *font_func)
 Setup print settings for print render operation. More...
 

Variables

bool html_redraw_printing
 
int html_redraw_printing_border
 
int html_redraw_printing_top_cropped
 

Detailed Description

Conception: Generalized output-in-pages.

Allows the current content to be 'printed': either into a pdf file (any other later?) or to any kind of other output destination that divides the website into pages - as a printer. The basic usage is calling print_basic_run which sets everything up, prints page after page until the whole content is printed and cleans everyting up. If there are any other, printer specific routines to be performed in the meantime - there can be set up any other printing funcion, which can use print_set_up, print_draw_next_page and print_cleanup directly.

Definition in file print.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MARGINLEFT 
MARGINRIGHT 
MARGINTOP 
MARGINBOTTOM 

Definition at line 42 of file print.h.

◆ print_configuration

Predefined printing configuration names.

Enumerator
PRINT_DEFAULT 
PRINT_OPTIONS 

Definition at line 45 of file print.h.

Function Documentation

◆ print_basic_run()

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.

Parameters
contentThe content to be printed
printerThe printer interface for the printer to be used
settingsThe settings for printing to use
Returns
true if successful, false otherwise

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_cleanup()

bool print_cleanup ( hlcache_handle content,
const struct printer printer,
struct print_settings settings 
)

Memory allocated during printing is being freed here.

Parameters
contentThe original content
printerThe printer interface for the printer to be used
settingsThe print settings to use.
Returns
true if successful, false otherwise

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_draw_next_page()

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.

Parameters
printerThe printer interface for the printer to be used
settingsThe settings for printing to use
Returns
true if successful, false otherwise

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_make_settings()

struct print_settings * print_make_settings ( print_configuration  configuration,
const char *  filename,
const struct gui_layout_table font_func 
)

Setup print settings for print render operation.

Setup print settings for print render operation.

Parameters
configurationthe requested configuration
filenamethe filename or NULL
font_funcfont handling functions
Returns
print_settings in case if successful, NULL if unknown configuration or lack of memory.

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().

Here is the caller graph for this function:

◆ print_set_up()

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.

Parameters
contentThe content to be printed
printerThe printer interface for the printer to be used
settingsThe settings for printing to use
heightupdated to the height of the printed content
Returns
true if successful, false otherwise

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().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ html_redraw_printing

bool html_redraw_printing
extern

◆ html_redraw_printing_border

int html_redraw_printing_border
extern

Definition at line 52 of file print.c.

Referenced by html_redraw_box(), and print_draw_next_page().

◆ html_redraw_printing_top_cropped

int html_redraw_printing_top_cropped
extern

Definition at line 53 of file print.c.

Referenced by html_redraw_box(), and print_draw_next_page().