~ubuntu-branches/ubuntu/precise/inkscape/precise-updates

« back to all changes in this revision

Viewing changes to src/extension/internal/cairo-renderer-pdf-out.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alex Valavanis
  • Date: 2010-09-12 19:44:58 UTC
  • mfrom: (1.1.12 upstream) (45.1.3 maverick)
  • Revision ID: james.westby@ubuntu.com-20100912194458-4sjwmbl7dlsrk5dc
Tags: 0.48.0-1ubuntu1
* Merge with Debian unstable (LP: #628048, LP: #401567, LP: #456248, 
  LP: #463602, LP: #591986)
* debian/control: 
  - Ubuntu maintainers
  - Promote python-lxml, python-numpy, python-uniconvertor to Recommends.
  - Demote pstoedit to Suggests (universe package).
  - Suggests ttf-dejavu instead of ttf-bitstream-vera (LP: #513319)
* debian/rules:
  - Run intltool-update on build (Ubuntu-specific).
  - Add translation domain to .desktop files (Ubuntu-specific).
* debian/dirs:
  - Add usr/share/pixmaps.  Allow inkscape.xpm installation
* drop 50-poppler-API.dpatch (now upstream)
* drop 51-paste-in-unwritable-directory.dpatch (now upstream) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 * Authors:
6
6
 *   Ted Gould <ted@gould.cx>
7
7
 *   Ulf Erikson <ulferikson@users.sf.net>
 
8
 *   Johan Engelen <goejendaagh@zonnet.nl>
8
9
 *
9
 
 * Copyright (C) 2004-2006 Authors
 
10
 * Copyright (C) 2004-2010 Authors
10
11
 *
11
12
 * Released under GNU GPL, read the file 'COPYING' for more information
12
13
 */
20
21
#include "cairo-renderer-pdf-out.h"
21
22
#include "cairo-render-context.h"
22
23
#include "cairo-renderer.h"
 
24
#include "latex-text-renderer.h"
23
25
#include <print.h>
24
26
#include "extension/system.h"
25
27
#include "extension/print.h"
33
35
#include "sp-item.h"
34
36
#include "sp-root.h"
35
37
 
 
38
#include <2geom/matrix.h>
 
39
 
36
40
namespace Inkscape {
37
41
namespace Extension {
38
42
namespace Internal {
48
52
 
49
53
static bool
50
54
pdf_render_document_to_file(SPDocument *doc, gchar const *filename, unsigned int level,
51
 
                            bool texttopath, bool filtertobitmap, int resolution,
 
55
                            bool texttopath, bool omittext, bool filtertobitmap, int resolution,
52
56
                            const gchar * const exportId, bool exportDrawing, bool exportCanvas)
53
57
{
54
58
    sp_document_ensure_up_to_date(doc);
83
87
    CairoRenderContext *ctx = renderer->createContext();
84
88
    ctx->setPDFLevel(level);
85
89
    ctx->setTextToPath(texttopath);
 
90
    renderer->_omitText = omittext;
86
91
    ctx->setFilterToBitmap(filtertobitmap);
87
92
    ctx->setBitmapResolution(resolution);
88
93
 
106
111
    return ret;
107
112
}
108
113
 
109
 
 
110
114
/**
111
115
    \brief  This function calls the output module with the filename
112
116
    \param  mod   unused
146
150
        g_warning("Parameter <textToPath> might not exist");
147
151
    }
148
152
 
 
153
    bool new_textToLaTeX  = FALSE;
 
154
    try {
 
155
        new_textToLaTeX  = mod->get_param_bool("textToLaTeX");
 
156
    }
 
157
    catch(...) {
 
158
        g_warning("Parameter <textToLaTeX> might not exist");
 
159
    }
 
160
 
149
161
    bool new_blurToBitmap  = FALSE;
150
162
    try {
151
163
        new_blurToBitmap  = mod->get_param_bool("blurToBitmap");
186
198
        g_warning("Parameter <exportCanvas> might not exist");
187
199
    }
188
200
 
189
 
    gchar * final_name;
190
 
    final_name = g_strdup_printf("> %s", filename);
191
 
    ret = pdf_render_document_to_file(doc, final_name, level,
192
 
                                      new_textToPath, new_blurToBitmap, new_bitmapResolution,
193
 
                                      new_exportId, new_exportDrawing, new_exportCanvas);
194
 
    g_free(final_name);
195
 
 
196
 
    if (!ret)
197
 
        throw Inkscape::Extension::Output::save_failed();
 
201
    // Create PDF file
 
202
    {
 
203
        gchar * final_name;
 
204
        final_name = g_strdup_printf("> %s", filename);
 
205
        ret = pdf_render_document_to_file(doc, final_name, level,
 
206
                                          new_textToPath, new_textToLaTeX, new_blurToBitmap, new_bitmapResolution,
 
207
                                          new_exportId, new_exportDrawing, new_exportCanvas);
 
208
        g_free(final_name);
 
209
 
 
210
        if (!ret)
 
211
            throw Inkscape::Extension::Output::save_failed();
 
212
    }
 
213
 
 
214
    // Create LaTeX file (if requested)
 
215
    if (new_textToLaTeX) {
 
216
        ret = latex_render_document_text_to_file(doc, filename, new_exportId, new_exportDrawing, new_exportCanvas, true);
 
217
 
 
218
        if (!ret)
 
219
            throw Inkscape::Extension::Output::save_failed();
 
220
    }
198
221
}
199
222
 
200
223
#include "clear-n_.h"
217
240
                                "<_item value='PDF14'>" N_("PDF 1.4") "</_item>\n"
218
241
                        "</param>\n"
219
242
                        "<param name=\"textToPath\" gui-text=\"" N_("Convert texts to paths") "\" type=\"boolean\">false</param>\n"
 
243
                        "<param name=\"textToLaTeX\" gui-text=\"" N_("PDF+LaTeX: Omit text in PDF, and create LaTeX file") "\" type=\"boolean\">false</param>\n"
220
244
                        "<param name=\"blurToBitmap\" gui-text=\"" N_("Rasterize filter effects") "\" type=\"boolean\">true</param>\n"
221
245
                        "<param name=\"resolution\" gui-text=\"" N_("Resolution for rasterization (dpi)") "\" type=\"int\" min=\"1\" max=\"10000\">90</param>\n"
222
246
                        "<param name=\"areaDrawing\" gui-text=\"" N_("Export area is drawing") "\" type=\"boolean\">false</param>\n"