• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

PDF generation using PostScript and Distiller just stops - how do I debug?

Guest
Dec 06, 2016 Dec 06, 2016

Copy link to clipboard

Copied

I know very little about PostScript and Adobe Distiller so please bear with me and if I'm in the wrong place, suggest where I need to be.

At a very high level, I have inherited and am supporting an application that generates PostScript files and then asks Distiller to generate PDFs from these.

  • For each user transaction, 2 PDFs are expected.
  • The application generates multiple PostScript files.
    • There are several PostScript files, each that represent the content of a "chapter".
    • There is one top-level PostScript file that references each "chapter" PostScript file in order. The application asks Distiller to print this PostScript file and the result is the entire "book" as a PDF. This is PDF #1.
    • There is a second top-level PostScript file that references a subset of pages from each "chapter" PostScript file. The application also asks Distiller to print this PostScript file and the result is a subset of the book as a PDF. This is PDF #2.

In most cases (for many years), both PDFs generate successfully. We have now encountered a case where PDF #1 generates successfully but PDF #2 does not. When the application asks Distiller to print PDF #2, Distiller starts to do so but stops prematurely. The application thinks the PDF generation was successful because it received no error/exception, there is no error/exception in the LOG file generated by Distiller, yet PDF #2 only contains the first N pages.

If anyone can tell me what we're doing wrong or at least tell me how I can better troubleshoot this, any and all help is greatly appreciated.

Some more detail about the data and what I've already tried/learned so far...

The pages in the book can contain text or full page graphics. The standard page size for the book is 8x11. The page size for full page graphics include 11x17 and 11x24 (i.e., foldouts). We thought this may be the first case where the book contains graphics requiring 11x24 page size and that the root case had something to do with this.

  • The last PostScript command processed by Distiller before ending prematurely is the first set of pages that includes an 11x24 graphic.
  • If we try generating PDF #2 from a page after page N, Distiller starts but again ends prematurely with the last PostScript command processed as one that includes an 11x24 graphic.

But...

  • PDF #1 prints successfully and is complete. It includes the 11x24 graphics pages just fine.
  • I modified the source data that indicates which graphics are 11x24 to be 11x17. The problem still remained.
  • I replaced the 11x24 graphics with 11x17 graphics. The problem still remained.

Distiller is run with the -F parameter.

PostScript for "chapter" files -  Our code does not actually generate this PostScript. Our code executes in a 3rd party environment that takes care of this. Sending these files to Distiller individually results in a PDF with the correct number of pages, the correct content, the correct page sizes, and correct content/page orientation (i.e., graphics were properly rotated on 11x17 and 11x24 pages).

PDF #1 PostScript Sample:

/prun { /mysave save def

  dup = flush

  RunFile

  clear cleardictstack

  mysave restore

} def

(path/to/chapter1.ps) prun

(path/to/chapter2.ps) prun

...

PDF #2 PostScript Sample:

/ch1 (path/to/chapter1.ps) def

/ch2 (path/to/chapter2.ps) def

...

/prun { /mysave save def

  dup = flush

  <</StartPage 1>> setdistillerparams

  <</EndPage 2>> setdistillerparams

  RunFile

  clear cleardictstack

  mysave restore

} def

ch1 prun

/prun { /mysave save def

  dup = flush

  <</StartPage 5>> setdistillerparams

  <</EndPage 6>> setdistillerparams

  RunFile

  clear cleardictstack

  mysave restore

} def

ch1 prun

/prun { /mysave save def

  dup = flush

  <</StartPage 13>> setdistillerparams

  <</EndPage 14>> setdistillerparams

  RunFile

  clear cleardictstack

  mysave restore

} def

ch2 prun

