Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
mrjizz
Frequent Visitor

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: 

mrjizz_0-1715993867336.png

- PDF on Power Bi desktop will display on Iphone:

mrjizz_1-1715994050625.png

 

 

 

 

 

7 REPLIES 7
lbendlin
Super User
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.

 

 

My base64 is divided horizontally, so using DAX CONCATENATEX will be quite difficult with many columns.

mrjizz_0-1715994161491.png

 

You need to unpivot these columns. Power BI is not Excel.

My database needs a unique value to be the primary key, so I split the base64 code into multiple columns.

The PDFName can be your key column. The fragments must be stored in a fact table with only three columns. Document key, Fragment index, payload.

i had tried this but it make my report freeze, maybe my database is very large about 700 rows and will increase in feuture. In my opinion, the problem is not how i split my data because my report is working on android.

 

You can choose to believe that. I hope someone else can help you further.

Helpful resources

Announcements
Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

Top Solution Authors