@@ -142,12 +142,6 @@ public function processTemplate($type, $func, array $templateParameters = [], $t
142142 $ template = $ this ->getViewTemplate ($ type , $ func );
143143 }
144144
145- if ($ templateExtension == 'pdf.twig ' ) {
146- $ template = str_replace ('.pdf ' , '.html ' , $ template );
147-
148- return $ this ->processPdf ($ templateParameters , $ template );
149- }
150-
151145 // look whether we need output with or without the theme
152146 $ raw = $ this ->request ->query ->getBoolean ('raw ' , false );
153147 if (!$ raw && $ templateExtension != 'html.twig ' ) {
@@ -219,52 +213,4 @@ public function availableExtensions($type, $func)
219213
220214 return $ extensions ;
221215 }
222-
223- /**
224- * Processes a template file using dompdf (LGPL).
225- *
226- * @param array $templateParameters Template data
227- * @param string $template Name of template to use
228- *
229- * @return mixed Output
230- */
231- protected function processPdf (array $ templateParameters = [], $ template )
232- {
233- // first the content, to set page vars
234- $ output = $ this ->twig ->render ($ template , $ templateParameters );
235-
236- // make local images absolute
237- $ output = str_replace ('img src="/ ' , 'img src=" ' . $ this ->request ->server ->get ('DOCUMENT_ROOT ' ) . '/ ' , $ output );
238-
239- // then the surrounding
240- $ output = $ this ->twig ->render ('@ZikulaRoutesModule/includePdfHeader.html.twig ' ) . $ output . '</body></html> ' ;
241-
242- // create name of the pdf output file
243- $ siteName = $ this ->variableApi ->getSystemVar ('sitename ' );
244- $ pageTitle = iconv ('UTF-8 ' , 'ASCII//TRANSLIT ' , $ this ->pageVars ->get ('title ' , '' ));
245- $ fileTitle = iconv ('UTF-8 ' , 'ASCII//TRANSLIT ' , $ siteName )
246- . '- '
247- . ($ pageTitle != '' ? $ pageTitle . '- ' : '' )
248- . date ('Ymd ' ) . '.pdf ' ;
249- $ fileTitle = str_replace (' ' , '_ ' , $ fileTitle );
250-
251- /*
252- if (true === $this->request->query->getBoolean('dbg', false)) {
253- die($output);
254- }
255- */
256-
257- // instantiate pdf object
258- $ pdf = new \Dompdf \Dompdf ();
259- // define page properties
260- $ pdf ->setPaper ('A4 ' , 'portrait ' );
261- // load html input data
262- $ pdf ->loadHtml ($ output );
263- // create the actual pdf file
264- $ pdf ->render ();
265- // stream output to browser
266- $ pdf ->stream ($ fileTitle );
267-
268- return new Response ();
269- }
270216}
0 commit comments