summaryrefslogtreecommitdiff
path: root/pdf
AgeCommit message (Collapse)Author
2013-06-20Rearrange source files.Tor Andersson
2013-06-19Exception handling changesRobin Watts
In preparation for work on progressive loading, update the exception handling scheme slightly. Until now, exceptions (as thrown with fz_throw, and caught with fz_try/fz_catch) have merely had an informative string. They have never had anything that can be compared to see if an error is of a particular type. We now introduce error codes; when we fz_throw, we now always give an error code, and can optionally (using fz_throw_message) give both an error code and an informative string. When we fz_rethrow from within a fz_catch, both the error code and the error message is maintained. Using fz_rethrow_message we can 'improve' the error message, but the code is maintained. The error message can be read out using fz_caught_message() and the error code can be read as fz_caught(). Currently we only define a 'generic' error. This will expand in future versions to include other error types that may be tested for.
2013-06-19Fix win32, with-openssl buildPaul Gardiner
Also correct a comment
2013-06-18Fix win32 and javascript build.Tor Andersson
2013-06-18Add gen_ prefix to generated header files.Tor Andersson
2013-06-18Split pdf.h into subheaders.Tor Andersson
2013-06-18Merge common and internal headers into one.Tor Andersson
2013-06-18Move header files into separate include directory.Tor Andersson
2013-06-17Tweaks to ink annotation for smoothness.Paul Gardiner
Patch from "andyhan2000" to make the ink annotations smoother.
2013-06-13Bug 694313: Fix potential double frees of objectsRobin Watts
Thanks to zeniko for spotting these.
2013-06-13Fix typos in comments.Robin Watts
Spotted by Vincent Torri. Many thanks!
2013-06-13Make display lists reference counted objects.Robin Watts
Remove fz_free_display_list from the API; instead use fz_drop_display_list.
2013-06-13Remove stray code from last commit.Robin Watts
When creating the previous commit, I considered an alternative way of working. While we didn't use this in the end, I forgot to remove it from the code before committing. Stripping it out here. Sorry.
2013-06-13Bug 694303: Fix various problems in pdf parsingRobin Watts
Spot a 'startxref' of 0 as being an error; otherwise the code falls through and we SEGV. Also update the pdf_repair_obj function to cope better with the new way we parse ints. Previously we parsed ints into the buffer and atoi'd them there - to step backwards over the int was therefore a matter of stepping backwards over the specified number of chars. In the 'new' code (now quite old) we parse ints directly, hence we cannot do this stepping back. Also, stepping backwards by more than 1 byte is risky anyway. We therefore adopt a smarter approach of returning the next lexed token from pdf_repair_obj. Thanks to zeniko for reporting these problems and providing a test file.
2013-06-09Remove fz_interactive API in favour of direct use of pdf APIPaul Gardiner
2013-06-08Remove debug prints from the file spec parsing codeSebastian Rasmussen
2013-06-05Maintain the separation of xref sections when loading a documentPaul Gardiner
Also on first alteration create a further section to hold the updates. This is in preparation for supporting incemental update.
2013-06-05Rework the xref loading code in preparation for separately holding sectionsPaul Gardiner
Now directly read the sections handling trailers as we go, rather than processing the most-recent trailer up front. Handle XRefStm separately from the main section-loading loop so as to ignore Prev when it occurs in a XRefStm (as specified in the spec). That has the side-effect of avoiding recursion.
2013-06-03prevent deadlock under memory pressurezeniko
In multiple places, between acquiring and releasing the FREETYPE lock, exceptions may be thrown which aren't caught in order to properly release the lock. This patch introduces the necessary fz_try/fz_always/ fz_catch invocations to prevent a potential deadlock in these situations. RJW: Also fix another problem pointed out by zeniko. Thanks!
2013-06-03Improve rendering of fts_15_1506.pdfRobin Watts
Negative xstep or ysteps cause problems.
2013-06-03Parse full PDF filespecs, not just filenamesSebastian Rasmussen
2013-06-03Do not print invalid hex character in warningSebastian Rasmussen
This means that warnings can now be rate limited.
2013-05-30Add functions to return digital signature infoPaul Gardiner
2013-05-29Access the xref table via an interfacePaul Gardiner
Avoid all direct access to the xref table so that the impementation can be altered to add new features
2013-05-29Access the trailer via an interfacePaul Gardiner
2013-05-29Killed pdf_cmap_token enum.Tor Andersson
2013-05-29Silence warnings.Tor Andersson
2013-05-27Solve fuzzing SEGV due to negative object number in xref.Robin Watts
2013-05-27Strip trailing whitespace.Tor Andersson
2013-05-16Add colorspace context.Tor Andersson
To prepare for color management, we have to make the device colorspaces per-context and able to be overridden by users.
2013-05-16Fix off by one error in xref resizing.Robin Watts
Found by zeniko in his fuzzing tests. Many thanks!
2013-05-15PDF Pattern gstate fix.Robin Watts
The PDF Reference manual is very confusing about what gstate should be used to run patterns in. Essentially, my experiments seem to suggest that as we run through a PDF page, at the start of executing each stream, we should remember the current gstate as the 'parent' gstate. Then whenever we instantiate a pattern (via scn etc), we should set the pattern to remember that gstate. When we come to render the pattern, the pattern should be rendered using the remembered gstate, not the current one. This causes many progressions in our tests.
2013-05-06Fix formatting.Tor Andersson
2013-05-01Try to use ToUnicode cmap to encode identity-encoded substitute fonts.Tor Andersson
2013-05-01Never treat cid fonts as builtin.Tor Andersson
2013-04-30Catch slow case in PDF tiling.Robin Watts
Sometimes a PDF file can use just a very small amount of a large tile; rendering the whole tile is a waste of time. Previous attempts to catch this case have worked for most cases, but can be defeated when the area needing rendering crosses a tile edge. Here we improve the formulation to catch exactly what we want. This implementation was driven by the example file in Sumatra PDFs bug tracker, for issue 2248, though the actual code change is different. Thanks to zeniko, nonetheless for this!
2013-04-26Bug 693845: Vertical motion in PDF.Robin Watts
Ignore sign of font size when calculating X offset in vertical motion for fonts.
2013-04-15Bug 692681: Pull SoftMask invocation logic togetherRobin Watts
Softmasks can be applied in 2 places in our code; once when starting a group, once when running an XObject. The two implementations had drifted apart. To avoid this in future, pull the two together. This solves the bug, apart from the issue of transfer functions not working. Also, fix another issue seen in cluster testing. For luminance smasks the bbox is only used to clip the contents drawn - the background color extends into the surrounding area. Fix the code to respect this. And another problem; text in soft masks would upset text outside the SMasks - fix this by storing/restoring the text settings in the interpreter state around the smask rendering.
2013-04-11Move pdf_image to fz_image.Robin Watts
In order to be able to output images (either in the pdfwrite device or in the html conversion), we need to be able to get to the original compressed data stream (or else we're going to end up recompressing images). To do that, we need to expose all of the contents of pdf_image into fz_image, so it makes sense to just amalgamate the two. This has knock on effects for the creation of indexed colorspaces, requiring some of that logic to be moved. Also, we need to make xps use the same structures; this means pushing PNG and TIFF support into the decoding code. Also we need to be able to load just the headers from PNG/TIFF/JPEGs as xps doesn't include dimension/resolution information. Also, separate out all the fz_image stuff into fitz/res_image.c rather than having it in res_pixmap.
2013-04-11Convert UTF-8 passwords to correct encoding.Tor Andersson
PDFDocEncoding for crypt revisions <= 4, UTF-8 for newer.
2013-04-10Don't roll the softmask matrix too early.Robin Watts
Previously we combined the softmask xobject->matrix with the ctm to make gstate->softmask_ctm at load time. This meant that when we ran the softmask xobject the xobject->matrix was reapplied a second time. The fix is to keep the xobject->matrix out and apply it manually whereever we use the softmask_ctm (which is just for the bbox transformation currently).
2013-04-10Treat missing TR in SoftMask as identity.Robin Watts
2013-03-29Avoid uncompressing indexed images at load time.Robin Watts
This actually turned out to be far easier than I'd feared; remove the explicit check that stopped this working, and ensure that we pass the correct value in for the 'indexed' param. Add a function to check for colorspaces being indexed. Bit nasty that this requires a strcmp...
2013-03-29Move bpc into fz_imageRobin Watts
2013-03-26Make pdf_functions public as fz_functions.Robin Watts
Implementations remain unexposed, but this means we can safely pass functions in shades without having to 'sample' them (though we may still choose to do this for speed).
2013-03-25Support creation of Ink annotations in MuPDF libraryPaul Gardiner
2013-03-22pdf_device: only output color if it's changed.Robin Watts
I'd half finished this code before, and only spotted the missing bits while cleaning up some warnings.
2013-03-22Squash some warnings.Robin Watts
Some -Wshadow ones, plus some 'set but not used' ones.
2013-03-22Fix store debugging fns so that all output goes to the same file.Robin Watts
2013-03-21Add 'void' to a function declaration.Robin Watts