Diferencias
Muestra las diferencias entre dos versiones de la página.
Próxima revisión | Revisión previa | ||
wiki:2.-desarrollo-app:2.5.-controles-by-xone:visor-de-pdfs:start [2023/02/16 10:46] 127.0.0.1 editor externo |
wiki:2.-desarrollo-app:2.5.-controles-by-xone:visor-de-pdfs:start [2023/02/16 12:14] (actual) ary |
||
---|---|---|---|
Línea 2: | Línea 2: | ||
\\ | \\ | ||
+ | A partir de la versión 4.8.12.56 del Framework, está disponible un nuevo control para ver PDFs sin depender de apps externas. Funciona a partir de Android >= 5.0. | ||
+ | |||
+ | |||
+ | Para implementarlo debe definirse en un **prop tipo texto**, el **atributo viewmode** de la siguiente forma: | ||
+ | |||
+ | |||
+ | <WRAP box 60%> | ||
+ | <prop visible=" | ||
+ | |||
+ | </ | ||
+ | \\ | ||
+ | Sólo hay que cargar la ruta (o el nombre del fichero pdf en la carpeta files) en la propiedad, y refrescar si se quiere cambiar a otro. \\ | ||
+ | Lo recomendable es poner este control sobre un fondo negro, para que se vea bien.\\ | ||
+ | \\ | ||
+ | **Métodos de script asociados: | ||
+ | \\ | ||
+ | <code javascript> | ||
+ | function getPdfViewer() { | ||
+ | let ventana = ui.getView(); | ||
+ | if (!ventana) { | ||
+ | return null; | ||
+ | } | ||
+ | return ventana.MAP_PDF_VIEWER; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | <code javascript> | ||
+ | function loadPdf(sPdf) { | ||
+ | let control = getPdfViewer(); | ||
+ | if (!control) { | ||
+ | return; | ||
+ | } | ||
+ | control.loadPdf(sPdf); | ||
+ | let nPageCount = control.getPageCount(); | ||
+ | self.MAP_PAGE_COUNT = nPageCount; | ||
+ | ui.refreshValue(" | ||
+ | } | ||
+ | </ | ||
+ | <code javascript> | ||
+ | function previousPage() { | ||
+ | let control = getPdfViewer(); | ||
+ | if (!control) { | ||
+ | return; | ||
+ | } | ||
+ | control.previousPage(); | ||
+ | } | ||
+ | </ | ||
+ | <code javascript> | ||
+ | function nextPage() { | ||
+ | let control = getPdfViewer(); | ||
+ | if (!control) { | ||
+ | return; | ||
+ | } | ||
+ | control.nextPage(); | ||
+ | } | ||
+ | </ | ||