Forum Discussion
Embedding Base64-encoded PDFs in Power BI reports doesn't work on iPhone.
My Power BI solution converts a PDF link to binary data, encodes it in base64, and splits the base64 string into 26,000-character chunks using the Split function. DAX then combines these chunks for display in a PDF viewer. While this approach works on desktops and Android phones, it encounters issues on iPhone with some pdf. Since these PDFs have varying sizes, large file size can be ruled out as the cause. The key indicator of an iPhone display issue is this: If a PDF appears clear and readable at 100% zoom on a desktop browser, it will likely display correctly on iPhone. Conversely, if the PDF appears blurry on the desktop at 100% zoom, it's unlikely to display on iPhone.
My Power Querry Code:
Link to binary:
Web.Contents([urls])
Binary to base64:
Binary.ToText([binary], BinaryEncoding.Base64)
Split base64:
Splitter.SplitTextByRepeatedLengths(26000)
My DAX function for combine:
base64 = pdf[base64.1]&pdf[base64.2]&pdf[base64.3]&pdf[base64.4]&pdf[base64.5]&pdf[base64.6]&pdf[base64.7]&pdf[base64.8]&pdf[base64.9]&pdf[base64.10]&pdf[base64.11]&pdf[base64.12]&pdf[base64.13]&pdf[base64.14]&pdf[base64.15]&pdf[base64.16]&pdf[base64.17]&pdf[base64.18]&pdf[base64.19]&pdf[base64.20]&pdf[base64.21]&pdf[base64.22]&pdf[base64.23]&pdf[base64.24]&pdf[base64.25]&pdf[base64.26]&pdf[base64.27]&pdf[base64.28]&pdf[base64.29]&pdf[base64.30]&pdf[base64.31]&pdf[base64.32]&pdf[base64.33]&pdf[base64.34]&pdf[base64.35]&pdf[base64.36]
Update:
- PDF on Power Bi desktop will not display on Iphone:
- PDF on Power Bi desktop will display on Iphone:
7 Replies
- lbendlin
Super User
Don't recombine manually. Use CONCATENATEX. Chris Webb's BI Blog: Storing Large Images In Power BI Datasets (crossjoin.co.uk)
Note that you can go a bit higher, 32000 is still safe.