<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: MapView.takeScreenshot() blank on iOS in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-takescreenshot-blank-on-ios/m-p/347319#M32102</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So it is of course my implementation that was at fault here. Basically I was trying to be too clever with the DPI and&amp;nbsp;the resulting image size was too big (I guess) when on ios. Instead, I set the screenshot options to be something like below which works how I was expecting (&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;isLandsape&lt;/SPAN&gt; is just a boolean I calculate elsewhere which is true if width &amp;gt; height and I'm setting the height and width to be appropriate for US Letter sized sheets):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;const&lt;/SPAN&gt; options &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    height&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; isLandscape &lt;SPAN class="operator token"&gt;?&lt;/SPAN&gt; props&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;view&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;height &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; window&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;devicePixelRatio &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;11&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;8.5&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; props&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;view&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;width &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; window&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;devicePixelRatio&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
    width&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; isLandscape &lt;SPAN class="operator token"&gt;?&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;11&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;8.5&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; props&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;view&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;height &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; window&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;devicePixelRatio &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; props&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;view&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;width &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; window&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;devicePixelRatio
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; __esri&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MapViewTakeScreenshotOptions&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ultimately i'm converting this image to a pdf and overlaying some logos and it's working beautifully now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 16:22:00 GMT</pubDate>
    <dc:creator>ToddAtkins</dc:creator>
    <dc:date>2021-12-11T16:22:00Z</dc:date>
    <item>
      <title>MapView.takeScreenshot() blank on iOS</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-takescreenshot-blank-on-ios/m-p/347318#M32101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've got a few different app I've developed that use the .takeScreenshot() method to export an image of the map. Everything works as expected on the desktop, but on iOS (both 12 and 13) and both iPad and iPhone devices, the screenshot is just a blank black image.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I'm using the dataUrl property of the screenshot result to generate a pdf using jspdf. But even just opening the dataUrl in the browser shows me a blank black image. I've seen some references on the web that if the base64 string isn't divisible by 4 then it won't render, but that isn't the case here since the string&amp;nbsp;is divisible by 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wondering if this is a bug with iOS, the JS API, or my implementation. It works fine in Safari for the desktop along with the other desktop browsers so I lean towards an iOS issue, but maybe somebody else out there has run across this and has a working solution...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Specs:&lt;/P&gt;&lt;P&gt;iOS 12 &amp;amp; 13&lt;/P&gt;&lt;P&gt;iPhone X&lt;/P&gt;&lt;P&gt;JS API 4.11 &amp;amp; 4.12&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;const&lt;/SPAN&gt; options &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    height&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;8.5&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; dpi&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
    width&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;11&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; dpi
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; __esri&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MapViewTakeScreenshotOptions&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;try&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;const&lt;/SPAN&gt; screenshot &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;await&lt;/SPAN&gt; props&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;view&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;takeScreenshot&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;options&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;catch&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token class-name"&gt;error&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    console&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;error&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;error&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:21:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-takescreenshot-blank-on-ios/m-p/347318#M32101</guid>
      <dc:creator>ToddAtkins</dc:creator>
      <dc:date>2021-12-11T16:21:58Z</dc:date>
    </item>
    <item>
      <title>Re: MapView.takeScreenshot() blank on iOS</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-takescreenshot-blank-on-ios/m-p/347319#M32102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So it is of course my implementation that was at fault here. Basically I was trying to be too clever with the DPI and&amp;nbsp;the resulting image size was too big (I guess) when on ios. Instead, I set the screenshot options to be something like below which works how I was expecting (&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;isLandsape&lt;/SPAN&gt; is just a boolean I calculate elsewhere which is true if width &amp;gt; height and I'm setting the height and width to be appropriate for US Letter sized sheets):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;const&lt;/SPAN&gt; options &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    height&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; isLandscape &lt;SPAN class="operator token"&gt;?&lt;/SPAN&gt; props&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;view&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;height &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; window&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;devicePixelRatio &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;11&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;8.5&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; props&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;view&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;width &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; window&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;devicePixelRatio&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
    width&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; isLandscape &lt;SPAN class="operator token"&gt;?&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;11&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;8.5&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; props&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;view&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;height &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; window&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;devicePixelRatio &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; props&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;view&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;width &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; window&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;devicePixelRatio
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; __esri&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MapViewTakeScreenshotOptions&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ultimately i'm converting this image to a pdf and overlaying some logos and it's working beautifully now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:22:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/mapview-takescreenshot-blank-on-ios/m-p/347319#M32102</guid>
      <dc:creator>ToddAtkins</dc:creator>
      <dc:date>2021-12-11T16:22:00Z</dc:date>
    </item>
  </channel>
</rss>

