Skip to main content
Nintex Community Menu Bar

read file document as Base64

  • September 23, 2022
  • 8 replies
  • 363 views

Akhanjer
Forum|alt.badge.img+5

hello,

i need to preview pdf file in Ifram as (base64) but how can get file as base64 in order to render in ifram to preview the file  please check image . please note this document get from smart object related to SharePoint document library . 

 

26490iFCAF0A86083E0B36.png 

Translate
Did this topic help you find an answer to your question?

8 replies

Forum|alt.badge.img+7
  • Nintex Employee
  • 40 replies
  • September 26, 2022

Hi,


 


Your iframe html looks to be set up correctly, I think that it is just what you are passing in that is the issue.


 


K2 stores documents as a base64 encoded string with an XML wrapper. e.g.


<file><name>My Document.pdf</name><content>iVBORw0KGgoAAAANSUhEUgAAADAAAAxxxxx</content></file> you will need to extract this from the xml and use that in your data uri.


 


 

Translate

Akhanjer
Forum|alt.badge.img+5
  • Author
  • Rookie
  • 24 replies
  • September 26, 2022

thanks Nics,


 


but the document stored in SharePoint and how i cane view XML format ?


 

Translate

Forum|alt.badge.img+7
  • Nintex Employee
  • 40 replies
  • September 26, 2022

Have you tried passing the SharePoint url of the PDF to the iframe instead of a data uri?

Translate

Akhanjer
Forum|alt.badge.img+5
  • Author
  • Rookie
  • 24 replies
  • September 26, 2022

yes and not working also i need file as base64 . 

Translate

Akhanjer
Forum|alt.badge.img+5
  • Author
  • Rookie
  • 24 replies
  • September 27, 2022

hi Nics,


 


i create custom C# assembly in order to pass Document then return base64 . but the content is empty .please check the screen shot  .


Translate

Forum|alt.badge.img+7
  • Nintex Employee
  • 40 replies
  • September 27, 2022

You are on the right track with the endpoint assembly broker option to extract the base64 text.

When you test your SmartObject does this return any data? Also have you debugged the code?

Translate

Akhanjer
Forum|alt.badge.img+5
  • Author
  • Rookie
  • 24 replies
  • September 27, 2022

Hello,


 


yes smartobject return data but the problem when pass document to my function  also i changed input from string to XmlDocument but the same issue . 


 

Translate

Forum|alt.badge.img+5
  • Nintex Employee
  • 46 replies
  • October 3, 2022

Hi


Please review this blog article where it explains how to setup an iframe inside a smartform that will allow you to preview a document stored in SharePoint.


 

Translate

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings