Acrobat DC crashes printing to PostScript

Oct 29, 2018

Copy link to clipboard

Copied

I have a PDF with many layers that are hidden or shown based on javascripts and field values. I'm trying to print to post script and the application freezes and then crashes about 30 seconds later. I'm able to print to post script with another pdf, but this one in particular will not work. It's a pretty large file (13mb), so I thought I would try to flatten it and reduce the file size, but I still have the same problem. Below is the function I'm using to print:

function PrintThis(){

var pp = this.getPrintParams();

pp.fileName = "/filepath/something.ps";

pp.printerName = "";

pp.interactive = pp.constants.interactionLevel.silent;

pp.pageHandling = pp.constants.handling.none;

    if(typeof(PrintToLoc) == "function"){

        PrintToLoc(this, pp);

    }

    else{

        app.alert("Missing system access priviledges. " + "Please contact administrator.");

    }

}

Are there any types of fields, images, layers, etc. that are post script unfriendly? I'm not sure why I can print to post script with another pdf, but not this one in any form.

TOPICS
Acrobat SDK and JavaScript

Views

112

Likes

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

Acrobat DC crashes printing to PostScript

Oct 29, 2018

Copy link to clipboard

Copied

I have a PDF with many layers that are hidden or shown based on javascripts and field values. I'm trying to print to post script and the application freezes and then crashes about 30 seconds later. I'm able to print to post script with another pdf, but this one in particular will not work. It's a pretty large file (13mb), so I thought I would try to flatten it and reduce the file size, but I still have the same problem. Below is the function I'm using to print:

function PrintThis(){

var pp = this.getPrintParams();

pp.fileName = "/filepath/something.ps";

pp.printerName = "";

pp.interactive = pp.constants.interactionLevel.silent;

pp.pageHandling = pp.constants.handling.none;

    if(typeof(PrintToLoc) == "function"){

        PrintToLoc(this, pp);

    }

    else{

        app.alert("Missing system access priviledges. " + "Please contact administrator.");

    }

}

Are there any types of fields, images, layers, etc. that are post script unfriendly? I'm not sure why I can print to post script with another pdf, but not this one in any form.

TOPICS
Acrobat SDK and JavaScript

Views

113

Likes

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
Oct 29, 2018 0
Oct 29, 2018

Copy link to clipboard

Copied

Post the code of PrintToLoc, please.

By the way, there's no "d" in "privileges"...

Likes

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
Reply
Loading...
Oct 29, 2018 0
Oct 29, 2018

Copy link to clipboard

Copied

Thanks. Spelling changed.

var PrintToLoc = app.trustedFunction(

  function(oDoc, pp)

  {

      app.beginPriv();

          

      try{

          oDoc.print(pp);

      }catch(e){

        app.alert("Error in Printing");

      }

      app.endPriv();

  }

);

Likes

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
Reply
Loading...
Oct 29, 2018 0
Oct 29, 2018

Copy link to clipboard

Copied

Can you print this file manually? to PostScript?

Likes

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
Reply
Loading...
Oct 29, 2018 0
Oct 29, 2018

Copy link to clipboard

Copied

I was able to manually export to postscript. I'm not sure how to manually print to postscript..

Likes

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
Reply
Loading...
Oct 29, 2018 0
Oct 29, 2018

Copy link to clipboard

Copied

I'm not sure if there's a difference..

Likes

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
Reply
Loading...
Oct 29, 2018 0
Oct 29, 2018

Copy link to clipboard

Copied

Hmm, looks as if printername "" triggers Export to PS functionality. However, you could try just printing to file with a PostScript printer driver from the UI (even to Adobe PDF which is PostScript; print to file will not make a PDF file). The aim is to see if JavaScript is the problem.

Likes

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
Reply
Loading...
Oct 29, 2018 0
Oct 29, 2018

Copy link to clipboard

Copied

It shouldn't be related to the javascript since the function works with another PDF. It's just this PDF in particular, so I was thinking that there are objects within the PDF that may be causing the issue. The PDF is also 13MB, so I don't know if that should make a difference or not.

Likes

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
Reply
Loading...
Oct 29, 2018 0
Oct 29, 2018

Copy link to clipboard

Copied

Instead of printing trying the saveAs command and set the cConvID parameter to "com.adobe.acrobat.ps".

It's a more reliable way of converting the file to a PostScript file than printing it, I believe.

Likes

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
Reply
Loading...
Oct 29, 2018 0
Oct 29, 2018

Copy link to clipboard

Copied

I will try this. The reason I printed to .ps was because the pdf was 8.5 x 16 to accommodate form controls on the right side of the form. In printing to PDF, I could cut off the form controls on the right side of the PDF and have a normal looking 8.5 x 11 when printed landscape without scaling. In this particular application, though, the form controls aren't needed because everything is set from VBA scripting through excel to batch print from a list. So, I'll create a normal 8.5 x 11 PDF without the extra space and perform a saveAs instead of a print.

Likes

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
Reply
Loading...
Oct 29, 2018 0