Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  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.  
  37. #include "css/css.h"
  38.  
  39. struct hlcache_handle;
  40. struct printer;
  41.  
  42. enum { MARGINLEFT = 0, MARGINRIGHT = 1, MARGINTOP = 2, MARGINBOTTOM = 3};
  43.  
  44. /** Predefined printing configuration names*/
  45. typedef enum { PRINT_DEFAULT, PRINT_OPTIONS } print_configuration;
  46.  
  47. /** Settings for a print - filled in by print_make_settings or
  48.  * 'manually' by the caller
  49. */
  50. struct print_settings{
  51.         /*Standard parameters*/
  52.         float page_width, page_height;
  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*/
  63.         const struct font_functions *font_func;
  64. };
  65.  
  66.  
  67. bool print_basic_run(struct hlcache_handle *, const struct printer *,
  68.                 struct print_settings *);
  69. bool print_set_up(struct hlcache_handle *content, const struct printer *printer,
  70.                 struct print_settings *settings, double *height);
  71. bool print_draw_next_page(const struct printer *printer,
  72.                 struct print_settings *settings);
  73. bool print_cleanup(struct hlcache_handle *, const struct printer *,
  74.                 struct print_settings *settings);
  75.  
  76. struct print_settings *print_make_settings(print_configuration configuration,
  77.                 const char *url, const struct font_functions *font_func);
  78.  
  79. /*is the content currently redrawn for printing?*/
  80. extern bool html_redraw_printing;
  81. /*if something is partially under this Y coordinate it won't be drawn...*/
  82. extern int html_redraw_printing_border;
  83. /*...and the highest of the tops of all cropped elements will be remembered*/
  84. extern int html_redraw_printing_top_cropped;
  85.  
  86. #endif
  87.  
  88.