... (pattern repeats w/ different start/end page numbers

The start/end page counters for the PDF #2 PostScript seemed odd to me but in general the formula in use works. I wondered if something would be different for 11x24 pages but when we print the "chapter" PostScript file, the 11x24 page is considered one page (per the log file).

What I tried with the PDF #2 PostScript...

  • If I reduce it to just the chapter that contains the first 11x24 graphic (e.g., Chapter 15), Distiller still stopped prematurely.
  • The iteration of calls to prun are done in sets of 2 book pages (or 1 physical page, front and back). I tried reducing the number of calls by adjusting the start/end page counts (e.g., if page 1, 2, 3 and 4 need to be included, instead of 2 Distiller calls, one for pages 1-2 and one for pages 3-4, only have one for pages 1-4). Distiller still stopped prematurely but included any addition pages in the last set processed.
  • I tried changing the PostScript itself (see below) such that a call to Distiller only prints one page at a time and we iterate over an array (vs. repeat prun definitions). This actually resulted in a limit check error message prior to even reaching the point where Distiller typically stops prematurely. Several attempts were made at trying to solve this issue w/ no luck.
  • Thinking any/all of the above was the result of a memory issue, added "false 0 startjob pop" after "RunFile" (per some other post I found) to both the current implementation and the alternative below. Distiller still stopped prematurely.

Alternative PDF #2 PostScript Sample:

/prun {

  <</StartPage currentpage>> setdistillerparams

  <</EndPage currentpage>> setdistillerparams

  dup = flush

  RunFile

} bind def

/processch {

  LOCAL begin

    /FILE exch def

    /PAGES exch def

    PAGES {

      /currentpage exch def

      FILE prun

    } forall

  end

} dup 0 1 dict put def

/ch1 (path/to/chapter1.ps) def

/ch1pgs [1 3 6 10] def

/ch2 (path/to/chapter2.ps) def

/ch2pgs [15 21] def

...

ch1pgs ch1 processch

ch2pgs ch2 processch

...

Thanks,

Kelly

TOPICS
Acrobat SDK and JavaScript

Views

1.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Dec 06, 2016 Dec 06, 2016

Copy link to clipboard

Copied

You don’t mention what version of Distiller – but support for referencing external files from Postscript was removed (by default) from the product back in Acrobat 9 (currently, a no longer supported version). However, reading further, I see that you are running Distiller with –F, which overrides that restriction, so you have addressed that.

Honestly – you are doing something that is hasn’t been a good idea for close to a decade now. I suggest that you work on rewriting this application to use a more modern approach to PDF generation. (aka direct to PDF, rather than via Postscript).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 06, 2016 Dec 06, 2016

Copy link to clipboard

Copied

Thanks. Unfortunately, rewriting it to the extent you suggest is not a viable option at this time due to the time it would take to do so.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 06, 2016 Dec 06, 2016

Copy link to clipboard

Copied

Debugging PostScript is hard and frustrating, and I am trying to not do it too often in order to keep the hair I still have

I would not go as far lrosenth - Distiller is still a product shipped and supported by Adobe, so it should work, and any workflow that worked in the past should still work with the current version of Distiller. PostScript to PDF is still a method that is used by a lot of automated workflows. Yes, it would be much easier for a lot of people if we could move to a direct to PDF model, but as long as there is a way to convert from PostScript to PDF, and you are OK with it's limitations, you should be able to use it.

The problem with PostScript is that it's a programming language, and just because we know what the symptoms are, does not mean that we can actually determine the cause without analyzing the data that is processed by Distiller. This means all the PostScript files, Distiller job options and anything else that is involved in the process.

The way I would approach something like this is to strip down the problem to a case that does not do much more than to trigger the problem. This may mean isolating pages to see if the problem is caused by page content (it could for example be some image data that is referenced in one of the PS files - even though that should trigger an error message). If that does not work, I would use a non-Adobe PS/PDF converter to see if I can get error messages about conditions that Distiller does not report.

If you don't feel comfortable doing this work yourself, you may want to hire somebody who can do this type of work for you. Look for somebody who has a solid background of doing this type of work. If you want to get an idea about what would be involved, feel free to get in touch with me via email - my contact information is on my profile page.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 06, 2016 Dec 06, 2016

Copy link to clipboard

Copied

LATEST

StartPage 7 would mean, skip the first 6 pages as if they didn't exist. So verify you do have that many pages, and experiment with removing the StartPage, EndPage lines.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines