diff options
author | Alessio Treglia <alessio@debian.org> | 2010-10-26 17:12:56 +0200 |
---|---|---|
committer | Alessio Treglia <alessio@debian.org> | 2010-10-26 17:12:56 +0200 |
commit | fafc0daa6bd26ad254943315f253b1b218e71080 (patch) | |
tree | 2d09b07a68c0236fe5b0b7a4ebdb630c96610b4d /src/book.c | |
parent | 516b7d5c6b94b4496609a4a758c21d0cdc2bbfa2 (diff) |
Imported Upstream version 2.32.0.1upstream/2.32.0.1
Diffstat (limited to 'src/book.c')
-rw-r--r-- | src/book.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -454,7 +454,7 @@ book_save_pdf (Book *book, GFile *file, GError **error) Page *page; GdkPixbuf *image; guchar *pixels, *data, *compressed_data; - gchar *command; + gchar *command, width_buffer[G_ASCII_DTOSTR_BUF_SIZE], height_buffer[G_ASCII_DTOSTR_BUF_SIZE]; const gchar *color_space, *filter = NULL; float page_width, page_height; @@ -620,7 +620,9 @@ book_save_pdf (Book *book, GFile *file, GError **error) pdf_printf (writer, "/Type /Page\n"); pdf_printf (writer, "/Parent %d 0 R\n", pages_number); pdf_printf (writer, "/Resources << /XObject << /Im%d %d 0 R >> >>\n", i, number+1); - pdf_printf (writer, "/MediaBox [ 0 0 %.2f %.2f ]\n", page_width, page_height); + pdf_printf (writer, "/MediaBox [ 0 0 %s %s ]\n", + g_ascii_formatd (width_buffer, sizeof (width_buffer), "%.2f", page_width), + g_ascii_formatd (height_buffer, sizeof (height_buffer), "%.2f", page_height)); pdf_printf (writer, "/Contents %d 0 R\n", number+2); pdf_printf (writer, ">>\n"); pdf_printf (writer, "endobj\n"); @@ -649,9 +651,12 @@ book_save_pdf (Book *book, GFile *file, GError **error) /* Page contents */ command = g_strdup_printf ("q\n" - "%f 0 0 %f 0 0 cm\n" + "%s 0 0 %s 0 0 cm\n" "/Im%d Do\n" - "Q", page_width, page_height, i); + "Q", + g_ascii_formatd (width_buffer, sizeof (width_buffer), "%f", page_width), + g_ascii_formatd (height_buffer, sizeof (height_buffer), "%f", page_height), + i); pdf_printf (writer, "\n"); number = pdf_start_object (writer); pdf_printf (writer, "%d 0 obj\n", number); |