Using Save() method to save as PDF
Hello everyone,
I am trying to save a FM-Doc as PDF and using the Save() method.
The method does not work correctly. I am getting no saved PDF file, and while execution I get a InvalidObject.
Could someone tell me, what the problem could be?
Here is the code:
function saveDocAsPDF(doc){
var saveParams, name, i, baseName, status, fullName;
name = doc.Name;
fullName = "TESTPDF.pdf";
saveParams = GetSaveDefaultParams();
returnParams = new PropVals();
var PDF = doc.Save(fullName, saveParams, returnParams);
$.writeln("SaveReturnParams / Errors " + PrintSaveStatus(returnParams));
i = GetPropIndex(returnParams, Constants.FS_SaveNativeError); // CHECK STATUS
status = returnParams.propVal.ival;
if (status === Constants.FE_Success) {
return (true);
} else {
return (false);
}
};
And these are the properties set by me:
function getSaveDefaultParams(){
var params, i;
params = GetSaveDefaultParams();
i = GetPropIndex(params, Constants.FS_FileType);
params.propVal.ival = Constants.FV_SaveFmtPdf;
i = GetPropIndex(saveParams, Constants.FS_AlertUserAboutFailure);
saveParams.propVal.ival = true;
i = GetPropIndex(saveParams, Constants.FS_FileType);
saveParams.propVal.ival = Constants.FV_SaveFmtPdf;
i = GetPropIndex(saveParams, Constants.FS_FileIsInUse);
saveParams.propVal.ival = Constants.FV_ResetLockAndContinue;
i = GetPropIndex(saveParams, Constants.FS_SaveFileNotWritable);
saveParams.propVal.ival = Constants.FV_DoShowDialog;
return (params);
};
Thanks a lot!
