summaryrefslogtreecommitdiff
path: root/source/pdf
AgeCommit message (Collapse)Author
2016-10-13crypt: Handle null pointer when dropping crypt object.Sebastian Rasmussen
Exposed by weird-jpx.pdf from bug 696885.
2016-10-12Fix (harmless) typo in function prototypes.Tor Andersson
2016-10-12Always call fz_drop_document() to drop the document.Sebastian Rasmussen
2016-10-11Free document in fz_drop_document(), not in subclassing documents.Sebastian Rasmussen
2016-10-07Add ctx to fz_font functions.Robin Watts
2016-10-07pdf: Support UTF-8 encoded text strings.Tor Andersson
New in PDF 2.0.
2016-10-07pdf: Separate functions to read text strings and text streams as UTF-8.Tor Andersson
The stream loading is used only by the JS code loading.
2016-10-07pdf: Remove unneccessary document argument to pdf_to_utf8 etc.Tor Andersson
2016-10-07Add annotation editing functions and clean interface of existing ones.Tor Andersson
2016-10-07Remove separate tmp/deleted/changed annotation lists.Tor Andersson
Use a flag in the pdf_annot struct instead. Don't pass pdf_document to annotation edit functions.
2016-10-06Hide internals of fz_colorspaceRobin Watts
The implementation does not need to be in the public API.
2016-10-06Update Xref reading code to cope with 19 byte entries.Robin Watts
The spec says entries should be 20 bytes long. In practise we see 19 byte long ones more often than we like. This is due to the use of a single EOL char rather than 2. The PCLm files I've seen use 19 byte ones, so update the code to cope with these.
2016-10-05Move fz_font definition to be private.Robin Watts
Move the definition of fz_font to be in a private header file rather than in the public API. Add accessors for specific parts of the structure and use them as appropriate. The font flags, and the harfbuzz records remain public. This means that only 3 files now need access to the font implementation (font.c, pdf-font.c and pdf-type3.c). This may be able to be improved further in future.
2016-09-26Fix memory leak when opening html/loading raw stream.Sebastian Rasmussen
2016-09-23Fix leak in error case of pdf_add_stream.Robin Watts
2016-09-23Clean up annotation enum names.Tor Andersson
Put them in the PDF name space and separate words with underscores. Remove redundant namespace prefixes in java constants. Device.FLAG_MASK rather than Device.FZ_DEVFLAG_MASK. Use namespace for PDF annotation flag enum.
2016-09-22Bug 697015: Avoid object references vanishing during repair.Robin Watts
A PDF repair can be triggered 'just in time', when we encounter a problem in the file. The idea is that this can happen without the enclosing code being aware of it. Thus the enclosing code may be holding 'borrowed' references (such as those returned by pdf_dict_get()) at the time when the repair is triggered. We are therefore at pains to ensure that the repair does not replace any objects that exist already, so that the calling code will not have these references unexpectedly invalidated. The sole exception to this is when we replace the 'Length' fields in stream dictionaries with the actual lengths. Bug 697015 shows exactly this situation causing a reference to become invalid. The solution implemented here is to add an 'orphan list' to the document, where we put these (hopefully few, small) objects. These orphans are kept around until the document is closed.
2016-09-19fz_store: Reap passes.Robin Watts
A few commits back, we introduced the fz_key_storable concept to allow us to cope with objects that were used both as values within the store and as parts of keys within the store. This commit worked, but showed up performance problems; when the store has several million PDF objects in it, bulk changes (such as dropping a display list or document) could trigger many passes across the store. We therefore introduce a mechanism to ameliorate this. These passes, now known as "reap passes", can be batched together using fz_defer_reap_start and fz_defer_reap_end. We trigger this start/end around display list dropping, and around PDF content stream processing. This should be fine, as deferral will be interrupted if we ever run our of memory during mallocing.
2016-09-16Remove unused variable.Robin Watts
2016-09-16Correct assertion in pdf-store.Robin Watts
We can use names as keys for colorspaces. These are not bound to a particular document.
2016-09-16Silence some warnings.Robin Watts
2016-09-16Tweak store handling of PDF document destroy.Robin Watts
When we destroy a PDF document, currently we bin everything from the store. Instead, drop just the objects that are specifically tied to that document. Any object tied to the document has a pdf_obj with the required document pointer in it as the key.
2016-09-14Don't report addRef/dropRef events to Memento twice.Robin Watts
We call Memento_addRef etc in fz_keep_impXX functions, so don't call them in the callers too.
2016-09-14Add scripts to remove/replace 'static' from functions.Robin Watts
Getting a backtrace out with missing functions makes the backtrace much less useful. Some backtrace routines (such as that used by Memento on Android) are incapable of resolving static functions. We therefore provide 2 scripts (scripts/destatic.sh and scripts/restatic.sh) that respectively remove and replace the 'static' from function definitions. The scripts do not affect "static inline" or "static const" definitions, and they are are restricted to working in the source directory (excluding source/tools), thirdparty/mujs and the platform/{java,android} directories. The transformed source should NOT be checked in. To avoid problems with clashing symbols, some functions are renamed or tweaked slightly in this patch.
2016-09-08Make fz_option_eq() available outside of pdf-writer.Sebastian Rasmussen
2016-09-06Luminosity transparency group must have colorspace when used as softmask.Sebastian Rasmussen
Previously no fallbacks happened if the colorspace was not set, now gray is assumed. The reason this is safe is that the softmasks backdrop color entry is always filled with one component value (possibly being 0) matching the gray component of the colorspace.
2016-09-05Mutool clean: Avoid "Not a dict (<NULL>)" errorRobin Watts
If there are no outlines, don't throw an error trying to strip them.
2016-09-05mutool clean: Fixes seen as part of bug 697092 investigation.Robin Watts
Firstly, we avoid compressing streams if they get bigger. Secondly, we ensure that we always update the Length field. Seen as part of the investigation into bug 697092, though not the actual cause. Thanks to Tor for the latter part of the fix.
2016-09-01Use fz_convert_color().Sebastian Rasmussen
In preference to colorspace internal to_rgb() function pointer.
2016-09-01Always use glyph aliases when creating encoding tables.Tor Andersson
We were only looking through the glyph name alias list for Type1 fonts. Change the encodings for truetype to use the full glyph list alias list as a fallback when the regular encoding by code point fails.
2016-09-01pdf: Load/open streams by indirect reference object when possible.Tor Andersson
2016-09-01Simplify PDF resource caching table handling.Tor Andersson
2016-08-30Don't try to copy a NULL dictionary.Tor Andersson
2016-08-30Use U+FFFD instead of '?' for bad encodings in text extraction.Tor Andersson
2016-08-24Add pdf_array_find to look up the index of an object in an array.Tor Andersson
2016-08-24When NULL is added to PDF dicts/arrays, insert null objects.Sebastian Rasmussen
2016-08-24Be stricter in what can be added into arrays/dicts.Sebastian Rasmussen
2016-08-24Do not resolve PDF dict keys before using them.Sebastian Rasmussen
Only direct PDF name objects should be used as arguments, indirect PDF name objects cannot be used.
2016-08-24Always check that PDF dict keys are names in same way.Sebastian Rasmussen
2016-08-24Add macros for checking PDF object type.Sebastian Rasmussen
This avoids resolving object references which is important for dictionary keys.
2016-08-24Turn warnings in dict/array functions into exceptions.Sebastian Rasmussen
2016-08-02Remove function not being called.Sebastian Rasmussen
2016-08-02Parse more fz_document_writer() options.Sebastian Rasmussen
2016-07-31Make mutool clean only iterate over valid link annotations.Sebastian Rasmussen
2016-07-31Make sure that number of colors in mesh params is valid.Sebastian Rasmussen
Fixes bug 696954.
2016-07-22Bug 696941: Fix use after free.Robin Watts
The file is HORRIBLY corrupt, and triggers Sophos to think it's PDF malware (which it isn't). It does however trigger a use after free, worked around here.
2016-07-20Fix memory leaks during annotation synthesis.Robin Watts
2016-07-13Bug 696892: PDF annotation appearance stream synthesis SEGVRobin Watts
The code would SEGV if we were trying to synthesise an appearance stream for an annotation, and the docs pdf resources table had not been initialised. We now intialise the pdf resource tables when we initialise a pdf device. This is the earliest point we know we are going to need them, and covers all cases.
2016-07-13Use fz_malloc_struct rather than fz_calloc.Robin Watts
This helps with Memento debugging, and looks neater.
2016-07-12Fix bugs in pdf_add_image.Tor Andersson