Comment 5 for bug 137944

Revision history for this message
khul (klas-hultqvist) wrote :

I'm not so familiar with using debian packages, but here is the code in xournal-0.4/src/xo-file.c after my changes:

  ppm_name = g_strdup_printf("%s/p-%04d.ppm", bgpdf.tmpdir, req->pageno);
// printf("Child %d finished, should look for %s... \n", pid, ppm_name);

  if (bgpdf.status == STATUS_ABORTED || bgpdf.status == STATUS_SHUTDOWN)
     pixbuf = NULL;
  else {
     pixbuf = gdk_pixbuf_new_from_file(ppm_name, NULL);
     if(pixbuf == NULL) {
       ppm_name = g_strdup_printf("%s/p-%03d.ppm", bgpdf.tmpdir, req->pageno);
       pixbuf = gdk_pixbuf_new_from_file(ppm_name, NULL);
     }
     if(pixbuf == NULL) {
       ppm_name = g_strdup_printf("%s/p-%02d.ppm", bgpdf.tmpdir, req->pageno);
       pixbuf = gdk_pixbuf_new_from_file(ppm_name, NULL);
     }
     if(pixbuf == NULL) {
       ppm_name = g_strdup_printf("%s/p-%01d.ppm", bgpdf.tmpdir, req->pageno);
       pixbuf = gdk_pixbuf_new_from_file(ppm_name, NULL);
     }
  }

It's pretty clumsy, and assumes no more than 9999 pages.