VBO Custom Operation to create pdf of selected nodes detail page I need to create an vbo action to produce a seperate document (pdf) of every selected node's detail page (node--content.tpl.php).

What i have to do for that..??

Right now i am creating simple pdf with dummy variables to check pdf is generate or not,

For that i done the following code

function MYMODULE_action_info() {
    return array(
        'export_pdf_bulk' =&gt; array(
        'type' =&gt; 'entity', 
        'label' =&gt; t('Export PDF'),
        'configurable' =&gt; FALSE, 
        'behavior' =&gt; array('view_property'),
        'triggers' =&gt; array('any'),   
        ),
    );


function export_pdf_bulk(&amp;$entity, $context) {

$html = '&lt;html&gt;&lt;body&gt;';
$html.="&lt;div class='test' id='test_print'&gt;";
$html.="&lt;p align='center'&gt;&lt;b&gt;Testing&lt;/b&gt;&lt;/p&gt;";
$html.="&lt;p&gt;Dear Sir/Madam,&lt;/p&gt;";
$html.="&lt;p&gt;&lt;/p&gt;";
$html.="&lt;p&gt;Testing string Here&lt;/p&gt;";
$html.="&lt;p&gt;&lt;/p&gt;";
$html.="&lt;p&gt;Details are as follows:&lt;/p&gt;";
$html.="&lt;p&gt;&lt;/p&gt;"; 
$html.="&lt;/div&gt;";
$html .= '&lt;/body&gt;&lt;/html&gt;';

pdf_using_mpdf_api($html, "Track grievances");
}


Using this code to generate dummy pdf (Use MPDF for generate pdf https://www.drupal.org/project/pdf_using_mpdf) for selected content, i got the ajax error and in error pdf content is displayed in junk characters, but ajax code is 200 and status is ok, then why pdf is now downloading and display in ajax error in junk characters??
You can achieve this using rules. Import following component &amp; add Rule component in Views bulk operation list as shown in figure below:

{ "rules_create_pdf" : {
    "LABEL" : "Create PDF",
    "PLUGIN" : "action set",
    "OWNER" : "rules",
    "REQUIRES" : [ "php", "rules" ],
    "USES VARIABLES" : { "node" : { "label" : "Node", "type" : "node" } },
    "ACTION SET" : [
      { "php_eval" : { "code" : "$view = node_view($node, \u0027PDF\u0027);\r\n$html = drupal_render($view);\r\npdf_using_mpdf_library_exist();\r\n_pdf_using_mpdf_generator($html, \u0027node-\u0027.$node-\u003Enid);" } }
    ]
  }
}


In order to save PDF files at server use above Rule component &amp; comment two line given below in pdf_using_mpdf.module of function _pdf_using_mpdf_generator. You can find that on line no. 324 &amp; 325 of pdf_using_mpdf 7.x-2.6.

//drupal_goto($_SERVER['HTTP_REFERER']);
//exit;


Figure: