FoxInCloud
PDF full-height display in an iFrame
Hi Thierry, How can I get the full OCX PDF display in my form without changing (as below) the source code of the _refresh method of the PDF object?
IF EMPTY(m.THIS.wcID)
RETURN
ENDIF
IF m.THISFORM.wBSlHTMLgen = .T. &&AND NOT EMPTY(m.THISFORM.cFilePdf) AND FILE(m.THISFORM.cFilePdf)
LOCAL oServer AS OBJECT, oConfig AS OBJECT
* Récupération du dossier temporaire du site WEB
=wlWEB(@m.oServer, @m.oConfig)
* Copie du fichier originel dans le répertoire physique des temporaires utilisé par le serveur WEB
IF NOT EMPTY(m.THIS.wcSRC) AND FILE(m.THIS.wcSRC)
DELETE FILE(m.THIS.wcSRC)
ENDIF
THIS.wcSRC = IIF(NOT EMPTY(m.THISFORM.cFilePdf) AND FILE(m.THISFORM.cFilePdf), m.oConfig.cTempPathPhysical + JUSTFNAME(m.THISFORM.cFilePdf), '')
IF NOT EMPTY(m.THIS.wcSRC) AND FILE(m.THIS.wcSRC)
DELETE FILE(m.THIS.wcSRC)
ENDIF
IF NOT EMPTY(m.THISFORM.cFilePdf) AND FILE(m.THISFORM.cFilePdf)
COPY FILE (m.THISFORM.cFilePdf) TO (m.THIS.wcSRC)
* Affectation de la propriété wcSRC du répertoire virtuel des temporaires WEB utilisée lors de la génération du script HTML//JS
THIS.wcSRC = m.oConfig.cTempPathVirtual + IIF(RIGHT(m.oConfig.cTempPathVirtual,1) <> '/', '/', '') + JUSTFNAME(m.THISFORM.cFilePdf)
ENDIF
* Si mode WEB et génération des pages HTML
* Régénérer les script HTML / JS pour l'affichage du PDF dans l'iFrame
***=THIS.wcHTMLgen() && original code
THIS.wcHTML = STRTRAN(m.THIS.wcHTML, '<iframe class="embed-responsive-item"', '<iframe class="embed-responsive-item" style="height:1200px;"')**
* Ajout du script dans la page courante
=THISFORM.wcScriptJSadd(TEXTMERGE([jQuery('#<<m.THIS.wcID>>').html(<<cLitteralJS(m.THIS.wcHTML)>>);]))
ENDIF
Amicalement
Gilles

Hi Gilles,
I would try to remove style="height:1200px;"
from
THIS.wcHTML = STRTRAN(m.THIS.wcHTML, '<iframe class="embed-responsive-item"', '<iframe class="embed-responsive-item" style="height:1200px;"')
and add a class instead (eg. consultation-pdf
):
THIS.wcHTML = STRTRAN(m.THIS.wcHTML, '<iframe class="embed-responsive-item"', '<iframe class="embed-responsive-item consultation-pdf"')
an adjust height in xxx.css
:
#consultation_scx .consultation-pdf {height:auto;} /* for example, to get full height */
#otherForm_scx .consultation-pdf {height:1200px;} /* back compat */
Merci Thierry,
in xxx.css #consultation_scx .consultation-pdf {height:auto;} doesn't work fine! (auto ??)
#consultation_scx .consultation-pdf {height:1200px;} work correctly! Amicalement Gilles