Report distribution to PDF fails with "The given key was not present in the dictionary" or "File streams are not yet implemented." when a report includes certain PDF attachments. Recreate the PDF to work around it.
Symptoms
You distribute a report as PDF, and the report includes attachments returned by GETATTACHMENTS. The distribution fails while Velixo adds one specific PDF attachment to the distributed PDF. Other attachments work as expected.
The error message is one of the following:
-
The given key '...' was not present in the dictionary.The content in quotation marks varies from file to file. -
File streams are not yet implemented.
Where the message appears depends on how you run the distribution:
-
From Velixo NX: the Velixo NX task pane shows Distribution failed, with the error message below it.
-
As a scheduled distribution: the distribution log contains
Error running distribution:, followed by the error message.
The PDF attachment itself opens normally in Adobe Acrobat Reader and in web browsers.
The distribution stops at the row of the distribution list whose report includes the attachment. Rows before it have already been saved or emailed. That row and all rows after it are not processed.
Cause
Velixo NX uses Velixo Tools to combine your report and its PDF attachments into the distributed PDF. Some PDF generators write files with internal structures that are valid but unusual, and the PDF component in Velixo Tools can't read them. When it reaches such a file, the whole distribution fails.
The known cases are:
|
Error message |
Seen with PDFs produced by |
|---|---|
|
|
HP Exstream (for example, vendor invoices) |
|
|
Adobe InDesign, converted with Ghostscript |
Other PDF generators can produce the same structures.
Workaround: re-create the PDF
Create a new copy of the attachment by printing it to PDF, and use the copy instead of the original. Printing writes a new file that contains only what appears on the pages, without the structures that cause the error.
-
Open the PDF attachment in a PDF viewer or a web browser.
-
Select Print.
-
As the printer, select Microsoft Print to PDF. In a web browser, you can also select Save as PDF.
-
Save the new file.
-
In your ERP, attach the new file to the same record as the original attachment.
-
Remove the original attachment from the record, or make sure your formula no longer returns it.
-
Run the distribution again.
Use Print, not the Download or Save button in the PDF viewer. Download and Save keep the original file unchanged, so the error remains.
The printed copy may lose links, bookmarks, form fields, and digital signatures, and its page size or margins may change. Check the new file before you attach it.
Rows that were processed before the failure have already been saved or emailed. To avoid sending them twice, run the distribution again only for the remaining rows.
If you see a different error
If a PDF attachment fails with a different error message, contact Velixo Support. Include the PDF file and the full error message so the team can check the file.