Add/attach saved pdf to node with rules
For adding/attaching a file to a node using code you need a file object. If you know the path of the created PDF file, just try the following code in the hook you need. I used this code in hook_node_insert for attaching a programmatically created PDF file, while creating that node.

$source_node = node_load($nid); //load your required node here.
$file_path = 'your file path';
$file = new stdClass;
$file-&gt;uid = $source_node-&gt;uid;
$file-&gt;filename = $filename; //your file name;
$file-&gt;uri = $file_path;
$file-&gt;filemime = file_get_mimetype($file_path);
// Make it permanent, otherwise it will get deleted later.
$file-&gt;status = FILE_STATUS_PERMANENT;
// Save file object to make it a 'managed file'.
$file_obj = file_copy($file, 'new path for your file', FILE_EXISTS_REPLACE);


$source_node-&gt;your_file_field_name['und'][0] = array(
 'fid'  =&gt; $file_obj-&gt;fid,
 'uid'  =&gt; $file_obj-&gt;uid,
 'filename'  =&gt; $file_obj-&gt;filename,
 'uri'  =&gt; $file_obj-&gt;uri,
 'filemime'  =&gt; $file_obj-&gt;filemime,
 'filesize'  =&gt; $file_obj-&gt;filesize,
 'status'  =&gt; 1,
 'display'  =&gt; 1,
 'description'  =&gt; '', 
 );

node_save($source_node);


Hope this will help you.