I have found several sources such as this stackoverflow question where this questions seems to already be answered. However, it is not working for me and I have no idea why.
Here is a sample of my code, but it is basically only the first line which is of interest.
#include "json2.js";
var pdfOptions = app.preferences.PDFFileOptions;
pdfOptions.pDFCropToBox = PDFBoxType.PDFBOUNDINGBOX;
pdfOptions.pageToOpen = 1;
// Open a file using these preferences
var fileRef = new
File("C:/originalpeople/Winetumbler/canvas_test1.pdf");
I get an Error 27: Stack overrun error.
Any help would be much appreciated.