<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>PDF document preview</title><link>https://community.appian.com/discussions/f/user-interface/12126/pdf-document-preview</link><description>I have a use case that needs to display a PDF or doc type document in a “FIT”/preview format. I thought the documentImage would work however it only works up to “LARGE” and not “FIT”. Is this a problem for anyone else and has anyone found a way to display</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: PDF document preview</title><link>https://community.appian.com/thread/79803?ContentTypeID=1</link><pubDate>Tue, 23 Feb 2021 19:53:43 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4e88a0b2-d4fe-4346-9116-e5a1d3c4718a</guid><dc:creator>Ani Dutta</dc:creator><description>&lt;p&gt;Hello, what is the best current solution (we are on release 20.4) for this? does the current document view component support this or alternatively is there a plugin available on Appian Market Place?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PDF document preview</title><link>https://community.appian.com/thread/55638?ContentTypeID=1</link><pubDate>Thu, 24 May 2018 13:28:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:683ee9b2-f170-46c0-9673-a491b0dbd375</guid><dc:creator>Sunil Zacharia</dc:creator><description>Please take a look at these:&lt;br /&gt;
&lt;a href="https://www.systoolsgroup.com/updates/file-does-not-begin-with-pdf/"&gt;www.systoolsgroup.com/.../&lt;/a&gt;&lt;br /&gt;
&lt;a href="https://forums.ni.com/t5/LabVIEW/File-does-not-begin-with-PDF-error-when-opening-PDFs-from/td-p/228001"&gt;forums.ni.com/.../228001&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
May be it helps! Good luck!&lt;br /&gt;
&lt;br /&gt;
Regards,&lt;br /&gt;
Sunil Zacharia&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PDF document preview</title><link>https://community.appian.com/thread/55636?ContentTypeID=1</link><pubDate>Thu, 24 May 2018 12:44:38 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1ade74bc-ac1a-49cf-ae9e-5abbd68a234c</guid><dc:creator>manishk0001</dc:creator><description>Could be ,not sure , as the above URL is blocked in my dev environment .Let me check in other system .Will update you .&lt;br /&gt;
&lt;br /&gt;
Thanks&lt;br /&gt;
&lt;br /&gt;
 Manish&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PDF document preview</title><link>https://community.appian.com/thread/55635?ContentTypeID=1</link><pubDate>Thu, 24 May 2018 12:41:25 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b70212d6-c74a-49d8-8ac7-9ddec573cbea</guid><dc:creator>Sunil Zacharia</dc:creator><description>Looks like it&amp;#39;s a browser issue. &lt;br /&gt;
One more check:&lt;br /&gt;
Are you able to open any other pdf&amp;#39;s in your browser?&lt;br /&gt;
&lt;br /&gt;
Try &lt;a href="http://unec.edu.az/application/uploads/2014/12/pdf-sample.pdf"&gt;unec.edu.az/.../pdf-sample.pdf&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
If this works try using the same pdf file for testing from Appian. If this does not work and you get the same error then we have look at your browser settings.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PDF document preview</title><link>https://community.appian.com/thread/55634?ContentTypeID=1</link><pubDate>Thu, 24 May 2018 12:33:54 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2f2f8c74-4cf2-4291-96a5-120d2a950ea0</guid><dc:creator>manishk0001</dc:creator><description>No, It is same issue ..in IE I tested that and it shows a error  pop up of &amp;quot;File does not begin with %PDF-&amp;quot;&lt;br /&gt;
I checked the file in KC and it is not corrupted and opening well .&lt;br /&gt;
&lt;br /&gt;
Thanks&lt;br /&gt;
&lt;br /&gt;
 Manish&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PDF document preview</title><link>https://community.appian.com/thread/55632?ContentTypeID=1</link><pubDate>Thu, 24 May 2018 12:05:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d4868113-aa6b-40e7-b8c0-c0c24ebd77cf</guid><dc:creator>Sunil Zacharia</dc:creator><description>&lt;p&gt;Hi Manish,&lt;/p&gt;
