/** * Gets a DOMDocument, searches it for files, uploads files and markus to webservice and generated PDF. * @param DOMDocument $oHtmlDOM The source markup * @return Byte[] The resulting PDF */ public function createPDF(&$oHtmlDOM) { $aOptions = array('verify_peer' => false, 'allow_self_signed' => true, 'cache_wsdl' => WSDL_CACHE_NONE); wfRunHooks('BSUEModulePDFCreatePDFBeforeSend', array($this, &$aOptions, $oHtmlDOM)); $this->oPdfWebservice = new SoapClient($this->aParams['soap-service-url'] . '/GeneratePdf?wsdl', $aOptions); $this->findFiles($oHtmlDOM); $this->uploadFiles(); //HINT: http://www.php.net/manual/en/class.domdocument.php#96055 $sHtmlDOM = $oHtmlDOM->saveXML($oHtmlDOM->documentElement); //Formated Output is evil because is will destroy formatting in <pre> Tags! //$oIntermediateDOM = new DOMDocument(); //$oIntermediateDOM->preserveWhiteSpace = false; //$oIntermediateDOM->formatOutput = true; //$oIntermediateDOM->loadXML($sHtmlDOM); //$sHtmlDOM = $oIntermediateDOM->saveXML( $oIntermediateDOM->documentElement, LIBXML_NOEMPTYTAG ); $aSoapParams = array('documentHTML' => &$sHtmlDOM, 'documentToken' => $this->aParams['document-token']); $oResponse = $this->oPdfWebservice->createNewPDF($aSoapParams); $vPdfByteArray = $oResponse->return; return $vPdfByteArray; }