1
/* This file is part of Libspectre.
3
* Copyright (C) 2007 Albert Astals Cid <aacid@kde.org>
4
* Copyright (C) 2007 Carlos Garcia Campos <carlosgc@gnome.org>
6
* Libspectre 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; either version 2, or (at your option)
11
* Libspectre 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.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23
#include "spectre-private.h"
26
spectre_exporter_ps_begin (SpectreExporter *exporter,
29
exporter->from = fopen (exporter->doc->filename, "r");
31
return SPECTRE_STATUS_EXPORTER_ERROR;
33
exporter->to = fopen (filename, "w");
35
fclose (exporter->from);
36
exporter->from = NULL;
37
return SPECTRE_STATUS_EXPORTER_ERROR;
40
pscopyheaders (exporter->from, exporter->to, exporter->doc);
42
return SPECTRE_STATUS_SUCCESS;
46
spectre_exporter_ps_do_page (SpectreExporter *exporter,
47
unsigned int page_index)
49
if (exporter->doc->numpages <= 0)
50
return SPECTRE_STATUS_SUCCESS;
52
pscopypage (exporter->from, exporter->to, exporter->doc,
53
page_index, exporter->n_pages++);
55
return SPECTRE_STATUS_SUCCESS;
59
spectre_exporter_ps_end (SpectreExporter *exporter)
61
pscopytrailer (exporter->from, exporter->to, exporter->doc,
64
fclose (exporter->from);
65
exporter->from = NULL;
66
fclose (exporter->to);
69
return SPECTRE_STATUS_SUCCESS;
73
_spectre_exporter_ps_new (struct document *doc)
75
SpectreExporter *exporter;
77
exporter = calloc (1, sizeof (SpectreExporter));
81
exporter->doc = psdocreference (doc);
83
exporter->begin = spectre_exporter_ps_begin;
84
exporter->do_page = spectre_exporter_ps_do_page;
85
exporter->end = spectre_exporter_ps_end;