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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Kudoed Authors