summaryrefslogtreecommitdiff
path: root/src/cairo-pdf-interchange.c
Commit message (Collapse)AuthorAgeFilesLines
* Make cairo_tag_begin/end work correctly in groupsAdrian Johnson2023-04-181-252/+1175
| | | | Fixes #508
* pdf: ensure filenames are correctly encodedAdrian Johnson2022-01-161-4/+99
|
* pdf: ensure url strings are correctly encodedAdrian Johnson2022-01-091-2/+13
| | | | Fixes #526
* Add cairo_pdf_surface_set_custom_metadata()Adrian Johnson2021-08-221-0/+100
|
* pdf links: fix forward references to dest names with 'internal' flagAdrian Johnson2021-07-291-48/+71
|
* Print tag error details when CAIRO_DEBUG_TAG is definedAdrian Johnson2021-07-291-2/+4
| | | | | | Add a _cairo_tag_error(fmt, ...) function that is used liked _cairo_error() but allows an error message to be specified. When CAIRO_DEBUG_TAG is defined the error is printed.
* pdf: convert all document interchange features to use object streamsAdrian Johnson2021-07-261-135/+184
|
* tags: allow links to page numbers not yet createdAdrian Johnson2021-07-241-16/+77
| | | | | | | | | | | | | Previously, forward references were required to use named destinations. This patch is based on the patch in #336 by Guillaume Ayoub <guillaume.ayoub@kozea.fr> that converted all links to indirect objects written at the end of the document. I have reworked the patch so that only forward references to future page numbers are written as indirect objects. Backward references and named destinations remain as they are. This is to minimize the number of objects written to the PDF file. Fixes #336
* pdf: Properly pass on stdio write errorsUli Schlachter2021-07-231-3/+1
| | | | | | | | | | | | | | | | | | | | cairo-pdf was silently ignoring write errors in _cairo_pdf_surface_finish(). Any write errors that happened here ended up setting a "status" variable, but the value in this variable was then unused. This commit fixes this bug by passing this error on to the caller. Additionally, this also adds a test case for this behaviour based on writing to /dev/full. This file is non-standard and thus the test first checks that this file exists and is writable before trying to write to it. This bug was found based on a report from Knut Petersen [0]. [0]: https://lists.cairographics.org/archives/cairo/2021-July/029281.html Signed-off-by: Uli Schlachter <psychon@znc.in>
* Merge branch 'jfkthame-master-patch-75366' into 'master'Uli Schlachter2021-06-021-1/+2
|\ | | | | | | | | | | | | [pdf-interchange] Write trees even if only LINK tags are present Closes #487 See merge request cairo/cairo!185
| * [pdf-interchange] Write trees even if only LINK tags are presentJonathan Kew2021-05-241-1/+2
| | | | | | | | | | | | This avoids the PDF ending up with invalid xref entries for objects that were "reserved" but then never output. Fixes https://gitlab.freedesktop.org/cairo/cairo/-/issues/487.
* | Fix a memory leak with cairo_tag_begin() + pdfUli Schlachter2021-02-131-0/+7
|/ | | | | | | | | | | | | | | | | | | | | The error paths in _cairo_pdf_interchange_begin_dest_tag() do not clean up and cause some memory to be leaked. Fix this by adding the necessary free()s. The first hunk, the missing free(dest) was found by oss-fuzz (see link below). The second hunk is an obvious follow up. It also cleans up the memory allocated by _cairo_tag_parse_dest_attributes(). The cleanup in the second hunk is similar to the function _named_dest_pluck() in the same function, but that function also removes the entry from a hash table. The error case here is that exactly this hash table insertion failed. Thus, the code cannot simply use the already existing function. Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30880 Signed-off-by: Uli Schlachter <psychon@znc.in>
* Fix conversion from ISO 8601 to PDF date stringSven Neumann2020-11-201-1/+2
| | | | | The code used to unintentionally drop the minutes from the timezone offset, see issue #392. This is now fixed.
* Use HTTPS URLs for cairographics.org domainsPaul Menzel2018-10-161-1/+1
| | | | | | | | Run the command below suggested by geirha in ##sed@irc.freenode.net. git grep -l 'http://.*cairographics.org' | xargs sed -i 's|http\(://\([[:alnum:].-]*\.\)\{0,1\}cairographics\.org\)|https\1|g' Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
* Use _cairo_malloc instead of mallocAdrian Johnson2018-05-071-1/+1
| | | | | | | | | | _cairo_malloc(0) always returns NULL, but has not been used consistently. This patch replaces many calls to malloc() with _cairo_malloc(). Fixes: fdo# 101547 CVE: CVE-2017-9814 Heap buffer overflow at cairo-truetype-subset.c:1299 Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* pdf: fix some annotation bugsAdrian Johnson2017-11-261-41/+124
| | | | | | | | | - each annotation was emitted on every page instead of just the page that contains the annotation - the document structure did not correctly link to annotation objects - fix some annotation related memory leaks
* pdf: fix document structure for non tagged structuresAdrian Johnson2017-11-161-6/+20
|
* pdf: set default create dateAdrian Johnson2017-10-241-0/+50
|
* pdf: use explicit dest instead of named dest when 'internal' attribute is setAdrian Johnson2017-08-291-56/+125
|
* pdf: use link attributes instead of dest name for cairo_pdf_surface_add_outlineAdrian Johnson2017-08-261-81/+96
| | | | | In PDF outline targets are specified the same way as link targets so there is no need to restrict the target to dest names.
* pdf: fix link positionsAdrian Johnson2017-08-261-17/+33
| | | | | | | | | | | | | | | Converting the link position from cairo to pdf coordinates requires the page height. Since the link may point to a different page, build an array of the height of each page and use the target page height for the conversion. Don't default to a [0,0] position if "pos" is not specified. PDF allows a null destination position to be specified which means don't change the position if the page is already displayed or show top left if switching to a different page. This is more useful default particularly for external files where the coordinates (which must be in PDF coordinates as we don't know the page height) of the top left corner may not be known.
* pdf: don't write logical structure if it only contains linksAdrian Johnson2017-08-221-8/+13
|
* pdf: Don't emit /PageLabel dict when no labels definedAdrian Johnson2017-08-211-40/+52
|
* pdf: link tags do not need to be leaf nodes in the document structureAdrian Johnson2017-08-201-10/+1
|
* pdf: don't return uninitialized statusAdrian Johnson2017-02-021-1/+1
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=99630
* pdf: Fix wrong cairo_pdf_outline_flags_t item prefixKouhei Sutou2017-01-051-3/+3
|
* strndup is not avuilable with MSVCAdrian Johnson2016-10-071-2/+10
|
* fix compiler warningsAdrian Johnson2016-10-041-3/+3
|
* pdf: page label APIAdrian Johnson2016-10-011-0/+115
|
* pdf: metadata APIAdrian Johnson2016-10-011-0/+177
|
* pdf: add document outline APIAdrian Johnson2016-10-011-1/+181
|
* pdf: structured text and hyperlink supportAdrian Johnson2016-10-011-0/+993