What is the proper UNC path syntax to set a background programmatically in a Control Script. I can get it to work locally, but need to pull the resource from a different server.
var infile = ‘D:/Temp/’ + record.fields.original;
// Initially disable output for the Print sections
merge.template.contexts.PRINT.sections[‘AttachmentP’].enabled = false;
merge.template.contexts.PRINT.sections[‘AttachmentL’].enabled = false;
if(resource(infile)){
//Set the background url
var resourceUrl = infile;
//Collect the width and height
var pdf = resource(infile);
var height = pdf.height;
var width = pdf.width;
var numberOfPages = pdf.pages;
// Enable a print section based on the width portrait vs landscape
if(width >= ‘650’) {
merge.template.contexts.PRINT.sections[‘AttachmentL’].enabled = true;
merge.template.contexts.PRINT.sections[‘AttachmentL’].background.url = resourceUrl;
} else {
merge.template.contexts.PRINT.sections[‘AttachmentP’].enabled = true;
merge.template.contexts.PRINT.sections[‘AttachmentP’].background.url = resourceUrl;
}
} else {
//oops
}
Unless I am mistaken, that would be //server_name/path…/file
I thought that I’d tried that already, but apparently not.
BTW… the script debug tool is an awesome addition!
You are preaching to the choir!!! But I have to agree…that is an awesome tool!!!
Quick question With my control script, is there anything different I need to do to get it to work with version 1.4? I have PDF or TIF files (which indicates is supported)
var infile = ‘D:/Temp/’ + record.fields.original;
// Initially disable output for the Print sections
merge.template.contexts.PRINT.sections[‘AttachmentP’].enabled = false;
merge.template.contexts.PRINT.sections[‘AttachmentL’].enabled = false;
if(resource(infile)){
//Set the background url
var resourceUrl = infile;
//Collect the width and height
var pdf = resource(infile);
var height = pdf.height;
var width = pdf.width;
var numberOfPages = pdf.pages;
// Enable a print section based on the width portrait vs landscape
if(width >= ‘650’) {
merge.template.contexts.PRINT.sections[‘AttachmentL’].enabled = true;
merge.template.contexts.PRINT.sections[‘AttachmentL’].background.url = resourceUrl;
} else {
merge.template.contexts.PRINT.sections[‘AttachmentP’].enabled = true;
merge.template.contexts.PRINT.sections[‘AttachmentP’].background.url = resourceUrl;
}
} else {
//oops
}
I thought it was a permissions issue, but with proof print it attaches the image as a background, but when I process with workflow it doesn’t.
With version 2019.1 when the image is a TIFF it will render fine, but with 1.4 the TIFF is a red x