1

I'm using views PDF to print out a list of nodes on a single PDF, one per page. Now I have more than 1000 nodes/pages on a single generated pdf, so I'm trying to use VBO and Rules to create a view where I can filter/select the nodes I need and execute a Rule component that saves the resulting pdf on the server and sets a field "printed" to "yes" on those nodes.

The problem is that every time I fire my Rule the saved PDF has just the last selected node via VBO. On the "Views Arguments" of the "Save PDF as file on server” action, instead of [node:nid] I've tried writing manually some node ids (eg. 1,2,3...) and it works fine: the saved PDF has all the written nodes printed out.

Probably I have to write some PHP code to print the VBO-passed ids as a single csv argument. I've tried something like this and doesn't work, blank pdf page. How to debug?

<?
$vboNids=arg(1);
echo implode(",",$vboNids);
?>

Thanx in advance.

  • 1
    In your contextual filters did you check box the argument for allowing multiple arguments in the URL? – chadpeppers Aug 8 '14 at 1:41
  • Yes, sure. If I test the VBO view with "pass ids as arguments to a page" with my PDF page display as destination, it opens the pdf correctly with just the nodes selected printed out. It works, but my users need to save the file manually, while I need it to be saved on the server and change If I test my own rule by passing integers writing them in the arguments of "Save PDF as file on server", the resulting pdf is correct, but I need it to take the vbo ids. – Cheope Aug 8 '14 at 13:36
0

If I would like to save those files using vbo then I would try to create drupal action in your own module. And in this case you wouldn't need rules. Or you could revoke rules event if you would want to with rules_invoke_event function;

function mymodule_action_info() {
  return array(
    'dosomethinggoodfunction' => array(
      'type' => 'node',
      'label' => t('Do something'),
      'configurable' => FALSE,
      'triggers' => array('node_save'),
    ),
  );
}
function dosomethinggoodfunction($node) {
  // function to do some good stuff.
}
|improve this answer|||||
  • Thanx, I can try this. I'm a noob and I think it will take me almost one week to learn how to code actions. It could be great if it can be done through the UI instead, just because I've already done the most part -or I think so. I'm still trying to create a loop in the rule where concatenate nids incrementally in a string, then, outside the loop, pass it to my arguments... But surely there's an easier way... An already done variable... – Cheope Aug 8 '14 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.