- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2019 09:49 AM
Still waiting on some way to natively display .PDF files within a knowledge article. I know there used to be an app on Share that would handle this, but I'm not finding it anymore (and I think it got deprecated). Currently, I'm having my user base convert the .PDFs to .DOCX, then import those documents using the OOB functionality, but the formatting is never perfect. I suspect the same challenges will exist if I have them convert to HTML.
Does anyone have a good solution for this?
Solved! Go to Solution.
- Labels:
-
Knowledge Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2019 11:44 PM
You can use ServiceNow Document Viewer plugin to display PDF in articles.
1. Whitelist iframe tag and src, height, width attributes by updating HTMLSanitizerConfig.
2. Enable ServiceNow Document Viewer plugin. I think this requires additional license.
3. Attach PDF file to your article. Use source code button to open HTML Source code of the article and add iframe tag to display PDF in your article. The sysparm_sys_id parameter is the sys_id of your attachment.
4. Publish your article.
Article will be displayed as shown below.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2019 08:32 AM
Yeah, I found that as well. Not sure why the creds aren't being passed, but please update here when you get a response to your HI ticket. Is there a PRB associated with the issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2020 07:18 AM
I ended up closing the HI ticket as I had another project kicking off...
we did, however, upgrade to New York and in my testing, it seems that users no longer have to provide credentials to view embedded PDF's....so that is resolved in NYp3+
I do see a problem with this method though... it requires someone to update the HTML on the article to reference the sys_attachment. I will begin working on a record producer that will allow the user to submit a KB article with attachment and will script the creation of the HTML information...
Cheers !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2020 08:34 AM
Yeah, there was a recent patch that was supposed to address this issue and so far after Madrid Patch 3a my users are no longer reporting the problem.
Thanks, John!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2020 05:28 AM
Hi
Thank you for your reply, It was helpful to us, In addiction to that, how we will do the same with multiple PDF documents. How will show that. Kindly help me on the same.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2021 10:28 PM
Do automation to create Knowledge article and attach file to that :
gr.addQuery('number','KB0010004');
gr.query();
while (gr.next()){
var attachment_id;
var attachment = new GlideRecord('sys_attachment');
attachment.addQuery('table_sys_id',gr.sys_id);
attachment.query();
if(attachment.next()){
gs.addInfoMessage('sys_id of the attachment is : ' +attachment.sys_id);
attachment_id = attachment.sys_id;
var url = "$viewer.do?sysparm_stack=no&sysparm_sys_id=" + attachment_id ;
gr.text = "<p><iframe src= " + url + " width='100%' height='700px'></iframe></p><p><br /></p>";
gr.update();
}
}