NetSurf
print.h
Go to the documentation of this file.
1/*
2 * Copyright 2008 Adam Blokus <adamblokus@gmail.com>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/** \file
20 * Conception:
21 * Generalized output-in-pages. Allows the current content to be 'printed':
22 * either into a pdf file (any other later?) or to any kind of other output
23 * destination that divides the website into pages - as a printer.
24 * The basic usage is calling print_basic_run which sets everything up,
25 * prints page after page until the whole content is printed and cleans
26 * everyting up.
27 * If there are any other, printer specific routines to be performed in the
28 * meantime - there can be set up any other printing funcion, which can use
29 * print_set_up, print_draw_next_page and print_cleanup directly.
30*/
31
32#ifndef NETSURF_DESKTOP_PRINT_H
33#define NETSURF_DESKTOP_PRINT_H
34
35#include <stdbool.h>
36#include <libcss/libcss.h>
37
38struct hlcache_handle;
39struct printer;
40struct gui_layout_table;
41
42enum { MARGINLEFT = 0, MARGINRIGHT = 1, MARGINTOP = 2, MARGINBOTTOM = 3};
43
44/** Predefined printing configuration names*/
46
47/** Settings for a print - filled in by print_make_settings or
48 * 'manually' by the caller
49*/
51 /*Standard parameters*/
53 css_fixed margins[4];
54
55 float scale;
56
57 unsigned int copies;
58
59 /*Output destinations - file/printer name*/
60 const char *output;
61
62 /*the functions used to measure fonts*/
64
65 /* Private data for the plotter context */
66 void *priv;
67};
68
69
70bool print_basic_run(struct hlcache_handle *, const struct printer *,
71 struct print_settings *);
72bool print_set_up(struct hlcache_handle *content, const struct printer *printer,
73 struct print_settings *settings, double *height);
74bool print_draw_next_page(const struct printer *printer,
75 struct print_settings *settings);
76bool print_cleanup(struct hlcache_handle *, const struct printer *,
77 struct print_settings *settings);
78
79/**
80 * Setup print settings for print render operation.
81 */
82struct print_settings *print_make_settings(print_configuration configuration, const char *url, const struct gui_layout_table *font_func);
83
84/*is the content currently redrawn for printing?*/
85extern bool html_redraw_printing;
86/*if something is partially under this Y coordinate it won't be drawn...*/
88/*...and the highest of the tops of all cropped elements will be remembered*/
90
91#endif
92
bool html_redraw_printing
Definition: print.c:51
int html_redraw_printing_border
Definition: print.c:52
print_configuration
Predefined printing configuration names.
Definition: print.h:45
@ PRINT_DEFAULT
Definition: print.h:45
@ PRINT_OPTIONS
Definition: print.h:45
int html_redraw_printing_top_cropped
Definition: print.c:53
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.
Definition: print.c:176
struct print_settings * print_make_settings(print_configuration configuration, const char *url, const struct gui_layout_table *font_func)
Setup print settings for print render operation.
Definition: print.c:254
@ MARGINLEFT
Definition: print.h:42
@ MARGINTOP
Definition: print.h:42
@ MARGINRIGHT
Definition: print.h:42
@ MARGINBOTTOM
Definition: print.h:42
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.
Definition: print.c:148
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 clea...
Definition: print.c:64
bool print_cleanup(struct hlcache_handle *, const struct printer *, struct print_settings *settings)
Memory allocated during printing is being freed here.
Definition: print.c:228
static struct print_settings * settings
Definition: print.c:50
int height
Definition: gui.c:161
Content which corresponds to a single URL.
High-level cache handle.
Definition: hlcache.c:66
Settings for a print - filled in by print_make_settings or 'manually' by the caller.
Definition: print.h:50
float scale
Definition: print.h:55
const struct gui_layout_table * font_func
Definition: print.h:63
float page_width
Definition: print.h:52
float page_height
Definition: print.h:52
void * priv
Definition: print.h:66
unsigned int copies
Definition: print.h:57
css_fixed margins[4]
Definition: print.h:53
const char * output
Definition: print.h:60
Printer interface.
Definition: printer.h:34