NetSurf
save_pdf.c
Go to the documentation of this file.
1/*
2 * Copyright 2008 John Tytgat <joty@netsurf-browser.org>
3 * Copyright 2008 Chris Young <chris@unsatisfactorysoftware.co.uk>
4 *
5 * This file is part of NetSurf, http://www.netsurf-browser.org/
6 *
7 * NetSurf is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * NetSurf is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20/** \file
21 * Export a content as a PDF file (implementation).
22 */
23
24#include "utils/config.h"
25#ifdef WITH_PDF_EXPORT
26
27#include <stdbool.h>
28#include "content/content.h"
29#include "desktop/print.h"
30#include "desktop/save_pdf/font_haru.h"
31#include "desktop/save_pdf/pdf_plotters.h"
32#include "amiga/save_pdf.h"
33#include "utils/log.h"
34#include "utils/config.h"
35
36/**
37 * Export a content as a PDF file.
38 *
39 * \param c content to export
40 * \param path path to save PDF as
41 * \return true on success, false on error and error reported
42 */
43bool save_as_pdf(struct hlcache_handle *c, const char *path)
44{
45 struct print_settings *psettings;
46
47 if(!ami_download_check_overwrite(path, NULL)) return false;
48
50 if (psettings == NULL)
51 return false;
52
53 if (!print_basic_run(c, &pdf_printer, psettings))
54 return false;
55
56 return true;
57}
58
59#endif
Content handling interface.
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.
Definition: print.c:254
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 clea...
Definition: print.c:64
Conception: Generalized output-in-pages.
@ PRINT_OPTIONS
Definition: print.h:45
const struct printer pdf_printer
const struct font_functions haru_nsfont
BOOL ami_download_check_overwrite(const char *file, struct Window *win, ULONG size)
Definition: download.c:481
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
static nserror path(const struct redraw_context *ctx, const plot_style_t *pstyle, const float *p, unsigned int n, const float transform[6])
Plots a path.
Definition: plot.c:821