summaryrefslogtreecommitdiff
path: root/pdf
AgeCommit message (Collapse)Author
2012-06-25Fix warnings/compile error on linux.Robin Watts
min is a windows only define.
2012-06-25Forms: handle clicking on one of a group of like-named check boxesPaul Gardiner
All of the group are updated which can make them act like radio buttons in the case that all have different "on" values
2012-06-22Forms support: correctly locate the field dictionary when setting valuePaul Gardiner
Some fields have separate widget annotations. Some have the widget rolled in. This commit correctly identifies the field when setting the field value, thus fixing bug 693145
2012-06-22Forms: implement appearance synthesis for combed textPaul Gardiner
2012-06-22Rework pdf_lexbuf to allow for dynamic parsing buffers.Robin Watts
Currently pdf_lexbufs use a static scratch buffer for parsing. In the main case this is 64K in size, but in other cases it can be just 256 bytes; this causes problems when parsing long strings. Even the 64K limit is an implementation limit of Acrobat, not an architectural limit of PDF. Change here to allow dynamic buffers. This means a slightly more complex setup and destruction for each buffer, but more importantly requires correct cleanup on errors. To avoid having to insert lots more try/catch clauses this commit includes various changes to the code so we reuse pdf_lexbufs where possible. This keeps the speed up.
2012-06-21Add fz_buffer_cat_pdf_string function to avoid Bug 693143.Robin Watts
Avoid overflowing fz_buffer_printf by using a dedicated string output function; this also solves potential problems with us not escaping chars in strings correctly. Unfortunately this doesn't completely cure the bug as we run straight into problems in the lexer.
2012-06-21Forms; Improve text positioning in single-line text widgetsPaul Gardiner
This fixes bug 693126
2012-06-21Forms: implement javascript "color" convenience object (fixes bug 693130)Paul Gardiner
2012-06-21Forms: handle exclusivity of radio buttons. Fixes bug 693125Paul Gardiner
2012-06-21Forms: implement the ResetForm actionPaul Gardiner
This fixes the problem with the test file in bug 693125, although it doesn't make radio buttons act correctly. The file, rather than using radio buttons, was actually using check boxes with a reset-form action to achieve the exclusivity.
2012-06-21Forms: permit annotations with no appearance streamPaul Gardiner
We now create pdf_annot objects for PDF annotations even if they have no appearance stream (i.e. even if invisible). That is necessary because even invisible annotations can be targets of user interaction. This is at least a partial fix for bug 693131
2012-06-20Various fixes to pdf forms stuff found while compiling for linux.Robin Watts
Mostly char * <-> unsigned char * conversions.
2012-06-20Reduce amount of boiler plate by casting function pointers to void*.Tor Andersson
Remove the shim indirection layer for fz_document. A little less type safe, but a lot less boiler plate.
2012-06-20Add better mechanism for enumerating annotation rectangles.Robin Watts
Rather than having a dedicated call to enumerate the rectangles for the annotations on a page, add an interface for enumerating annotations with accessor functions. Currently the only accessor function is the one to get the annotation rectangle. Use this new scheme in place of fz_bound_annots within mudraw. Also use this scheme to set the caret cursor in the viewer when over a data field.
2012-06-19Avoid lots of const warnings.Robin Watts
Add/Remove a few consts to pacify MSVC.
2012-06-19Fix bug 693133: MuPDF forms support: Text incorrectly transformedPaul Gardiner
Refactor the text-widget updating code to use the later-written, button-updating technique, which accounts for rotation. Also now delays generation of appearance streams until required for rendering.
2012-06-18Forms: fix potential SEGVPaul Gardiner
2012-06-15Move javascript loading after encryption/repair has been done.Robin Watts
Currently we were attempting to load the javascript for a document immediately on opening it. Here we delay it until 1) the encryption for a document has been loaded, and 2) any repair required to a document has been done. This solves various problems, which were leading (indirectly) to bug 693128.
2012-06-15Fix bug 693128: MuPDF forms support: crash on button clickPaul Gardiner
Fix one pdf_js function that didn't protect agains doc->js == NULL. Also change exception handling in pdf_new_js so that it doesn't abort just because of a single failed stream load.
2012-06-15Forms: Assume black if default appearance doesn't specify a colorPaul Gardiner
2012-06-14Add -j flag to mudraw; create simple mujstest scripts automatically.Robin Watts
We add a new fz_bound_annots function (and associated pdf_bound_annots function) that calls a given callback with the page rectangle of the annotations on a given page. This is marked as being a 'temporary' function, so we can remove it/change it in future if required. It seems likely that we'll want to have some sort of 'iterate over annotations' function eventually, and this does the job for now. Add a -j flag to mudraw that outputs a simple mujstest script. For each page with annotations, the script jumps to that page, then for each annotation on the page, it sets some text to be entered, and clicks the annotation. In the case of text fields, this will cause the text to be entered into that text field; in the case of buttons it will execute the button. At the end of each page with annotations, the script is told to snapshot the page. These test scripts are not designed to be full tests, but they do at least provide an easy way for us to generate scripts where every field in our test suite is interacted with.
2012-06-14Fix problem in text_splitter (badly initialised max_lines)Robin Watts
Testing tests_private/v1.3/09+20anim+20fx-fo-dx-adr-mx.pdf with mujstest shows an infinite loop due to an initialisation that uses FLT_MAX rather than INT_MAX. Even using INT_MAX still shows problems until a cast is added.
2012-06-13Tweak pdf_new_{rect,matrix,xobject} to avoid warnings.Robin Watts
These functions currently call pdf_array_put, but this fails to extend the array. Change to use pdf_array_push instead.
2012-06-13Merge branch 'master' into formsPaul Gardiner
2012-06-13Remove unnecessary function and improve namingPaul Gardiner
2012-06-13Merge branch 'master' into formsPaul Gardiner
Conflicts: fitz/fitz-internal.h fitz/stm_buffer.c pdf/mupdf-internal.h
2012-06-12A few general utility functions added for the sake of the forms workPaul Gardiner
2012-06-12Forms: handle carriage control in multiline text widgetPaul Gardiner
2012-06-12Forms: improved handling of text scaling in multiline text widgetsPaul Gardiner
2012-06-12Followup to commit 120dadb; improved error handling during interpretation.Robin Watts
After commit 120dadb, it's far too easy to get into a seemingly infinite loop while processing a corrupt file. We fix this by changing the process to abort when we receive an invalid keyword. Also, we add another layer of nesting to pdf_run_stream to avoid us push/popping an fz_try level on every keyword.
2012-06-11Fix Bug 693099: Render failure due to corrupt jpeg data.Robin Watts
The file supplied with the bug contains corrupt jpeg data on page 61. This causes an error to be thrown which results in mudraw exiting. Previously, when image decode was done at loading time, the error would have been thrown under the pdf interpreter rather than under the display list renderer. This error would have been caught, a warning given, and the program would have continued. This is not ideal behaviour, as there is no way for a caller to know that there was a problem, and that the image is potentially incomplete. The solution adopted here, solves both these problems. The fz_cookie structure is expanded to include a 'errors' count. Whenever we meet an error during rendering, we increment the 'errors' count, and continue. This enables applications to spot the errors count being non-zero on exit and to display a warning. mupdf is updated here to pass a cookie in and to check the error count at the end; if it is found to be non zero, then a warning is given (just once per visit to each page) to say that the page may have errors on it.
2012-06-11Forms: first version appearance synthesis for multiline text widgetsPaul Gardiner
2012-06-07Forms: avoid repeated parsing of default appearance stringPaul Gardiner
Also consolidate text widget info, plus general tidying
2012-06-04Forms: measure text using the info from the font descriptorPaul Gardiner
Previously measured by rendering to the bounding box device
2012-06-01Merge branch 'master' into formsPaul Gardiner
Conflicts: fitz/doc_document.c fitz/fitz-internal.h fitz/fitz.h fitz/stm_buffer.c pdf/mupdf-internal.h pdf/pdf_object.c pdf/pdf_xobject.c pdf/pdf_xref.c win32/mupdf.sln
2012-05-31A few general utility functions added for the sake of the forms workPaul Gardiner
2012-05-31Add linearization to pdf_write function.Robin Watts
Extend mupdfclean to have a new -l file that writes the file linearized. This should still be considered experimental When writing a pdf file, analyse object use, flatten resource use, reorder the objects, generate a hintstream and output with linearisaton parameters. This is enough for Acrobat to accept the file as being optimised for Fast Web View. We ought to add more tables to the hintstream in some cases, but I doubt anyone actually uses it, the spec is so badly written. Certainly acrobat accepts the file as being optimised for 'Fast Web View'. Update fz_dict_put to allow for us adding a reference to the dictionary that is the sole owner of that reference already (i.e. don't drop then keep something that has a reference count of just 1). Update pdf_load_image_stream to use the stm_buf from the xref if there is one. Update pdf_close_document to discard any stm_bufs it may be holding. Update fz_dict_put to be pdf_dict_put - this was missed in a renaming ages ago and has been inconsistent since.
2012-05-28Forms: implement JavaScript Field methods setFillColor and setTextColorPaul Gardiner
2012-05-25Forms: additions necessary to make toggle-button example workPaul Gardiner
Add to DOM field borderStyle and buttonSetCaption Introduce event object Add border helper object Fix v8 problem to do with access to external pointers
2012-05-24Forms: synthesise push button widgetPaul Gardiner
2012-05-23Bring xref object and stream mutation functions back from the dead.Tor Andersson
Needs more work to use the linked list of free xref slots.
2012-05-16JavaScript: provide mechanism via which C++ js engines can fz_throw errorsPaul Gardiner
2012-05-15Add a dummy pdf_js implementation for use in non-form-supporting buildsPaul Gardiner
The calc.pdf specific version of pdf_jsimp is no longer needed and hence dropped.
2012-05-15JavaScript: arrange for v8 gc to destroy native-side objectsPaul Gardiner
2012-05-15Forms: make forms API separate to the main document APIPaul Gardiner
This also provides a way to test whether interactive methods are supported.
2012-05-11Split part of fz_document interface for pdf_document into separate file.Tor Andersson
Make a separate constructor function that does not link in the interpreter, so we can save space in the mubusy binary by not including the font and cmap resources.
2012-05-10Combine all small tools into mubusy and remove the separate executables.Tor Andersson
2012-05-10Fix whitespace errors.Tor Andersson
2012-05-10mupdfclean - update to allow renumbering of encrypted objectsRobin Watts
mupdfclean (or more correctly, the pdf_write function) currently has a limitation, in that we cannot renumber objects when encryption is being used. This is because the object/generation number is pickled into the stream, and renumbering the object causes it to become unreadable. The solution used here is to provide extended functions that take both the object/generation number and the original object/generation number. The original object numbers are only used for setting up the encryption. pdf_write now keeps track of the original object/generation number for each object. This fix is important, if we ever want to output linearized pdf as this requires us to be able to renumber objects to a very specific order. We also make a fix in removeduplicateobjects that should only matter in the case where we fail to read an object correctly.
2012-05-08Bug 693028 - improve mupdf viewer handling of broken page streamsRobin Watts
Currently, if a page stream cannot be read, mupdf gives an alert box and then exits. This is annoying when reading a large pdf. Here we change the code to only exit if a page is completely broken; in the case of missing page contents, or missing links, we give a warning and just render the best we can. Also, update a couple of error messages to be less misleading.