Certificate Level II: "Add Files To Pdf" throws list index out of range error

Hi folks,

Can someone please help me resolve this error?

See: RPA.PDF library keywords

Pay attention to what types of input variables keyword takes in, and then match your call types with those. And at least in this case, keyword name tries also hint that by using plural form. And other hint is that “list index out of range” that should help you.

So in summary:

  • pay attention to types
  • pay attention to what error message is actually saying
  • pay attention to what keyword name is saying

Thanks for the inputs @jippo . I changed the variable type to use @ instead of $, then receive another error. Still figuring it out…

Here’s an example robot I tested with and this is the expected result:

@{images} =    Create List    devdata${/}robot.png    devdata${/}puppy.jpeg
Add Files To Pdf    ${images}    ${OUTPUT_DIR}${/}new_receipt.pdf    append=${True}

Use as target PDF the already existing source (like you’re doing already, no need to Open Pdf beforehand) and the append=${True} flag if you want the images appended to the already existing receipt (otherwise they will replace the content). Also you pass to Add Files To Pdf an expanded list of files → you have to pass the list itself by referencing it like a normal variable with $.

1 Like