### Open Claude with Documentation Context (JavaScript) Source: https://www.nutrient.io/guides/react-native/migration-guides/react-native-2-12-migration-guide Opens a new tab with Claude AI, pre-populated with a prompt containing the current Nutrient.io documentation URL and a request for assistance. This enables users to get context-specific help from Claude. ```javascript function x(i){ const t="https://www.nutrient.io", o=window.location.pathname, r=`I'm looking at this Nutrient documentation: ${`${t}${o}`} Help me understand how to use it. Be ready to explain concepts, give examples, or help debug based on it.`; s=`https://claude.ai/new?q=${encodeURIComponent(r)}`; window.open(s,"_blank") } ``` -------------------------------- ### Install Nutrient React Native SDK Source: https://www.nutrient.io/sdk/react-native/getting-started Installs the Nutrient React Native SDK using either Yarn or npm. This is the primary command for adding the dependency to your project. ```bash yarn add @nutrient-sdk/react-native ``` ```bash npm install @nutrient-sdk/react-native ``` -------------------------------- ### Open ChatGPT with Context (JavaScript) Source: https://www.nutrient.io/guides/react-native/migration-guides/react-native-3-migration-guide Opens ChatGPT in a new tab, pre-populated with a query that includes the current documentation page URL and a request for assistance. This helps users get AI-powered help related to the documentation. ```javascript function v(i){ const t="https://www.nutrient.io", o=window.location.pathname, r=`I'm looking at this Nutrient documentation: ${`${t}${o}`} Help me understand how to use it. Be ready to explain concepts, give examples, or help debug based on it.`, s=`https://chatgpt.com/?q=${encodeURIComponent(r)}`; window.open(s,"_blank") } ``` -------------------------------- ### Open Claude AI with Context (JavaScript) Source: https://www.nutrient.io/guides/react-native/migration-guides/react-native-3-migration-guide Opens Claude AI in a new tab, pre-populated with a query that includes the current documentation page URL and a request for assistance. This enables users to get AI-driven explanations and debugging help. ```javascript function x(i){ const t="https://www.nutrient.io", o=window.location.pathname, r=`I'm looking at this Nutrient documentation: ${`${t}${o}`} Help me understand how to use it. Be ready to explain concepts, give examples, or help debug based on it.`, s=`https://claude.ai/new?q=${encodeURIComponent(r)}`; window.open(s,"_blank") } ``` -------------------------------- ### Install Project Dependencies with Yarn Source: https://www.nutrient.io/sdk/react-native/getting-started Installs all necessary project dependencies managed by Yarn. This command should be run after adding new packages to your project. ```bash yarn install ``` -------------------------------- ### React Native NutrientView Component Example Source: https://www.nutrient.io/guides/react-native/troubleshooting/react-navigation This JavaScript snippet demonstrates a basic React Native component using `NutrientView`. It shows how to import `NutrientView` and render it within a standard React Native `View`. Ensure `@nutrient-sdk/react-native` is installed. ```javascript import { View } from 'react-native'; import NutrientView from '@nutrient-sdk/react-native'; import React, { Component } from 'react'; export class NutrientViewComponent extends BaseExampleAutoHidingHeaderComponent { render() { return ( ); } } ``` -------------------------------- ### Open Documentation in Claude AI (JavaScript) Source: https://www.nutrient.io/guides/react-native/open-a-document/from-local-storage Launches a new browser tab with the Claude AI chat interface, pre-filled with a prompt that references the current documentation URL and asks for help. This allows users to quickly get AI assistance tailored to the documentation they are viewing. ```javascript function x(i){ const t="https://www.nutrient.io", o=window.location.pathname, r=`I'm looking at this Nutrient documentation: ${`${t}${o}`} Help me understand how to use it. Be ready to explain concepts, give examples, or help debug based on it.`,s=`https://claude.ai/new?q=${encodeURIComponent(r)}`; window.open(s,"_blank") } ``` -------------------------------- ### Install iOS Pods via Terminal Source: https://www.nutrient.io/guides/react-native/migration-guides/react-native-2-8-migration-guide This command instructs you to navigate to your project's `ios` directory and run `pod install`. This command is essential after modifying your `Podfile` or deleting `Podfile.lock` to update and install the necessary iOS dependencies for your React Native project. ```bash pod install ``` -------------------------------- ### Open in ChatGPT (JavaScript) Source: https://www.nutrient.io/guides/react-native/instant-synchronization/authentication Opens a new browser tab with a pre-filled prompt for ChatGPT, asking for an explanation of the current Nutrient.io documentation page. The prompt includes the current page URL and requests explanations, examples, or debugging help. ```javascript function v(i){ const t="https://www.nutrient.io", o=window.location.pathname, r=`I'm looking at this Nutrient documentation: ${`${t}${o}`} Help me understand how to use it. Be ready to explain concepts, give examples, or help debug based on it.`; s=`https://chatgpt.com/?q=${encodeURIComponent(r)}` window.open(s,"_blank") } ``` -------------------------------- ### Open Grok AI with Context (JavaScript) Source: https://www.nutrient.io/sdk/react-native/getting-started Opens a new tab directed to Grok AI, pre-populated with a query that references the current Nutrient documentation page. This enables users to get context-specific assistance from Grok. ```javascript function C(i){ const t="https://www.nutrient.io", o=window.location.pathname, r=`I'm looking at this Nutrient documentation: ${`${t}${o}`} Help me understand how to use it. Be ready to explain concepts, give examples, or help debug based on it.`; const s=`https://grok.com/c?q=${encodeURIComponent(r)}`; window.open(s,"_blank") } ``` -------------------------------- ### Open in Grok AI (JavaScript) Source: https://www.nutrient.io/guides/react-native/instant-synchronization/authentication Opens a new browser tab with a pre-filled prompt for Grok AI, seeking help with the current Nutrient.io documentation. The prompt includes the current page URL and requests explanations, examples, or debugging assistance. ```javascript function C(i){ const t="https://www.nutrient.io", o=window.location.pathname, r=`I'm looking at this Nutrient documentation: ${`${t}${o}`} Help me understand how to use it. Be ready to explain concepts, give examples, or help debug based on it.`; s=`https://grok.com/c?q=${encodeURIComponent(r)}` window.open(s,"_blank") } ``` -------------------------------- ### Open in Claude AI (JavaScript) Source: https://www.nutrient.io/guides/react-native/instant-synchronization/authentication Opens a new browser tab with a pre-filled prompt for Claude AI, requesting assistance with the current Nutrient.io documentation page. The prompt includes the current URL and asks for explanations, examples, or debugging help. ```javascript function x(i){ const t="https://www.nutrient.io", o=window.location.pathname, r=`I'm looking at this Nutrient documentation: ${`${t}${o}`} Help me understand how to use it. Be ready to explain concepts, give examples, or help debug based on it.`; s=`https://claude.ai/new?q=${encodeURIComponent(r)}` window.open(s,"_blank") } ``` -------------------------------- ### Initialize Nutrient Plugin in React Native Source: https://www.nutrient.io/guides/react-native/migration-guides/react-native-2-8-migration-guide This snippet demonstrates how to initialize the Nutrient plugin in a React Native application by calling `setLicenseKey` upon application start. It requires the `react-native` module and assumes the `PSPDFKit` native module is available. The license key can be set to `null` for trial mode. ```javascript import { NativeModules } from 'react-native'; const PSPDFKit = NativeModules.PSPDFKit; PSPDFKit.setLicenseKey(null); ``` -------------------------------- ### VWO Code Initialization (JavaScript) Source: https://www.nutrient.io/guides/react-native/migration-guides/react-native-2-13-migration-guide This snippet initializes the Visual Website Optimizer (VWO) code for A/B testing. It includes account ID, version, settings tolerance, and logic for loading settings from local storage or session storage. It also defines functions for adding scripts and finishing the VWO setup. ```javascript window._vwo_code || (function() { var account_id = 892495, version = 2.1, settings_tolerance = 2000, hide_element = '', // Don't hide body to prevent flash hide_element_style = '', /* DO NOT EDIT BELOW THIS LINE */ f = false, w = window, d = document, v = d.querySelector('#vwoCode'), cK = '_vwo_' + account_id + '_settings', cc = {}; try { var c = JSON.parse(localStorage.getItem('_vwo_' + account_id + '_config')); cc = c && typeof c === 'object' ? c : {}; } catch (e) {} var stT = cc.stT == 'session' ? w.sessionStorage : w.localStorage; code = { nonce: v && v.nonce, library_tolerance: function() { return typeof library_tolerance !== 'undefined' ? library_tolerance : undefined; }, settings_tolerance: function() { return cc.sT || settings_tolerance; }, hide_element_style: function() { return '{' + (cc.hES || hide_element_style) + '}'; }, hide_element: function() { // Always return empty to prevent hiding return ''; }, getVersion: function() { return version; }, finish: function(e) { if (!f) { f = true; var t = d.getElementById('_vis_opt_path_hides'); if (t) t.parentNode.removeChild(t); if (e)(new Image).src = 'https://dev.visualwebsiteoptimizer.com/ee.gif?a=' + account_id + e; } }, finished: function() { return f; }, addScript: function(e) { var t = d.createElement('script'); t.type = 'text/javascript'; if (e.src) { t.src = e.src; t.async = true; // Make async } else { t.text = e.text; } v && t.setAttribute('nonce', v.nonce); d.getElementsByTagName('head')[0].appendChild(t); }, load: function(e, t) { var n = this.getSettings(), i = d.createElement('script'), r = this; t = t || {}; if (n) { i.textContent = n; d.getElementsByTagName('head')[0].appendChild(i); if (!w.VWO || VWO.caE) { stT.removeI ``` -------------------------------- ### VWO A/B Testing Configuration and Script Loading Source: https://www.nutrient.io/guides/react-native/troubleshooting/getting-the-currently-used-version This JavaScript snippet initializes Visual Website Optimizer (VWO) for A/B testing. It defines account ID, version, settings tolerance, and variables for hiding elements. It includes logic for retrieving settings from local storage, handling script loading, and finishing the VWO setup. The code appears to be part of a larger VWO integration, potentially for loading variations or campaign assets. ```javascript window._vwo_code || (function() { var account_id=892495, version=2.1, settings_tolerance=2000, hide_element='', hide_element_style = ''; f=false,w=window,d=document,v=d.querySelector('#vwoCode'),cK='_vwo_'+account_id+'_settings',cc={}; try{ var c=JSON.parse(localStorage.getItem('_vwo_'+account_id+'_config')); cc=c&&typeof c==='object'?c:{} } catch(e){} var stT=cc.stT==='session'?w.sessionStorage:w.localStorage; code={ nonce:v&&v.nonce, library_tolerance:function(){return typeof library_tolerance!=='undefined'?library_tolerance:undefined}, settings_tolerance:function(){return cc.sT||settings_tolerance}, hide_element_style:function(){return'{'+(cc.hES||hide_element_style)+'}'}, hide_element:function(){ return ''; }, getVersion:function(){return version}, finish:function(e){ if(!f){ f=true; var t=d.getElementById('_vis_opt_path_hides'); if(t)t.parentNode.removeChild(t); if(e)(new Image).src='https://dev.visualwebsiteoptimizer.com/ee.gif?a='+account_id+e } }, finished:function(){return f}, addScript:function(e){ var t=d.createElement('script'); t.type='text/javascript'; if(e.src){ t.src=e.src; t.async=true; }else{ t.text=e.text } v&&t.setAttribute('nonce',v.nonce); d.getElementsByTagName('head')[0].appendChild(t) }, load:function(e,t){ var n=this.getSettings(),i=d.createElement('script'),r=this; t=t||{}; if(n){ i.textContent=n; d.getElementsByTagName('head')[0].appendChild(i); if(!w.VWO||VWO.caE){ stT.removeI ``` -------------------------------- ### Visual Website Optimizer (VWO) Initialization Script Source: https://www.nutrient.io/guides/react-native/instant-synchronization/authentication This JavaScript code initializes the Visual Website Optimizer (VWO) tracking. It includes account ID, version, settings tolerance, and optional element hiding configurations. It attempts to load VWO settings from local storage and includes logic for handling script loading and finishing the VWO setup. ```javascript window._vwo_code || (function() { var account_id = 892495, version = 2.1, settings_tolerance = 2000, hide_element = '', // Don't hide body to prevent flash hide_element_style = '', /* DO NOT EDIT BELOW THIS LINE */ f = false, w = window, d = document, v = d.querySelector('#vwoCode'), cK = '_vwo_' + account_id + '_settings', cc = {}; try { var c = JSON.parse(localStorage.getItem('_vwo_' + account_id + '_config')); cc = c && typeof c === 'object' ? c : {}; } catch (e) {} var stT = cc.stT === 'session' ? w.sessionStorage : w.localStorage; var code = { nonce: v && v.nonce, library_tolerance: function() { return typeof library_tolerance !== 'undefined' ? library_tolerance : undefined; }, settings_tolerance: function() { return cc.sT || settings_tolerance; }, hide_element_style: function() { return '{' + (cc.hES || hide_element_style) + '}'; }, hide_element: function() { // Always return empty to prevent hiding return ''; }, getVersion: function() { return version; }, finish: function(e) { if (!f) { f = true; var t = d.getElementById('_vis_opt_path_hides'); if (t) t.parentNode.removeChild(t); if (e)(new Image).src = 'https://dev.visualwebsiteoptimizer.com/ee.gif?a=' + account_id + e; } }, finished: function() { return f; }, addScript: function(e) { var t = d.createElement('script'); t.type = 'text/javascript'; if (e.src) { t.src = e.src; t.async = true; // Make async } else { t.text = e.text; } v && t.setAttribute('nonce', v.nonce); d.getElementsByTagName('head')[0].appendChild(t); }, load: function(e, t) { var n = this.getSettings(), i = d.createElement('script'), r = this; t = t || {}; if (n) { i.textContent = n; d.getElementsByTagName('head')[0].appendChild(i); if (!w.VWO || VWO.caE) { stT.removeI ``` -------------------------------- ### Open ChatGPT with Documentation Context (JavaScript) Source: https://www.nutrient.io/guides/react-native/migration-guides/react-native-2-12-migration-guide Opens a new tab with ChatGPT, pre-populated with a prompt that includes the current Nutrient.io documentation URL and a request for assistance. This facilitates context-aware AI interaction. ```javascript function v(i){ const t="https://www.nutrient.io", o=window.location.pathname, r=`I'm looking at this Nutrient documentation: ${`${t}${o}`} Help me understand how to use it. Be ready to explain concepts, give examples, or help debug based on it.`; s=`https://chatgpt.com/?q=${encodeURIComponent(r)}`; window.open(s,"_blank") } ``` -------------------------------- ### Open Grok Prompt (JavaScript) Source: https://www.nutrient.io/guides/react-native/migration-guides/react-native-2-2-migration-guide Opens a new tab with a Grok prompt pre-filled with context about the current Nutrient.io documentation page. The prompt asks for help understanding or debugging the documentation. ```javascript function C(i){ const t="https://www.nutrient.io", o=window.location.pathname, r=`I'm looking at this Nutrient documentation: ${`${t}${o}`} Help me understand how to use it. Be ready to explain concepts, give examples, or help debug based on it.`; window.open(`https://grok.com/c?q=${encodeURIComponent(r)}`,"_blank") } ``` -------------------------------- ### Install React Native Nightly with Yarn Source: https://www.nutrient.io/guides/react-native/troubleshooting/nightlies Installs the nightly build of the React Native SDK by specifying the GitHub repository and 'nightly' branch. This command is executed in a terminal. ```bash yarn add @nutrient-sdk/react-native@github:PSPDFKit/react-native#nightly ``` -------------------------------- ### Open Grok with Documentation Context (JavaScript) Source: https://www.nutrient.io/guides/react-native/migration-guides/react-native-2-12-migration-guide Opens a new tab with Grok AI, pre-populated with a prompt that includes the current Nutrient.io documentation URL and a request for help. This allows users to leverage Grok for assistance related to the documentation. ```javascript function C(i){ const t="https://www.nutrient.io", o=window.location.pathname, r=`I'm looking at this Nutrient documentation: ${`${t}${o}`} Help me understand how to use it. Be ready to explain concepts, give examples, or help debug based on it.`; s=`https://grok.com/c?q=${encodeURIComponent(r)}`; window.open(s,"_blank") } ``` -------------------------------- ### Open Claude.ai Prompt (JavaScript) Source: https://www.nutrient.io/guides/react-native/migration-guides/react-native-2-2-migration-guide Opens a new tab with a Claude.ai prompt pre-filled with context about the current Nutrient.io documentation page. The prompt asks for help understanding or debugging the documentation. ```javascript function x(i){ const t="https://www.nutrient.io", o=window.location.pathname, r=`I'm looking at this Nutrient documentation: ${`${t}${o}`} Help me understand how to use it. Be ready to explain concepts, give examples, or help debug based on it.`; window.open(`https://claude.ai/new?q=${encodeURIComponent(r)}`,"_blank") } ``` -------------------------------- ### Getting Annotations Example Source: https://www.nutrient.io/guides/react-native/annotations/create-edit-and-remove/programmatic Demonstrates how to retrieve annotations from a specific page or the entire document. ```APIDOC ## Getting All Annotations ### Description Examples for retrieving annotations from the document. ### Example: Get all ink annotations on the first page ```javascript // Get all ink annotations on the first page of the document. const allInkAnnotations = await this.pdfRef.current?.getDocument().getAnnotationsForPage(0, Annotation.Type.INK); ``` ### Example: Get all annotations on the entire document ```javascript // Get all annotations on the entire document. const allAnnotations = await this.pdfRef.current?.getDocument().getAnnotations(); ``` ``` -------------------------------- ### Change Directory in Terminal Source: https://www.nutrient.io/sdk/react-native/getting-started Navigate to your project's root directory using the terminal. This is a prerequisite for running subsequent installation commands. ```bash cd path/to/YourProject ``` -------------------------------- ### Open ChatGPT Prompt (JavaScript) Source: https://www.nutrient.io/guides/react-native/migration-guides/react-native-2-2-migration-guide Opens a new tab with a ChatGPT prompt pre-filled with context about the current Nutrient.io documentation page. The prompt asks for help understanding or debugging the documentation. ```javascript function v(i){ const t="https://www.nutrient.io", o=window.location.pathname, r=`I'm looking at this Nutrient documentation: ${`${t}${o}`} Help me understand how to use it. Be ready to explain concepts, give examples, or help debug based on it.`; window.open(`https://chatgpt.com/?q=${encodeURIComponent(r)}`,"_blank") } ``` -------------------------------- ### Get PSPDFKit Version in Swift Source: https://www.nutrient.io/guides/react-native/troubleshooting/getting-the-currently-used-version Retrieves the version string of the PSPDFKit SDK using Swift. This is a straightforward property access. ```swift let pspdfVersionString = PSPDFKit.SDK.versionString ``` -------------------------------- ### Example gradle.properties File for React Native Android Source: https://www.nutrient.io/guides/react-native/troubleshooting/out-of-memory-error-react-native-android An example of a `gradle.properties` file configuration for a React Native Android project. It includes settings for JVM memory (`org.gradle.jvmargs`), disabling `configureondemand`, and enabling AndroidX and Jetifier. This configuration helps in managing build performance and compatibility. ```properties org.gradle.jvmargs=-Xmx1536M org.gradle.configureondemand=false android.useAndroidX=true android.enableJetifier=true ``` -------------------------------- ### Open Grok with Prompt Source: https://www.nutrient.io/guides/react-native/annotations/introduction-to-annotations/what-are-annotations Opens Grok.com in a new tab with a pre-filled prompt related to the current documentation page. The prompt asks for assistance in understanding and using the documentation. ```javascript function C(i){ const t="https://www.nutrient.io", o=window.location.pathname, r=`I'm looking at this Nutrient documentation: ${`${t}${o}`} Help me understand how to use it. Be ready to explain concepts, give examples, or help debug based on it.`, s=`https://grok.com/c?q=${encodeURIComponent(r)}` window.open(s,"_blank") } ``` -------------------------------- ### VWO Initialization and Script Loading (JavaScript) Source: https://www.nutrient.io/guides/react-native/prebuilt-solutions/example-projects This snippet details the core logic for initializing the VWO tracking script. It includes functions for loading external scripts, handling responses, managing settings tolerance, and initiating the VWO service. The initialization is deferred using `requestIdleCallback` or `setTimeout` to prevent render blocking. ```javascript var code = { addScript: function(t, e) { var n = document.createElement('script'); n.async = !0; n.src = t.src || ''; t.text && (n.text = t.text); n.onload = t.onloadCb; n.onerror = t.onerrorCb; (e || document.body).appendChild(n); }, load: function(e, t) { t = t || {}; if (window._vwo_xhr_api) { var r = new XMLHttpRequest; r.open('GET', e, !0); r.withCredentials = !t.dSC; r.responseType = t.responseType || 'text'; r.onload = function() { if (t.onloadCb) { return t.onloadCb(r, e); } if (r.status === 200 || r.status === 304) { _vwo_code.addScript({ text: r.responseText }); } else { _vwo_code.finish('&e=loading_failure:' + e); } }; r.onerror = function() { if (t.onerrorCb) { return t.onerrorCb(e); } _vwo_code.finish('&e=loading_failure:' + e); }; r.send(); } else { var o = new XMLHttpRequest; o.open('GET', e, !0); o.withCredentials = !t.dSC; o.responseType = t.responseType || 'text'; o.onload = function() { if (t.onloadCb) { return t.onloadCb(o, e); } if (o.status === 200 || o.status === 304) { _vwo_code.addScript({ text: o.responseText }); } else { _vwo_code.finish('&e=loading_failure:' + e); } }; o.onerror = function() { if (t.onerrorCb) { return t.onerrorCb(e); } _vwo_code.finish('&e=loading_failure:' + e); }; o.send(); } }, getSettings: function() { try { var e = stT.getItem(cK); if (!e) { return; } e = JSON.parse(e); if (Date.now() > e.e) { stT.removeItem(cK); return; } return e.s; } catch (e) { return; } }, init: function() { if (d.URL.indexOf('__vwo__disable__') > -1) return; var e = this.settings_tolerance(); w._vwo_settings_timer = setTimeout(function() { _vwo_code.finish(); stT.removeItem(cK); }, e); var o = window._vis_opt_url || d.URL, s = 'https://dev.visualwebsiteoptimizer.com/j.php?a=' + account_id + '&u=' + encodeURIComponent(o) + '&vn=' + version; if (w.location.search.indexOf('_vwo_xhr') !== -1) { this.addScript({ src: s }); } else { this.load(s + '&x=true'); } } }; w._vwo_code = code; if (d.readyState === 'loading') { d.addEventListener('DOMContentLoaded', function() { code.init(); }); } else { if ('requestIdleCallback' in w) { requestIdleCallback(function() { code.init(); }, { timeout: 1000 }); } else { setTimeout(function() { code.init(); }, 0); } } })(); ``` -------------------------------- ### Get All Annotations (React Native PDFDocument) Source: https://www.nutrient.io/guides/react-native/migration-guides/react-native-2-12-migration-guide Retrieves all annotations from the PDF document. This method supersedes the older getAnnotations API. It can optionally filter by annotation type. ```javascript const result = this.pdfRef?.current?.getDocument().getAnnotations(); ``` -------------------------------- ### Get PSPDFKit Version in Objective-C Source: https://www.nutrient.io/guides/react-native/troubleshooting/getting-the-currently-used-version Retrieves the version string of the PSPDFKit SDK using Objective-C. This method accesses a global version string property. ```objective-c NSString *pspdfVersionString = PSPDFKitGlobal.versionString; ``` -------------------------------- ### Run React Native App on iOS Source: https://www.nutrient.io/sdk/react-native/getting-started This command is used to build and run the React Native application on an iOS simulator or connected device. It requires Xcode and CocoaPods to be installed and configured. ```bash npx react-native run-ios ``` -------------------------------- ### Open Documentation in ChatGPT (JavaScript) Source: https://www.nutrient.io/guides/react-native/open-a-document/from-local-storage Opens a new browser tab with a ChatGPT chat interface, pre-populated with a prompt that includes the current documentation URL and a request for assistance. This facilitates quick AI-driven help related to the viewed documentation. ```javascript function v(i){ const t="https://www.nutrient.io", o=window.location.pathname, r=`I'm looking at this Nutrient documentation: ${`${t}${o}`} Help me understand how to use it. Be ready to explain concepts, give examples, or help debug based on it.`,s=`https://chatgpt.com/?q=${encodeURIComponent(r)}`; window.open(s,"_blank") } ``` -------------------------------- ### Open Claude AI with Context (JavaScript) Source: https://www.nutrient.io/guides/react-native/troubleshooting/react-navigation Opens Claude.ai in a new tab with a pre-filled prompt. The prompt includes the current Nutrient.io documentation URL and asks for help understanding and using the documentation. This facilitates AI-assisted learning. ```javascript function x(i){ const t="https://www.nutrient.io", o=window.location.pathname, r=`I'm looking at this Nutrient documentation: ${`${t}${o}`} Help me understand how to use it. Be ready to explain concepts, give examples, or help debug based on it.`, s=`https://claude.ai/new?q=${encodeURIComponent(r)}` window.open(s,"_blank") } ``` -------------------------------- ### Update package.json for React Native Nightly Source: https://www.nutrient.io/guides/react-native/troubleshooting/nightlies Updates the 'dependencies' section in the package.json file to point to the nightly build of the React Native SDK hosted on GitHub. After this change, 'yarn install' should be run. ```json "dependencies": { "@nutrient-sdk/react-native": "github:PSPDFKit/react-native#nightly" } ``` -------------------------------- ### Open ChatGPT with Prompt Source: https://www.nutrient.io/guides/react-native/annotations/introduction-to-annotations/what-are-annotations Opens ChatGPT in a new tab with a pre-filled prompt related to the current documentation page. The prompt asks for assistance in understanding and using the documentation. ```javascript function v(i){ const t="https://www.nutrient.io", o=window.location.pathname, r=`I'm looking at this Nutrient documentation: ${`${t}${o}`} Help me understand how to use it. Be ready to explain concepts, give examples, or help debug based on it.`, s=`https://chatgpt.com/?q=${encodeURIComponent(r)}` window.open(s,"_blank") } ``` -------------------------------- ### Getting Writable Document Path with react-native-fs Source: https://www.nutrient.io/guides/react-native/annotations/save/embed-into-pdf This example shows how to obtain a writable path for saving processed documents using the react-native-fs library, a common practice in React Native applications. ```javascript const RNFS = require('react-native-fs'); const processedDocumentPath = RNFS.DocumentDirectoryPath + '/flattened.pdf'; ``` -------------------------------- ### Configure VWO A/B Testing Service Source: https://www.nutrient.io/guides/react-native/prebuilt-solutions/example-projects This script initializes the VWO (Visual Website Optimizer) A/B testing service. It defines account settings, including the account ID and version, and manages configuration settings loaded from local storage or session storage. The script includes mechanisms for dynamically loading VWO scripts and handling their completion, while also preventing the hiding of the body element to avoid visual glitches. ```javascript window._vwo_code || (function() { var account_id = 892495, version = 2.1, settings_tolerance = 2000, hide_element = '', // Don't hide body to prevent flash hide_element_style = '', /* DO NOT EDIT BELOW THIS LINE */ f = false, w = window, d = document, v = d.querySelector('#vwoCode'), cK = '_vwo_' + account_id + '_settings', cc = {}; try { var c = JSON.parse(localStorage.getItem('_vwo_' + account_id + '_config')); cc = c && typeof c === 'object' ? c : {}; } catch (e) {} var stT = cc.stT == 'session' ? w.sessionStorage : w.localStorage; var code = { nonce: v && v.nonce, library_tolerance: function() { return typeof library_tolerance !== 'undefined' ? library_tolerance : undefined; }, settings_tolerance: function() { return cc.sT || settings_tolerance; }, hide_element_style: function() { return '{' + (cc.hES || hide_element_style) + '}'; }, hide_element: function() { // Always return empty to prevent hiding return ''; }, getVersion: function() { return version; }, finish: function(e) { if (!f) { f = true; var t = d.getElementById('_vis_opt_path_hides'); if (t) t.parentNode.removeChild(t); if (e) (new Image).src = 'https://dev.visualwebsiteoptimizer.com/ee.gif?a=' + account_id + e; } }, finished: function() { return f; }, addScript: function(e) { var t = d.createElement('script'); t.type = 'text/javascript'; if (e.src) { t.src = e.src; t.async = true; // Make async } else { t.text = e.text; } v && t.setAttribute('nonce', v.nonce); d.getElementsByTagName('head')[0].appendChild(t); }, load: function(e, t) { var n = this.getSettings(), i = d.createElement('script'), r = this; t = t || {}; if (n) { i.textContent = n; d.getElementsByTagName('head')[0].appendChild(i); if (!w.VWO || VWO.caE) { stT.removeI } } } }; // ... rest of the VWO initialization code })(); ``` -------------------------------- ### Get and Append Annotation Flags Source: https://www.nutrient.io/guides/react-native/annotations/create-edit-and-remove/annotation-flags This example shows how to retrieve the current flags of an annotation using `getAnnotationFlags` and then append new flags to the existing set before updating them. This is useful for incrementally modifying annotation properties. ```javascript // Get the existing annotation flags. const result = await this.pdfRef.current?.getAnnotationFlags( '596db901-f05c-4637-890d-da03a33eb0ef', ); Alert.alert('PSPDFKit', `Annotation flags: ${JSON.stringify(flags)}`); ``` -------------------------------- ### Create and Navigate to Project Directory (Windows Shell) Source: https://www.nutrient.io/sdk/react-native/getting-started Creates a new directory named 'pdf' and changes the current working directory to it using Windows-specific shell commands. This is a prerequisite for setting up a new React Native project on Windows. ```shell cd /d %userprofile% mkdir pdf cd pdf ``` -------------------------------- ### Open Grok AI with Context (JavaScript) Source: https://www.nutrient.io/guides/react-native/migration-guides/react-native-3-migration-guide Opens Grok AI in a new tab, pre-populated with a query that includes the current documentation page URL and a request for assistance. This provides users with AI support tailored to the documentation content. ```javascript function C(i){ const t="https://www.nutrient.io", o=window.location.pathname, r=`I'm looking at this Nutrient documentation: ${`${t}${o}`} Help me understand how to use it. Be ready to explain concepts, give examples, or help debug based on it.`, s=`https://grok.com/c?q=${encodeURIComponent(r)}`; window.open(s,"_blank") } ``` -------------------------------- ### Open ChatGPT with Context (JavaScript) Source: https://www.nutrient.io/guides/react-native/annotations/introduction-to-annotations/bounding-boxes Opens a new browser tab with ChatGPT, pre-filled with a query related to the current Nutrient.io documentation page. The query asks for help understanding and explaining the documentation. ```javascript function v(i){const t="https://www.nutrient.io", o=window.location.pathname, r=`I'm looking at this Nutrient documentation: ${`${t}${o}`} Help me understand how to use it. Be ready to explain concepts, give examples, or help debug based on it.`; s=`https://chatgpt.com/?q=${encodeURIComponent(r)}`; window.open(s,"_blank") } ``` -------------------------------- ### Open Claude with Prompt Source: https://www.nutrient.io/guides/react-native/annotations/introduction-to-annotations/what-are-annotations Opens Claude.ai in a new tab with a pre-filled prompt related to the current documentation page. The prompt asks for assistance in understanding and using the documentation. ```javascript function x(i){ const t="https://www.nutrient.io", o=window.location.pathname, r=`I'm looking at this Nutrient documentation: ${`${t}${o}`} Help me understand how to use it. Be ready to explain concepts, give examples, or help debug based on it.`, s=`https://claude.ai/new?q=${encodeURIComponent(r)}` window.open(s,"_blank") } ``` -------------------------------- ### Get Annotations for a Specific Page (React Native PDFDocument) Source: https://www.nutrient.io/guides/react-native/migration-guides/react-native-2-12-migration-guide Retrieves annotations for a specific page in the PDF document. This method requires a page index and can optionally filter by annotation type. It is part of the updated annotation retrieval API. ```javascript const result = this.pdfRef?.current?.getDocument().getAnnotationsForPage(3, 'pspdfkit/ink'); ``` -------------------------------- ### Initialize Documentation Action Listeners (JavaScript) Source: https://www.nutrient.io/guides/react-native/troubleshooting/nightlies Initializes event listeners for interactive elements related to documentation actions, specifically targeting containers with IDs starting with 'markdown-actions-container-'. It manages expanding/collapsing sections and handling keyboard navigation. ```javascript document.addEventListener("DOMContentLoaded",()=>{ I(), A() }); function I(t){ document.querySelectorAll('p\[id^="markdown-actions-container-"\]').forEach(o=>{ const e=o.getAttribute("aria-controls"); if(!e)return; const r=document.getElementById(e), a=o.querySelector(".arrow-dropdown-icon"); if(!r)return; o.addEventListener("click",function(n){n.stopPropagation(),o.getAttribute("aria-expanded")==="true"?s():a()}), o.addEventListener("keydown",function(n){if(n.key==="Enter"||n.key===" ")n.preventDefault(),o.getAttribute("aria-expanded")==="true"?s():a();else if(n.key==="ArrowDown"){n.preventDefault(),a();const c=r.querySelector(".markdown-actions-option");c&&c.focus()}}), r.addEventListener("click",function(n){if(n.target.closest(".markdown-actions-option")){(n.preventD ``` -------------------------------- ### Update Import Statements for Nutrient React Native SDK Source: https://www.nutrient.io/guides/react-native/migration-guides/react-native-3-migration-guide This example demonstrates how to update your import statements in React Native code to reflect the new package name for the Nutrient SDK. It changes the import from `react-native-pspdfkit` to `@nutrient-sdk/react-native`. ```javascript import PSPDFKitView, { NotificationCenter } from 'react-native-pspdfkit'; import NutrientView, { NotificationCenter } from '@nutrient-sdk/react-native'; ``` -------------------------------- ### Open Grok AI with Context (JavaScript) Source: https://www.nutrient.io/guides/react-native/troubleshooting/react-navigation Opens Grok.com in a new tab with a pre-filled query. The query directs Grok to help understand the current Nutrient.io documentation page, providing context about the URL and requesting explanations, examples, or debugging assistance. ```javascript function C(i){ const t="https://www.nutrient.io", o=window.location.pathname, r=`I'm looking at this Nutrient documentation: ${`${t}${o}`} Help me understand how to use it. Be ready to explain concepts, give examples, or help debug based on it.`, s=`https://grok.com/c?q=${encodeURIComponent(r)}` window.open(s,"_blank") } ``` -------------------------------- ### Create and Navigate to Project Directory (Shell) Source: https://www.nutrient.io/sdk/react-native/getting-started Creates a new directory named 'pdf' and changes the current working directory to it using standard shell commands. This is a prerequisite for setting up a new React Native project. ```shell mkdir ~/pdf cd ~/pdf ``` -------------------------------- ### React Native Navigation Setup with Stack Navigator Source: https://www.nutrient.io/guides/react-native/troubleshooting/react-navigation This JavaScript code demonstrates how to configure React Native navigation to resolve conflicts with `NutrientView`. It involves replacing `createNativeStackNavigator` with `createStackNavigator` and setting `gestureEnabled` to `false` within the `Stack.Screen` options. Ensure you have `@react-navigation/stack` and `@react-navigation/native` installed. ```javascript import { AppRegistry } from 'react-native'; import { createNativeStackNavigator } from '@react-navigation/native-stack'; import { createStackNavigator } from '@react-navigation/stack'; import { NavigationContainer } from '@react-navigation/native'; import { NutrientViewComponent } from './NutrientViewComponent'; import React, { Component } from 'react'; // Create Stack Navigator. export const Stack = createNativeStackNavigator(); // This line should be replaced export const Stack = createStackNavigator(); class MyStack extends Component { render() { return ( ); } } // Register your application. AppRegistry.registerComponent('MyApp', () => MyStack); ``` -------------------------------- ### Add Application ID Suffix for Debug Builds Source: https://www.nutrient.io/guides/react-native/troubleshooting/what-is-an-app-id This Gradle configuration demonstrates how to append a suffix to the `applicationId` for specific build types, such as `debug`. This is useful for distinguishing development or testing versions of your app from the production release, for example, by adding `.dev`. ```gradle android { ... buildTypes { debug { applicationIdSuffix ".dev" } } } ``` -------------------------------- ### Open Claude AI with Context (JavaScript) Source: https://www.nutrient.io/guides/react-native/annotations/introduction-to-annotations/bounding-boxes Opens a new browser tab with Claude AI, pre-filled with a query about the current Nutrient.io documentation page. The query seeks assistance in understanding and explaining the documentation. ```javascript function x(i){const t="https://www.nutrient.io", o=window.location.pathname, r=`I'm looking at this Nutrient documentation: ${`${t}${o}`} Help me understand how to use it. Be ready to explain concepts, give examples, or help debug based on it.`; s=`https://claude.ai/new?q=${encodeURIComponent(r)}`; window.open(s,"_blank") } ``` -------------------------------- ### Generate PDF from Images in React Native | Nutrient SDK Source: https://context7_llms Guides on generating PDF documents from images in React Native using the Nutrient React Native SDK. Includes detailed instructions and code examples for embedding images into PDFs. ```javascript import React from 'react'; import { View, Button } from 'react-native'; import NutrientSDK from 'nutrient-sdk'; const App = () => { const generatePdfFromImages = async () => { const imagePaths = ['path/to/image1.jpg', 'path/to/image2.png']; // Replace with your image paths try { const pdfData = await NutrientSDK.generatePdfFromImages(imagePaths); console.log('PDF generated from images'); // Example: Save the PDF // await NutrientSDK.saveDocument(pdfData, 'images.pdf'); } catch (error) { console.error('Error generating PDF from images:', error); } }; return (