diff options
author | Ray Johnston <ray.johnston@pobox.com> | 2022-05-31 10:19:01 -0700 |
---|---|---|
committer | Ray Johnston <ray.johnston@pobox.com> | 2022-07-30 10:26:52 -0700 |
commit | af3fa99aece39bfb83583d28e817c630c269bfea (patch) | |
tree | def55ccc2d61266142c574a249a0db9a26bc7da4 /base/gsdparam.c | |
parent | b097603e36106f26550f85eadc124efba9e6d39b (diff) | |
download | ghostpdl-af3fa99aece39bfb83583d28e817c630c269bfea.tar.gz |
New PageList processing, supporting PDF and XPS random order.
Supports out-of-order ranges (if the parser allows it and disables the
PageHandler, i.e., flp device). Also adds support for ranges appended
to the "even" and "odd" keyword following a ":".
As before a trailing "-" in a range implies the last page, and as was
supported by the previous 'gxps' code, a leading "-" also is the last page.
For example, with XPS or PDF: -sPageList=odd:3-7,even:4-8,1-,-1,9
prints pages: 3, 5, 7, 4, 6, 8, 1, 2, ..., last, last, last-1, ..., 1, 9
The PageList string is parsed using C code into an array that consists of
an initial int that is > 0 if the list is ordered, followed by sets of
3 integers per range, even/odd flag (odd=1, even=2), start, end. The
final 3 ints are 0,0,0 as a marker.
The initial int is used by 'pagelist_test_printed' as an index to the next
range to be processed when the PageList is used for languages that can only
be processed sequentially (e.g. PS and PCL) and is updated when the page
passes the end of the current range. A value of -1 means the ranges are
not ordered (not strctly increasing).
The flp_fillpage is changed to ignore errors from processing the PageList
performed by ParsePageList (called from SkipPage) when PageCount is 0
so that parsers that support out of order processing (PDF and XPS) can
continue until later. This should have little or no performance impact
since it is limited to PageCount == 0.
Note that the new PDF parser also uses the C code parser and then uses
the array of ranges returned by ".PDFparsePageList". The old PostScript
based parser has not been updated, although it is easy to do so.
Diffstat (limited to 'base/gsdparam.c')
-rw-r--r-- | base/gsdparam.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/base/gsdparam.c b/base/gsdparam.c index 8913b6301..07863706d 100644 --- a/base/gsdparam.c +++ b/base/gsdparam.c @@ -1544,7 +1544,7 @@ rc_free_pages_list(gs_memory_t * mem, void *ptr_in, client_name_t cname) gdev_pagelist *PageList = (gdev_pagelist *)ptr_in; if (PageList->rc.ref_count <= 1) { - gs_free(mem->non_gc_memory, PageList->Pages, 1, PagesSize, "free page list"); + gs_free(mem->non_gc_memory, PageList->Pages, 1, strlen(PageList->Pages), "free page list"); gs_free(mem->non_gc_memory, PageList, 1, sizeof(gdev_pagelist), "free structure to hold page list"); } } @@ -2212,7 +2212,6 @@ label:\ } memset(dev->PageList->Pages, 0x00, pagelist.size + 1); memcpy(dev->PageList->Pages, pagelist.data, pagelist.size); - dev->PageList->PagesSize = pagelist.size + 1; rc_init_free(dev->PageList, dev->memory->non_gc_memory, 1, rc_free_pages_list); } |