diff options
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); |