Question

Why is the final part of my PDF creation process failing please. See output from ps2pdf command below. This is at the end of my own developed tool chain. I harvest images from Matlab, stitch them together using LaTeX and then create the final PDF using latexmk.

This has worked fine until now when the document in question has grown to 3356 pages!

File position 238282 in file output.ps (as mentioned in the ghostscript error output) is towards the end of the "SDict begin [ {Catalog} << /PageLabels<>1<>2 " line. This line is 51542 chars long and describes all 3356 pages.

Is this line length just too long now? If I trim my .tex file down towards 3000 pages and re-run the latexmk it completes fine.

Running ps2pdf in isolation to show error. Same error when run from latexmk:

C:\temp>c:\MiKTeX\miktex\bin\ps2pdf.exe output.ps output.pdf > error.txt 2>&1

Gave output:

Error: /limitcheck in --string--
Operand stack:
   --nostringval--   --nostringval--   --dict:1/1(L)--   PUT   --nostringval--   2   --nostringval--   2   false   --nostringval--   --nostringval--   (])   --nostringval--   --nostringval--   (3327)   --nostringval--   --nostringval--   P   1   .pdfcvstring   (<<\n/P \(3225\)\n>> 3226 <<\n/P \(32)   (<<\n/Nums [0 <<\n/P \(1\)\n>> 1 <<\n/P \(1\)\n>> 2 <<\n/P \(2\)\n>> 3 <<\n/P \(3\)\n>> 4 <<\n/P \(4\)\n>> 5 <<\n/P \(5\)\n>> 6 <<\n/P \(6\)\n>> 7 <<\n/P \(7\)\n>> 8 <<\n/P \(8\)\n>> 9 <<\n/P \(9\)\n>> 10 <<\n/P \(10\)\n>> 11 <<\n/P \(11\)\n>> 12 <<\n...)   65550
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1910   1   3   %oparray_pop   1909   1   3   %oparray_pop   1893   1   3   %oparray_pop   1787   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   1917   4   5   %oparray_pop   --nostringval--   3   1   2   --nostringval--   %for_pos_int_continue   --nostringval--   --nostringval--   --nostringval--   --dict:1/1(L)--   --nostringval--   1   %dict_continue   --nostringval--   --nostringval--   --nostringval--   --nostringval--   %array_continue   --nostringval--   --nostringval--   --dict:1/1(L)--   --nostringval--   1   %dict_continue   --nostringval--   --nostringval--   %zwritecvp_continue   1   %s_proc_write_continue   --nostringval--   --nostringval--   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1159/1684(ro)(G)--   --dict:0/20(G)--   --dict:81/200(L)--   --dict:188/300(L)--   --dict:36/200(L)--   --dict:10/10(G)--
Current allocation mode is local
Last OS error: No such file or directory
Current file position is 238282
MiKTeX GPL Ghostscript  9.00: Unrecoverable error, exit code 1

Edit: Added my complete page labels line from the postscript file that goes into ps2pdf. See pastebin entry http://pastebin.com/FFvZpaRY

Was it helpful?

Solution

I ran pdfmark you provided with 9.10's pdfwrite device without error, but 9.00 fails with the same message as you show.

Update: Assuming, that page labels you need are 1,1,2,3...3261 (don't know why, but that's what is in your example), it's simpler to add auto-incrementing numeric labels, not string prefixes as you do.

[{Catalog}<<
/PageLabels<</Nums[0<</S/D>>1<</S/D>>]>>
>> /PUT pdfmark

Or, if prefixes are what's necessary, split your big array into two or more:

[/_objdef{leaf1}/type/dict/OBJ pdfmark
[/_objdef{leaf2}/type/dict/OBJ pdfmark
[{leaf1}<</Limits[0 3000]
/Nums[
... 0 to 3000 labels go here ...
>>/PUT pdfmark
[{leaf2}<</Limits[3001 3261]
/Nums[
... 3001 to 3261 labels go here ...
>>/PUT pdfmark
[{Catalog}<</PageLabels<</Kids[{leaf1} {leaf2}]>>
>>/PUT pdfmark

Both these solutions work with 9.00

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top