FoxInCloud
PDF full-height display in an iFrame
Gravatar is a globally recognized avatar based on your email address. PDF full-height display in an iFrame
  Gilles Lajot-Sarthou
  All
  May 22, 2023 @ 03:15am

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

Gravatar is a globally recognized avatar based on your email address. re: PDF full-height display in an iFrame
  FoxInCloud Support - Thierry N.
  Gilles Lajot-Sarthou
  May 22, 2023 @ 03:27am

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 */
Gravatar is a globally recognized avatar based on your email address. re: PDF full-height display in an iFrame
  Gilles Lajot-Sarthou
  FoxInCloud Support - Thierry N.
  May 22, 2023 @ 04:23am

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

Gravatar is a globally recognized avatar based on your email address. re: PDF full-height display in an iFrame
  Vincent H.
  Gilles Lajot-Sarthou
  May 22, 2023 @ 09:04pm

Hi Gilles,

You can also use vh unit, like style="height: 60vh;"

Gravatar is a globally recognized avatar based on your email address. re: PDF full-height display in an iFrame
  Gilles Lajot-Sarthou
  Vincent H.
  May 23, 2023 @ 12:13am

Merci Vincent,

I test it and it is ok for me!

Cdlt

© 1996-2024