dompdf icon indicating copy to clipboard operation
dompdf copied to clipboard

Errors and warnings with dompdf while pdf creating with URL " ( ! ) Warning: DOMXPath::query() "

Open nk-nareshkumar opened this issue 13 years ago • 6 comments

I am trying to create PDF of Google home page http://www.google.com and url http://code.google.com/p/dompdf/wiki/Installation.

But instead of PDF both url giving something getting wrong. Please guide me. code code

<?php

    require_once("dompdf/dompdf_config.inc.php");
    $content = file_get_contents('http://code.google.com/p/dompdf/wiki/Installation');
    $dompdf = new DOMPDF();
    $dompdf->load_html($content);
    $dompdf->render();
    $dompdf->stream("sample.pdf");

?>

and result facing with url http://code.google.com/p/dompdf/wiki/Installation

2013-06-13 18-00-11

and result facing with url http://www.google.com

2013-06-13 18-01-59

nk-nareshkumar avatar Jun 13 '13 12:06 nk-nareshkumar

The warnings will not prevent dompdf from rendering a PDF, though they are things we'll want to address at some point. However, sending them to the browser will prevent you from seeing the PDF.

The fatal exceptions are more serious, though it would help to know what version of dompdf you are using. If not the latest you should go ahead and update. I was able to successfully render both documents, though neither was handled very well.

That being said, what is your purpose in rendering these pages. We will freely admit that currently dompdf does not provide browser-class rendering, though that is our ultimate goal. With dompdf right now you are better off working with your expected HTML rather than rendering randomly-chosen web pages.

bsweeney avatar Jun 13 '13 14:06 bsweeney

i try to do this :

 public function convertToPdfAction(Request $request, $id)
    {
        $options = new Options();
        $options->set('defaultFont', 'Courier');
        $dompdf = new Dompdf($options);
        $html = file_get_contents( $this->render('http://localhost:8000/test/') );
        $dompdf->loadHtml($html);

        $dompdf->setPaper('A4', 'landscape');
        $dompdf->render();
        $dompdf->stream();

    }

it doesnt work, this is the error:

Unable to find template "http:/www.google.com" (looked into: D:\web\ist\ExamenesEnLinea\tis\app/Resources/views, D:\web\ist\ExamenesEnLinea\tis\vendor\symfony\symfony\src\Symfony\Bridge\Twig/Resources/views/Form). 500 Internal Server Error - InvalidArgumentException 1 linked Exception: Twig_Error_Loader »

anyone know why?, please help me

IreneArgolloDelgadillo avatar Jul 30 '16 23:07 IreneArgolloDelgadillo

@IreneArgolloDelgadillo this doesn't seem to be an issue with dompdf. That error is not one that would be thrown by dompdf. You might try checking that the page renders ok without converting to PDF first.

bsweeney avatar Jul 31 '16 00:07 bsweeney

Hello geeks,

Has any of you guys encountered an error with dompdf when previewing the pdf file contents in the browser and lots of unformatted and unnecessary text are first printed then the actual content comes down? It works very fine on localhost but have now hosted the system on a live server and getting these kind of weird behavior shown in the pics. Thanks in advance please for any help...... Screen Shot 2021-11-13 at 02 23 14 Screen Shot 2021-11-13 at 02 22 47

Mathias-Wa-Mucani avatar Nov 12 '21 23:11 Mathias-Wa-Mucani

@Mathias-Wa-Mucani best to start a new discussion for questions of this nature. Definitely don't add unrelated comments to an existing issue.

I started a new discussion for you here: https://github.com/dompdf/dompdf/discussions/2639

bsweeney avatar Nov 12 '21 23:11 bsweeney

I'm sorry for blundering that way! That issue has been boggling my mind.... thanks anyways


mathiaswamucani

On Sat, Nov 13, 2021, 02:46 Brian Sweeney @.***> wrote:

@Mathias-Wa-Mucani https://github.com/Mathias-Wa-Mucani best to start a new discussion https://github.com/dompdf/dompdf/discussions/new for questions of this nature. Definitely don't add unrelated comments to an existing issue.

I started a new discussion for you here: #2639 https://github.com/dompdf/dompdf/discussions/2639

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dompdf/dompdf/issues/668#issuecomment-967731292, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOOZYDONFR65BZGSWNHLQN3ULWRMVANCNFSM4AF3OM6A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Mathias-Wa-Mucani avatar Nov 13 '21 00:11 Mathias-Wa-Mucani