&lt;p&gt;I think this is causing the issue:&lt;/p&gt;
&lt;pre&gt;body: {&lt;/pre&gt;
&lt;pre&gt;todocument(local!document)&lt;/pre&gt;
&lt;pre&gt;}&lt;/pre&gt;
&lt;p&gt;Please remove the braces in the body element.&lt;/p&gt;
&lt;p&gt;should be&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;body: todocument(local!document)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please try this and let me know if it works.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Sunil Zacharia&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PDF document preview</title><link>https://community.appian.com/thread/55602?ContentTypeID=1</link><pubDate>Wed, 23 May 2018 16:02:44 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7b685429-a382-4cc1-b644-a4773fb012e6</guid><dc:creator>manishk0001</dc:creator><description>&lt;p&gt;Thanks Sunil for your quick response .&lt;br /&gt; &lt;br /&gt; I tried some thing like below in webApi:&lt;br /&gt; &lt;br /&gt; local!document: What I am passing as document ID passing as the parameter.&lt;br /&gt; &lt;br /&gt; like you explain i have two component the HttpResponse and the Body &lt;br /&gt; &lt;br /&gt; local!document: http!request.queryParameters.document,&lt;br /&gt; &lt;br /&gt; a!httpResponse(&lt;br /&gt; headers: {&lt;br /&gt; a!httpHeader(&lt;br /&gt; name:&amp;quot;Content-Type&amp;quot;,&lt;br /&gt; value:&amp;quot;application/pdf&amp;quot;&lt;br /&gt; ),&lt;br /&gt; a!httpHeader( &lt;br /&gt; name: &amp;quot;Content-Disposition&amp;quot;,&lt;br /&gt; value: &amp;quot;inline;filename=Data.pdf&amp;quot; &lt;br /&gt; )&lt;br /&gt; }, &lt;br /&gt; body: {&lt;br /&gt; todocument(local!document)&lt;br /&gt; }&lt;br /&gt; )&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I guess I am doing some basic mistake .let me know what is wrong .&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Cheers&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Manish&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PDF document preview</title><link>https://community.appian.com/thread/55594?ContentTypeID=1</link><pubDate>Wed, 23 May 2018 14:00:20 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:801525d6-9bb6-489a-8305-a3431a3d0654</guid><dc:creator>Sunil Zacharia</dc:creator><description>Hi Manish, &lt;br /&gt;
&lt;br /&gt;
The toDocument function takes a documentID as parameter and returns the appian document object. The documentID&amp;#39;s are unique for every document created in your appian environment irrespective of the KC.&lt;br /&gt;
&lt;br /&gt;
How did you create your webapi? What exactly does your webapi return as response?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PDF document preview</title><link>https://community.appian.com/thread/55593?ContentTypeID=1</link><pubDate>Wed, 23 May 2018 13:26:41 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:722576f8-20fc-4093-bc73-2d7efd230925</guid><dc:creator>manishk0001</dc:creator><description>&lt;p&gt;Hi Sunil ,&lt;br /&gt; &lt;br /&gt; I have followed above approach , when the hit the web- Api in the browser it shows an error of PDF not able to download.&lt;br /&gt; I have doubt on the toDocument function , how that function will understand that the Id which I am passing Id a document Id in the KC , as when i check the definition of toDocument function , it will return you a document , it did not care about the what is the parameter is ..&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Let me know if i am missing anything .&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Manish&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PDF document preview</title><link>https://community.appian.com/thread/54435?ContentTypeID=1</link><pubDate>Wed, 25 Apr 2018 09:23:30 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e9f1d16c-8e3b-41e0-af8f-bc7d387c633d</guid><dc:creator>Sunil Zacharia</dc:creator><description>&lt;p&gt;Hi Samuel,&lt;/p&gt;
&lt;p&gt;We had exactly the same issue that you are facing currently and we came up with a workaround for this which works perfectly as we wanted it to. May be this can help you as well.&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:underline;"&gt;&lt;strong&gt;Pre-requisite&lt;/strong&gt;&lt;/span&gt;:&lt;/p&gt;
&lt;p&gt;Latest version of Appian is required (it is 18.1 when this reply was posted)&lt;/p&gt;
&lt;p&gt;The browser used is &amp;quot;Google Chrome&amp;quot; with the below&amp;nbsp;extension installed&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Extension name&lt;/strong&gt;: PDF JS PDF Viewer (v 2.0.466 or higher)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Source&lt;/strong&gt;:&amp;nbsp;Chrome Web Store&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;License&lt;/strong&gt;: Free&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Here&amp;#39;s how you do it:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; Create a webAPI component that takes the appian documentID as a parameter and returns a response in the below format:&lt;/p&gt;
&lt;p&gt;(&lt;em&gt;In version18.1 you can use the &amp;#39;Document Download&amp;#39; template to automatically generate this code&lt;/em&gt;)&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:underline;"&gt;&lt;strong&gt;Headers&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Content-Type:&amp;nbsp;&lt;/strong&gt;&lt;em&gt;application/pdf&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Content-Disposition:&amp;nbsp;&lt;/strong&gt;&lt;em&gt;inline; filename=&amp;quot;&amp;lt;fileName&amp;gt;.pdf&amp;quot;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:underline;"&gt;&lt;strong class="StrongText---richtext_strong"&gt;Body&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The document itself (&lt;em&gt;todocument(&amp;lt;documentID&amp;gt;)&lt;/em&gt;)&lt;/p&gt;
&lt;p&gt;&lt;em&gt;(Exception handling is not specified here. But must be in place.)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2.&amp;nbsp;&lt;/strong&gt;Now your webAPI will have a URL that would look something like this: &lt;span style="font-size:inherit;"&gt;&lt;em&gt;&amp;lt;siteURL&amp;gt;/suite/webapi/document/12345&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(12345 will be your appian documentID)&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;If the pre-requisite mentioned above is in place then you will already see the PDF displayed in your browser on entering the above URL with an existing documentID. This will be your first test to see if this approach would suit your needs.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;3.&amp;nbsp;&lt;/strong&gt;In your SAIL interface you can now use the a!webContentField and&amp;nbsp;pass this URL&amp;nbsp;for the&amp;nbsp;&lt;em&gt;&lt;strong&gt;source&lt;/strong&gt; &lt;/em&gt;parameter. Use the&amp;nbsp;&lt;strong&gt;&lt;em&gt;height&amp;nbsp;&lt;/em&gt;&lt;/strong&gt;to get the desired preview size.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>