Giter Site home page Giter Site logo

mupdfpage's Introduction

*Update: Wed May 15 2013*

Finally added a patch script. To build,

   git clone --recursive git://git.ghostscript.com/mupdf.git
   cd mupdf
   mv path-to-mupdfPage .
   mupdfPage/patch.sh

On success, make && make install.

Note that Makefile generates debug version on default, so you'd
probably want:

build=release make

***********************

MuPDF doesn't support page number saving/loading when exiting a
file and re-opening a file. The software is designed to be dead
simple without any config files, but I decided that saving page
numbers is a great convenience. So I added a couple of functions to
do this, in 'pdfpage.h', and modified a few lines in pdfapp.c to
achieve autosaving before exiting and autoloading before opening.

The hack was done on a git version as of Jun 25 afternoon, and the
"pdfapp.c" file in "apps" directory was forever changing, thus it's
not feasible to create a patch. The edits in pdfapp.c are listed as
follows (the lines are inaccurate, but I try to make it easy to
find here. I am too lazy to sed, which may not be safe after
revisions):

1. in about line 79:
void pdfapp_init(fz_context *ctx, pdfapp_t *app)
**add line**
history_File = strcat(getenv("HOME"),"/.mupdf_history");
**before the first statement:**
memset(app, 0, sizeof(pdfapp_t));
**This initializes history file.**

2. At the end of function (about line 151)
void pdfapp_open(pdfapp_t *app, char *filename, int reload)
**add line**
app->pageno = readEntry(app->doctitle);
**before last statement:**
pdfapp_showpage(app, 1, 1, 1);
**This tries to find an old entry of page number in the history file.**

3. About line 721, after
switch (c)
{
   case 'q':
	winclose(app);
	break;
**add line**
	writeEntry(app->doctitle, app->pageno);
**before line**
	winclose(app);
**This saves page number before exit application.**

4. Add header 
#include "pdfpage.h"

mupdfpage's People

Contributors

kaikaizi avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.