summaryrefslogtreecommitdiff
path: root/source/pdf
AgeCommit message (Collapse)Author
2018-11-13Add more encoding tables.Tor Andersson
Add tables for Windows-1250, Windows-1251, and ISO-8859-1. Also add unicode_from_encoding tables. Move encodings from PDF namespace to Fitz.
2018-11-13Bug 692592: Handle relative file links.Tor Andersson
The core library doesn't know where a document comes from, since we can open it as a stream, etc. Let the viewer handle relative file URLs.
2018-11-13Use fz_image.imagemask field when adding PDF image resources.Tor Andersson
Don't pass the information as a separate argument.
2018-11-12Fix 699094: Never decompress JPX streams in mutool clean.Tor Andersson
2018-11-12Bug 700154: Don't pass blends into groups within softmasks.Robin Watts
When generating a softmask, which is to be rendered with a blend, don't pass that blend down into the rendering of the softmask. Otherwise the blend gets used twice. In the example given this is causing the content to disappear.
2018-11-12Remove bitrotted and not working PDF portfolio code.Tor Andersson
Extracting embedded files can be trivially done with 'mutool show' or a simple mutool run script. The portfolio creation code is incomplete, and would require a lot of work and testing with Adobe in order to be useful.
2018-11-12Clean up pdf-portfolio.cTor Andersson
Remove pointless paranoia checks. Move the check whether it has already been loaded into load_portfolio().
2018-11-12Fix 697728: Use UTF-8 strings in PDF portfolio functions.Tor Andersson
2018-11-12Fix 697913: Make sure PDF portfolios are saved as version >= 1.7.Tor Andersson
2018-11-12Remove confusing flag define.Tor Andersson
What's the difference between PDF_OBJ_FLAG_MARK and PDF_FLAGS_MARKED? PDF_OBJ_FLAG_MARK is used to flag an xref entry as one that we want to keep cached with the pdf_mark_xref/pdf_clear_xref_to_mark functions. PDF_FLAGS_MARKED is used to detect unwanted recursion in PDF structures. Renaming the xref_entry.flags field to xref_entry.marked should remove this source of potential confusion.
2018-11-09Fix 695390: Increase number of samples in Type 1 function shadings.Tor Andersson
15 years have passed since we first set the sampling to a 32x32 mesh. Quadrupling it to 64x64 sounds about right to me.
2018-11-08Fix 699352: Call begin_layer for all marked content in PDF.Tor Andersson
Since we call end_layer without distinction, we should also call begin_layer the same way. Also change the XML to emit separate tags for beginning and ending a layer, since there is no guarantee the layer calls will be neatly nested with clipping pushes and pops; nor is there a guarantee that the PDF will even balance the BMC/BDC and EMC operators.
2018-11-07Resolve objects in pdf_debug_obj().Sebastian Rasmussen
2018-11-07Write placeholder appearance streams for digital signatures.Tor Andersson
A proper appearance stream is written when signing with a certificate. This is just to create a placeholder appearance when the original document did not write one.
2018-11-07Fix 700053: Add 'decrypt' option to pdf_save_document.Tor Andersson
This option is exposed as the -D flag to mutool clean. Allow saving a document without encryption. The next step is to allow saving a document with new encryption, but this may require a fair amount of rejigging since the PDF write code to keep separate doc->crypt objects for decryption and encryption.
2018-11-07Fix writing encrypted PDF files with 'decompress' option.Tor Andersson
2018-11-06Update AFParseDateEx to handle dates as a contiguous string of digits.Paul Gardiner
Update to match Adobe Reader's behaviour. This fixes bug #700128.
2018-10-24Since fz_end_group may throw, don't call it inside fz_always.Sebastian Rasmussen
If running the page throws an exception, we don't need to call end_group since the page interpretation is aborted and won't be finished.
2018-10-24Do run processor clip stack balancing in close (not drop) callback.Tor Andersson
The close callback should make sure everything is cleanly shut down. The drop callback frees leftover memory when shutting down either cleanly or when aborting processing due to errors.
2018-10-24Drop page upon exception while loading hinted page.Sebastian Rasmussen
2018-10-23Drop page upon exception cleaning content streams.Sebastian Rasmussen
2018-10-23Don't clobber old xref section when pdf_replace_xref fails.Sebastian Rasmussen
2018-10-23Drop new object upon exception grafting objects.Sebastian Rasmussen
2018-10-23Remember to drop group colorspace.Sebastian Rasmussen
2018-10-23Drop loaded object while writing hint stream.Sebastian Rasmussen
This covers both the case of no error and a thrown exception.
2018-10-23Remove extra blank lines.Tor Andersson
2018-10-23When copying streams drop resources upon exception.Sebastian Rasmussen
2018-10-23Remember to drop group colorspace.Sebastian Rasmussen
2018-10-23Fix text used as clip mask in pdfwrite device.Tor Andersson
Push the clip state, and pass the correct text rendering mode state.
2018-10-23Fix leak in pdfwrite pdf_dev_end_mask.Tor Andersson
2018-10-23Use DeviceGray colorspace for soft masks in pdfwrite output.Tor Andersson
2018-10-23Avoid being smart about keeping only a single reference to the buffer.Sebastian Rasmussen
When pdf_dev_pop() is called it will drop the reference to the buffer. pdf_dev_push_new_buf() will either create a new buffer reference or take a reference to the existing buffer. When pdf_dev_pop() is called unbalance this creates a problem as the top level buffer will be unreferenced too many times. fails-32.pdf
2018-10-23Fix typo in pdf write device.Tor Andersson
2018-10-16Fix line spacing bug in rewriting PDF files.Robin Watts
The filter op for Tz was reading the scale in and dividing by 100 as we do elsewhere. The buffer op was then forgetting to multiply by 100 before rewriting it.
2018-10-12Drop xref subsection upon exception.Sebastian Rasmussen
2018-10-12Drop CMAP upon exception.Sebastian Rasmussen
2018-10-12Drop default colorspaces upon exception.Sebastian Rasmussen
2018-10-12Drop default colorspaces upon exception.Sebastian Rasmussen
2018-09-21Regularize language and script names.Tor Andersson
Drop the unused 'serif' argument to the CJK lookup functions. Use the BCP 47 names for CJK scripts and languages: zh-Hant for traditional Chinese, zh-Hans for simplified Chinese, ja for Japanese, ko for Korean. The lookup function also allows commonly used language+country codes: zh-TW and zh-HK for traditional Chinese, zh-CN for simplified Chinese.
2018-09-19Add accessor for field text label.Tor Andersson
2018-09-19Fix warning.Tor Andersson
2018-09-13Bug 699768: Drop default colorspaces even if page transformation fails.Sebastian Rasmussen
pdf_page_transform() may throw due to a cycle in the page tree. When this happened mupdf would previously forget to drop the default colorspaces obtained, after this commit they are dropped. Thanks to oss-fuzz for reporting.
2018-09-07Bug 699743: Pop clip upon error when flushing text.Sebastian Rasmussen
Not popping causes assert to be triggered in fz_draw_end_group().
2018-09-06Bug 699723: Free alternative colorspace upon error when loading ICC colorspace.Sebastian Rasmussen
2018-09-06Bug 699717: Pop clip even in case of error.Sebastian Rasmussen
Not popping causes assert to be triggered in fz_draw_end_group().
2018-09-05Use colorspace type enum instead of magic profile names.Tor Andersson
2018-08-30When unrecoverable errors occur on a page, at least print them.Sebastian Rasmussen
Previously there was no visibility as to what the error was.
2018-08-30Bug 699695: Remember to end groups/softmasks even upon exception.Sebastian Rasmussen
fz_fill_path() may throw an exception halfway through pdf_show_path(), which in this case would not attempt to end any begun groups or softmasks. This led to e.g. leaks of pixmaps held by a group that was never ended. Moving the cleanup to the always block is not foolproof because the cleanup code itself may also throw exceptions, hence preventing the end of the fz_always block from being executed. This commit does put pdf_show_path() in the same situation as pdf_run_xobject() that has the same problem with its cleanup code. Thanks to oss-fuzz for reporting.
2018-08-30Bug 699694: Fix reference counting for JBIG2 globals.Sebastian Rasmussen
fz_open_jbig2d() is called at two locations in MuPDF. At one location a reference to the JBIG2 globals struct was taken before passing it to fz_open_jbig2d(). At the other location no such reference was taken, but rather ownership of the struct was implicitly transferred to fz_open_jbig2d(). This inconsistency led to a leak of the globals struct at the first location. Now, passing a JBIG2 globals struct to fz_open_jbig2d() never implictly takes ownership. Instead the JBIG2 stream will take a reference if it needs it and drops it in case of error. As usual it is the callers responsibility to drop the reference to the globals struct it owns.
2018-08-30Remove unreachable code.Sebastian Rasmussen
JBIG2 images are detected by build_compression_params() and then always passed to fz_open_image_decomp_stream() by build_filter(). Therefore there is no chance for build_filter() at a later stage to detect JBIG2 images, and so that check can be removed.