From: JazzyNico Date: Fri, 22 Oct 2010 12:48:23 +0000 (+0200) Subject: PDF export. Fix for Bug #664335 (pdf export with cairo 1.10 defaults to version PDF... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9c92239a7a668315b535ea7a960d14a85e969659;p=inkscape.git PDF export. Fix for Bug #664335 (pdf export with cairo 1.10 defaults to version PDF-1.5). --- diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 28d1db9a4..098c56a79 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -108,7 +108,7 @@ static cairo_status_t _write_callback(void *closure, const unsigned char *data, CairoRenderContext::CairoRenderContext(CairoRenderer *parent) : _dpi(72), - _pdf_level(0), + _pdf_level(1), _ps_level(1), _eps(false), _is_texttopath(FALSE), @@ -782,6 +782,9 @@ CairoRenderContext::setupSurface(double width, double height) #ifdef CAIRO_HAS_PDF_SURFACE case CAIRO_SURFACE_TYPE_PDF: surface = cairo_pdf_surface_create_for_stream(Inkscape::Extension::Internal::_write_callback, _stream, width, height); +#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 10, 0)) + cairo_pdf_surface_restrict_to_version(surface, (cairo_pdf_version_t)_pdf_level); +#endif break; #endif #ifdef CAIRO_HAS_PS_SURFACE @@ -791,8 +794,8 @@ CairoRenderContext::setupSurface(double width, double height) return FALSE; } #if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 5, 2)) - cairo_ps_surface_restrict_to_level (surface, (cairo_ps_level_t)_ps_level); - cairo_ps_surface_set_eps (surface, (cairo_bool_t) _eps); + cairo_ps_surface_restrict_to_level(surface, (cairo_ps_level_t)_ps_level); + cairo_ps_surface_set_eps(surface, (cairo_bool_t) _eps); #endif break; #endif diff --git a/src/extension/internal/cairo-renderer-pdf-out.cpp b/src/extension/internal/cairo-renderer-pdf-out.cpp index cacaa03a1..32df1193b 100644 --- a/src/extension/internal/cairo-renderer-pdf-out.cpp +++ b/src/extension/internal/cairo-renderer-pdf-out.cpp @@ -135,11 +135,11 @@ CairoRendererPdfOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, int level = 0; try { new_level = mod->get_param_enum("PDFversion"); -// if((new_level != NULL) && (g_ascii_strcasecmp("PDF-1.x", new_level) == 0)) -// level = 1; + if((new_level != NULL) && (g_ascii_strcasecmp("PDF-1.5", new_level) == 0)) + level = 1; } catch(...) { -// g_warning("Parameter might not exist"); + g_warning("Parameter might not exist"); } bool new_textToPath = FALSE; @@ -237,7 +237,10 @@ CairoRendererPdfOutput::init (void) "Portable Document Format\n" "org.inkscape.output.pdf.cairorenderer\n" "\n" - "<_item value='PDF14'>" N_("PDF 1.4") "\n" +#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 10, 0)) + "<_item value='PDF-1.5'>" N_("PDF 1.5") "\n" +#endif + "<_item value='PDF-1.4'>" N_("PDF 1.4") "\n" "\n" "false\n" "false\n"