summaryrefslogtreecommitdiff
path: root/src/book.c
diff options
context:
space:
mode:
authorAlessio Treglia <alessio@debian.org>2010-10-26 17:12:57 +0200
committerAlessio Treglia <alessio@debian.org>2010-10-26 17:12:57 +0200
commit4464130722661bc4c06da3ac447f16f3171711b2 (patch)
tree1e0d470ab19bb9e47c535c63618015dd1a6bb3a0 /src/book.c
parent24e91aad73752189398ad589362a12408ff3bdbc (diff)
parentfafc0daa6bd26ad254943315f253b1b218e71080 (diff)
Merge commit 'upstream/2.32.0.1'
Diffstat (limited to 'src/book.c')
-rw-r--r--src/book.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/book.c b/src/book.c
index b3ec0b6..aced0ad 100644
--- a/src/book.c
+++ b/src/book.c
@@ -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);