Pdf - PdfWindowsLaunchParameters

18 Nov 20268 minutes to read

Represents Windows-specific parameters used by a launch action.

// Create a new PDF document
let document: PdfDocument = new PdfDocument();
let page: PdfPage = document.addPage();
// Create Windows-specific launch parameters
let windowsParameter: PdfWindowsLaunchParameters = new PdfWindowsLaunchParameters();
windowsParameter.fileName = 'input.pdf';
windowsParameter.directory = 'C:\\Documents';
windowsParameter.operation = 'open';
windowsParameter.parameters = '';
// Create a launch action
let fileSpecification: PdfFileSpecification = new PdfFileSpecification('input.pdf');
let action: PdfLaunchAction = new PdfLaunchAction(fileSpecification, true, windowsParameter);
// Create a button and assign the action
let field: PdfButtonField = new PdfButtonField(
    page, 'Launch', { x: 20, y: 20, width: 120, height: 30 }
);
field.text = 'Open file';
field.actions.mouseUp = action;
document.form.add(field);
// Save and destroy the document
document.save('output.pdf');
document.destroy();

Properties

Get directory string

Gets the default directory of the application or file.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Get the launch button
let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
// Get the launch action and default directory
let action: PdfLaunchAction = field.actions.mouseUp as PdfLaunchAction;
let directory: string = action.windowsParameter.directory;
// Save and destroy the document
document.save('output.pdf');
document.destroy();

Set directory void

Sets the default directory of the application or file.

// Create a new PDF document
let document: PdfDocument = new PdfDocument();
let page: PdfPage = document.addPage();
// Create Windows-specific launch parameters
let windowsParameter: PdfWindowsLaunchParameters = new PdfWindowsLaunchParameters();
windowsParameter.fileName = 'input.pdf';
windowsParameter.directory = 'C:\\Documents';
// Create a launch action
let fileSpecification: PdfFileSpecification = new PdfFileSpecification('input.pdf');
let action: PdfLaunchAction = new PdfLaunchAction(fileSpecification, windowsParameter);
// Create a button and assign the action
let field: PdfButtonField = new PdfButtonField(
    page, 'Launch', { x: 20, y: 20, width: 120, height: 30 }
);
field.actions.mouseUp = action;
document.form.add(field);
// Save and destroy the document
document.save('output.pdf');
document.destroy();
Parameter Type Description
value string The default directory of the application or file.

Get fileName string

Gets the name of the file to launch.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Get the launch button
let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
// Get the launch action and file name
let action: PdfLaunchAction = field.actions.mouseUp as PdfLaunchAction;
let fileName: string = action.windowsParameter.fileName;
// Save and destroy the document
document.save('output.pdf');
document.destroy();

Set fileName void

Sets the name of the file to launch.

// Create a new PDF document
let document: PdfDocument = new PdfDocument();
let page: PdfPage = document.addPage();
// Create Windows-specific launch parameters
let windowsParameter: PdfWindowsLaunchParameters = new PdfWindowsLaunchParameters();
windowsParameter.fileName = 'input.pdf';
// Create a launch action
let fileSpecification: PdfFileSpecification = new PdfFileSpecification('input.pdf');
let action: PdfLaunchAction = new PdfLaunchAction(fileSpecification, windowsParameter);
// Create a button and assign the action
let field: PdfButtonField = new PdfButtonField(
    page, 'Launch', { x: 20, y: 20, width: 120, height: 30 }
);
field.actions.mouseUp = action;
document.form.add(field);
// Save and destroy the document
document.save('output.pdf');
document.destroy();
Parameter Type Description
value string The name of the file to launch.

Get operation string

Gets the operation performed on the file.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Get the launch button
let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
// Get the launch action and operation
let action: PdfLaunchAction = field.actions.mouseUp as PdfLaunchAction;
let operation: string = action.windowsParameter.operation;
// Save and destroy the document
document.save('output.pdf');
document.destroy();

Set operation void

Sets the operation performed on the file.

// Create a new PDF document
let document: PdfDocument = new PdfDocument();
let page: PdfPage = document.addPage();
// Create Windows-specific launch parameters
let windowsParameter: PdfWindowsLaunchParameters = new PdfWindowsLaunchParameters();
windowsParameter.fileName = 'input.pdf';
windowsParameter.operation = 'open';
// Create a launch action
let fileSpecification: PdfFileSpecification = new PdfFileSpecification('input.pdf');
let action: PdfLaunchAction = new PdfLaunchAction(fileSpecification, windowsParameter);
// Create a button and assign the action
let field: PdfButtonField = new PdfButtonField(
    page, 'Launch', { x: 20, y: 20, width: 120, height: 30 }
);
field.actions.mouseUp = action;
document.form.add(field);
// Save and destroy the document
document.save('output.pdf');
document.destroy();
Parameter Type Description
value string The operation to perform on the file.

Get parameters string

Gets the parameters passed to the application.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Get the launch button
let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
// Get the launch action and application parameters
let action: PdfLaunchAction = field.actions.mouseUp as PdfLaunchAction;
let parameters: string = action.windowsParameter.parameters;
// Save and destroy the document
document.save('output.pdf');
document.destroy();

Set parameters void

Sets the parameters passed to the application.

// Create a new PDF document
let document: PdfDocument = new PdfDocument();
let page: PdfPage = document.addPage();
// Create Windows-specific launch parameters
let windowsParameter: PdfWindowsLaunchParameters = new PdfWindowsLaunchParameters();
windowsParameter.fileName = 'input.pdf';
windowsParameter.operation = 'open';
windowsParameter.parameters = '/A';
// Create a launch action
let fileSpecification: PdfFileSpecification = new PdfFileSpecification('input.pdf');
let action: PdfLaunchAction = new PdfLaunchAction(fileSpecification, windowsParameter);
// Create a button and assign the action
let field: PdfButtonField = new PdfButtonField(
    page, 'Launch', { x: 20, y: 20, width: 120, height: 30 }
);
field.actions.mouseUp = action;
document.form.add(field);
// Save and destroy the document
document.save('output.pdf');
document.destroy();
Parameter Type Description
value string The parameters to pass to the application.