Git Product home page Git Product logo

pdf-l4's People

Contributors

chakphanu avatar emilsundberg avatar hardevine avatar jildertmiedema avatar juukie avatar kennedytedesco avatar lintranex avatar thujohn avatar w0rldart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pdf-l4's Issues

PDF Obj ->show();

Hello, I am having a problem with the ->show() method. It is outputting this:

screen shot 2014-05-07 at 2 07 11 pm

When I try the ->download() method it comes out correctly the way I wanted it to be.

Below is my code:

Route::get('/pdf', function()
{
    $html = '<html><body>'
            . '<p><font color="red">Put</font> your html here, or generate it with your favourite '
            . 'templating system.</p>'
            . '</body></html>';
    return PDF::load($html, 'A4', 'landscape')->show();
});

I have tried this in google chrome and safari to no avail.

how to include stylesheet in blade template?

I had this working with plain dompdf but had to set the base path

$dompdf->set_base_path(public_path().'/css/pdf/);

and it wouldn't work with {{ HTML::style('style.css') }}

I had to manually put in a link tag

<link rel="stylesheet" type="text/css" href="style.css">

With this package I get the same issue when using {{ HTML::style('style.css') }} which is a long wait and then a timeout.

Trying to use the manual link and the pdf is generated but with no styles. Since I didn't see a way to set_base_path() I assume this is set to public_path() by default since it's for Laravel but my stylesheet still isn't working

Is zoom posible

Hello guys,
I have a strange issue when i convert html2pdf.
I got an image wide 16 cm but when i print and i measure with a ruler has only 12cm.

Is possible to apply an zoom as a fast solution?

Thanks

Call to a member function prepend_child() on a non-object

$view = View::make('account.order', array(
    'order' => Order::find($id)
));

return PDF::load($view, 'A4', 'portrait')->download('my_pdf');
[2014-07-29 22:25:08] production.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to a member function prepend_child() on a non-object' in .../vendor/thujohn/pdf/src/Thujohn/Pdf/dompdf/include/frame_tree.cls.php:218
Stack trace:
#0 [internal function]: Illuminate\Exception\Handler->handleShutdown()
#1 {main} [] []

thujohn/pdf-l4

I want to add image into pdf report. where I am using one method which return a binary image. this image is displaying properly in html report but not in pdf.
image path are absolute.
1)/var/www/images/
2)/var/www/pod_files/
project url /var/www/project/
my method is localhost/project/cntrller/getImage?type=pod&filename=xyz.png

getImage() method returns image xyz.png from pod of type is pod else return image from images folder. [ return readfile($imagedestdir . '/' . $filename);]

but its working fine when I am using html report genration but not working when I am generating pdf report.

Please some one help out

Multiple PDFs

The library is working fine when generating a single PDF, however when generating two in succession I always get the "no block-level parent found" error, on the second generation, the first PDF is generated fine without incident.
I've tried using the library in different ways (creating a class and using one object for each PDF, not even using the laravel autoloader etc) and have used PDF::clear(), but nothing seems to work.

DOMPDF_ENABLE_REMOTE is set to false

I can't show the image from PDF, I change the value to TRUE config.php, dompdf_config.inc.php and dompdf_config.custom.inc.php ... and nothing, please help me!

How to change settings? Changing default encoding?

I need to use scandinavian alphabets (UTF-8)... I'm actually using the view object, only with "print" asset set (with Basset) and that charset should be declared in the HTML already. So the change must be done with the renderer. I'm using the download method.

Is there a way to publish settings to app/config via artisan?

spits out unformatted code characters

i tried simple example,
it worked in local XAMP, but not working in production server (WHM cPanel)

Route::get('tst',function () {
    $html = '<html><body>'
            . '<p>Put your html here, or generate it with your favourite '
            . 'templating system.</p>'
            . '</body></html>';

    return PDF::load($html, 'A4', 'portrait')->show();
});

it outputs

%PDF-1.3 1 0 obj << /Type /Catalog /Outlines 2 0 R /Pages 3 0 R >> endobj 2 0 obj << /Type /Outlines /Count 0 >> endobj 3 0 obj << /Type /Pages /Kids [6 0 R ] /Count 1 /Resources << /ProcSet 4 0 R /Font << /F1 8 0 R >> >> /MediaBox [0.000 0.000 595.280 841.890] >> endobj 4 0 obj [/PDF /Text ] endobj 5 0 obj << /Creator (DOMPDF) /CreationDate (D:20130711132815+05'30') /ModDate (D:20130711132815+05'30') >> endobj 6 0 obj << /Type /Page /Parent 3 0 R /Contents 7 0 R >> endobj 7 0 obj << /Length 139 >> stream 0.000 0.000 0.000 rg BT 34.016 784.469 Td /F1 12.0 Tf [(Put your html here, or generate it with your favourite templating system.)] TJ ET endstream endobj 8 0 obj << /Type /Font /Subtype /Type1 /Name /F1 /BaseFont /Times-Roman /Encoding /WinAnsiEncoding >> endobj xref 0 9 0000000000 65535 f 0000000008 00000 n 0000000073 00000 n 0000000119 00000 n 0000000273 00000 n 0000000302 00000 n 0000000416 00000 n 0000000479 00000 n 0000000669 00000 n trailer << /Size 9 /Root 1 0 R /Info 5 0 R >> startxref 778 %%EOF

PDF Images

Hello,

I have followed all the instructions per the wiki and as well as this thread:
#12

I have GD enabled, I have published and set the config file and it is incredibly slow. I have to wait about 5 minutes to download or view the PDF. Once this occurs the image still does not work, even though the URL is correct.

I have tried this on multiple machines, all are local developments so servers should not be an issue yet.

Any ideas?

EDIT

To add to this I noticed that when I turned DOMPDF_ENABLE_REMOTE on it now just runs slow no matter what, even if I am loading nothing! Should I run this in a queue or cache it? I was just trying to style the output.

Change config settings

It doesn't seem possible to change config settings like DOMPDF_ENABLE_REMOTE via a config file. They appear to be overwritten in dompdf_config.inc.php

Cannot pass value to view bldade and render HTML

I am creating pdf in controller, When I use View::make('invoice.view') to load html it works fine.

$pdf = new \Thujohn\Pdf\Pdf();
$content = $pdf->load(View::make('invoice.view'))->output();
File::put($compete_file_path, $content);

But when I pass data to view, it throws error

$pdf = new \Thujohn\Pdf\Pdf();
$pdf->load(View::make('invoice.aaa')->with(array($name = 'varun')))->output();
File::put($compete_file_path, $content);

Error:
Symfony \ Component \ Debug \ Exception \ FatalErrorException
Method Illuminate\View\View::__toString() must not throw an exception

Call to undefined method DOMText::getAttribute

In my controller I'm using:

public function savePDF($user, $order, $cust)
    {
        $html = View::make('pdfs.invoicePdf', compact('order', 'user', 'cust'))->render();
        $name = str_random(10) . '-invoice.pdf';
        File::put(public_path('pdfs/' . $name), PDF::load($html, 'A4', 'portrait')->output());
    }

When it's run, I'm getting a whoops screen with the following error:
image

The view does contain a bunch of tables as it is an invoice. Could the empty <td>s give it trouble?

<tr>
    <td class="no-line"></td>
    <td class="no-line"></td>
    <td class="no-line text-center">Total</td>
    <td class="no-line text-right">${{ number_format($order->total_charged, 2) }}</td>
</tr>

Have you seen this particular error before?

version releases

Would it be possible to tag this with some releases, as a rule it's not great to use 'dev-master' in the composer file.

Constants may only evaluate to scalar values

ErrorException

Constants may only evaluate to scalar values
open: /var/sites/exactchange/vendor/thujohn/pdf/src/Thujohn/Pdf/Pdf.php

protected $orientation;
public function __construct(){
$_conf = array('DOMPDF_TEMP_DIR', 'DOMPDF_UNICODE_ENABLED', 'DOMPDF_PDF_BACKEND', 'DOMPDF_DEFAULT_MEDIA_TYPE', 'DOMPDF_DEFAULT_PAPER_SIZE', 'DOMPDF_DEFAULT_FONT', 'DOMPDF_DPI', 'DOMPDF_ENABLE_PHP', 'DOMPDF_ENABLE_REMOTE', 'DOMPDF_ENABLE_CSS_FLOAT', 'DOMPDF_ENABLE_JAVASCRIPT', 'DEBUGPNG', 'DEBUGKEEPTEMP', 'DEBUGCSS', 'DEBUG_LAYOUT', 'DEBUG_LAYOUT_LINES', 'DEBUG_LAYOUT_BLOCKS', 'DEBUG_LAYOUT_INLINE', 'DOMPDF_FONT_HEIGHT_RATIO', 'DEBUG_LAYOUT_PADDINGBOX', 'DOMPDF_ENABLE_HTML5PARSER', 'DOMPDF_ENABLE_FONTSUBSETTING', 'DOMPDF_ADMIN_USERNAME', 'DOMPDF_ADMIN_PASSWORD');
foreach ($_conf as $conf){
if ((Config::has('pdf::'.$conf) || Config::get('pdf::'.$conf)) && !defined($conf))
define($conf, Config::get('pdf::'.$conf));
}

2 pdf error

2 error pdfs.
Hi all, I have a small error generating more than two pdf:
captura de pantalla de 2014-04-07 14 09 37

After generating the first to the second appears to me as if concatenated.

            for ($i=0; $i <1 ; $i++) { 
                $vista1 = $constancias[$i];
                $vista2 = $constancias[$i+1];

            }
             $pdf = new \Thujohn\Pdf\Pdf();
            $content = $pdf->load
                                (View::make('admin/consultas/pdf/'.$vista1.'')
                                    ->with('medicos', $medicos).
                                View::make('admin/consultas/pdf/'.$vista2.'')
                                    ->with('medicos', $medicos)
                                )
                                ->show();
            //File::put(public_path('test'.$i.'.pdf'), $content);

            PDF::clear();
            //return 'uno';
            return $content;

excuse my bad English.

Enhancement: The ability to fetch a parsed template

This looks cool enough, but I think a developer should be able to provide the package with the name of a view which needs to be parsed, instead of using HTML in the controller.

So, one would call PDF::load('invoice', ...)->show();

The package would then check to see if the string provided is a view, and then render the PDF based upon its results. If it isn't a view, then render it as normal.

Or, maybe even better: PDF::load('view:invoice' ...)->show();

Using fonts

Dear John,

Is there a possibility to use fonts in your module?

Thanks,

Img src problem

I have a problem with img src.
the image is not loaded.
If i put the image into a css background is loaded.
I used also the .asset and still i got problem.
DOMPDF_ENABLE_REMOTE is true.
The image format is png.
Any ideea.

Constant DOMPDF_TEMP_DIR already defined

I get the error: Constant DOMPDF_TEMP_DIR already defined. I solved it partly.

//Just some sample code on how I use it

$invoices = Invoices::All()
foreach ($invoices as $invoice)
{
// The error occured here when the second invoice is handled
$dompdf = new \Thujohn\Pdf\Pdf();
$dompdf->load($invoice->asHtml);
$pdf = $dompdf->output();

// First one succesfull

}

Inside the Pdf.php file I've added the !defined.

if (!defined($conf)) {
  define($conf, Config::get('pdf::'.$conf));
}

After this I get this error.

[ErrorException]
unlink(C:\Users\HVSsoftware\AppData\Local\Temp\ca_742.tmp): No such file or
directory

Now I have solved it by generating one invoice at the time. Any other suggestions?

Illegal string offset 'hex'

When I am trying to create a PDF I get this error. Some value in the css ( most probably a string value and not a HEX) creates this problem. Any solutions?

ErrorException

Illegal string offset 'hex'
open: /var/www/billit/vendor/thujohn/pdf/src/Thujohn/Pdf/dompdf/include/style.cls.php

if ( is_null($col) )
$col = self::$_defaults["color"];
//see __set and __get, on all assignments clear cache, not needed on direct set through __set
$this->_prop_cache["color"] = null;
$this->_props["color"] = $col["hex"];
}

Can I suggest an output option

So I can save the PDF to a file to attach/download later?

public function output($filename = 'dompdf_out', $options = array('compress' => 1, 'Attachment' => 1)){
$this->render();
return $this->dompdf->output($filename.'.pdf', $options);
}

would do it. Many thanks

Maximum execution time of 60 seconds exceeded

Hi..
Thanks for this great package..

When I try do download the pdf I get this error:
error

and this is my code in my countroller:

$cpr = Session::get('user_cpr');
$experience = Experience::workedBefore($cpr)->get();
$html= View::make('seekers.experience')->with('experiences',$experience);
return PDF::load($html, 'A4', 'portrait')->download('my_cv');

Inline PHP functionality not working for me

DOMPDF has the ability to read inline php from a script section which I'm using to make headers and footers. My current code works in the DOMPDF I have in a different framework, but the same page does not display the headers and footers made with the PHP script using this laravel package.

Add page number

Hi, is there a way to add page numbers on pdf output. e.g: page 1 of 5.

Thanks for package, works great ;)

PDF Conversion doesn't support CSS 'border-radius'

It seems that the lib doesn't support border-radius property of CSS.

In a plain HTML I can see the shape of the border, but after the conversion, I can only see it as a rectangle.

Simple Method:

        $ex_1 = $this->repo->call_method($this->currUser->id);
        $view = View::make('reports.CV', compact('ex_1'));
        $pdf = PDF::load($view, 'A4');
        $pdf = $pdf->show();
        return $pdf;

UTF issue

I got an encoding issue.
I have chars from italian language witch are not corectly displayed.
Can i somewhere set the encoding?

Chinese (oriental chars)

Hi,

The oriental chars, like Chinese, arent being converted to the pdf, it doesnt show anything. How can i make the chinese chars appear in the pdf?

Thanks

Persistent error with iconv_strlen()

Hey!
I'm getting a persistent error when executing this:

Route::get('/', function()
{
    $html = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>'
            . '<p>Put your html here, or generate it with your favourite '
            . 'templating system.</p>'
            . '</body></html>';
    return PDF::load($html, 'A4', 'portrait')->show();
});

The error reads "iconv_strlen(): Wrong charset, conversion from 8bit//IGNORE' toUCS-4LE' is not allowed", from file: /vendor/patchwork/utf8/class/Patchwork/PHP/Shim/Mbstring.php

Any ideas on what could be generating this?
I'm using L4.1 with Apache/2.2.26 and PHP 5.3.28

Thanks!

Controller method not found after installing your module on LIVE

Thanks for your package and hardwork on this extention.

It worked perfectly fine on my local server but when I tried to move it to LIVE server it gave me the below error:

"Controller method not found"

I don't know why I am getting this error on LIVE.

It would be great if you can give us the solution asap.

Thanks,
Shahid

Streaming with a passed filename

Thank you for the great, great job you've done putting this package together. It's the only one I've been able to get to work as expected with L4.

This isn't really an issue, but it would be fantastic if I could show() a PDF with a custom filename instead of the default 'dompdf_out.pdf'

Can you add a method that mirrors dompdf's stream() method where the user can pass a filename to use as the default? Something like:

public function stream($filename = 'dompdf_out'){
$this->render();
return $this->dompdf->stream($filename.'.pdf', array('compress' => 1, 'Attachment' => 0));
}

Thanks again!

Add page to PDF

How to add more pages to PDF file, i've already tried to run the example script, but it just showed only one page. Thanks..

Fetching a View results in a error

Hello

I am using the pdf as follows

protected function sendEmail( $subject_translation, $view_name, $params = array() )
{
if ( static::$app['config']->getEnvironment() == 'testing' )
return;
if (!is_dir(FACTUREN_DIR)){
mkdir(FACTUREN_DIR, 0777, true);
}

    $user = Auth::User();
    $reservation = $params['reservation'];
    $customer = $params['user'];

    $outputName = str_random(10);
    $pdfPath = FACTUREN_DIR.'/'.$outputName.'.pdf';
    File::put($pdfPath, PDF::load(View::make('emails/invoice'), 'A4', 'portrait')->output());

    static::$app['mailer']->send($view_name, $params, function($m) use ($subject_translation, $user, $pdfPath)
    {
        $m->to( Auth::User()->email )
            ->subject( Lang::get($subject_translation)
        );

        $m->attach($pdfPath, array('as' => Lang::get('email.invoice'), 'mime' => 'application/pdf'));
    });
}

But when I use View::make('emails/invoice') instead It results in a error for my presenter

schermafbeelding 2014-01-20 om 18 50 02

How to solve this? Im using laravel 4.1

show PDF on browser

Hi thanks for awesome plugin kindly tell me the procedure in which Table render in pdf then when the user click on it its always show in a browser.

View::__toString() must not throw an exception

I've had PDF working on 2 other Servers (one Local Xampp and one Live) for 3 or 4 months with no worries. I have just moved my app to a new Server and am getting this error:
'Method Illuminate\View\View::__toString() must not throw an exception' in /home/***/vendor/thujohn/pdf/src/Thujohn/Pdf/dompdf/include/dompdf.cls.php:0
Im just wondering if there is a PHP module or maybe a Permission problem? (Ive already set my /storage and subdirectories to 777.

ErrorException Illegal string offset 'hex'

I keep getting this error:

ErrorException
Illegal string offset 'hex'

It's line 1418 in thujohn\pdf\src\Thujohn\Pdf\dompdf\include\style.cls.php

Is this an error within the package? I'm using it the way he has it setup with my view generating perfect HTML. Here is my code:

$HPreport = new HpReport();
$view = View::make('pages.report.print', array('report' => Input::all()));
$HPreport->saveAsPdf($view, Auth::user()->id . '_hp_' . str_random(10))


    /**
     * Save report as PDF
     * @param html         HTML of PDF
     * @param fileName     Name of File
     *
     */
    public function saveAsPdf( $html, $fileName = null )
    {
        if(is_null($fileName))
            $fileName = $this->generateFileName();

        $pdfPath = $this->reportDirectory.'/'.$fileName.'.pdf';

        // set recent PDF to name of PDF
        $this->recentReportFile = $fileName.'.pdf';
        return File::put($pdfPath, PDF::load($html)->output());
    }

Thanks for any help.. not seeing a mistake on my part.

iOS -- In-browser encoding issues

I am using this plugin in a Laravel install for a client of ours. Here's what's happening:

Android: auto-download and view fine
Desktop/Laptop: all major browsers auto-download/open and view fine

iOS iPhone, and iPad (even on chrome and safari apps) the PDF's are downloading and being viewed as if they were improperly encoded. I traced back the code to the core of the application that the downloads were being sent the correct headers. Does this have to do with some obscure iOS 7.x bug?

PDF::load($html, 'A4', 'portrait')->download( ... )

PDF not generating in loop

I am trying to generate multiple pdf but it showing me error:

{"error":{"type":"DOMPDF_Exception","message":"No block-level parent found. Not good.","file":"/var/www/crm/vendor/dompdf/dompdf/include/inline_positioner.cls.php","line":37}}

problem in Arabic language UTF-8 unicode

Dear sir

I try to print arabic language file but the word appear as in below pic from ltr and charachters separated

fireshot screen capture 004 - 192_168_1_222_larastart_public_receivingnote_1_print - 192_168_1_222_larastart_public_receivingnote_1_print

i used the Tahoma font by adding this code in the templet i need to print
<style>
html,body {font-family:Tahoma;}
</style>

and i convert the font ttf file by using http://eclecticgeek.com/dompdf/load_font.php tool and put the output fiels in vendor\thujohn\pdf\src\Thujohn\Pdf\dompdf\lib\fonts as the document and update the dompdf_font_family_cache.dist.php with new font data
i update the meta data in the template with

{meta charset="utf-8" /}
but still have the problem
plz advise

Page header/footer

Hi, I have seen that dompdf creates automatically new pages as text flows, and this is great; I was wondering if there's any way to implement some page header/footer feature, or the page numbering. There are some css rules for that I think.

PDF Corrupted?

Hello,

I installed this on our VPS with php 5.5.8 and it shows like this:

%PDF-1.3 1 0 obj << /Type /Catalog /Outlines 2 0 R /Pages 3 0 R >> endobj 2 0 obj << /Type /Outlines /Count 0 >> endobj 3 0 obj << /Type /Pages /Kids [6 0 R ] /Count 1 /Resources << /ProcSet 4 0 R /Font << /F1 8 0 R >> >> /MediaBox [0.000 0.000 595.280 841.890] >> endobj 4 0 obj [/PDF /Text ] endobj 5 0 obj << /Creator (DOMPDF) /CreationDate (D:20140317130236+08'00') /ModDate (D:20140317130236+08'00') >> endobj 6 0 obj << /Type /Page /Parent 3 0 R /Contents 7 0 R >> endobj 7 0 obj << /Length 139 >> stream 0.000 0.000 0.000 rg BT 34.016 784.469 Td /F1 12.0 Tf [(Put your html here, or generate it with your favourite templating system.)] TJ ET endstream endobj 8 0 obj << /Type /Font /Subtype /Type1 /Name /F1 /BaseFont /Times-Roman /Encoding /WinAnsiEncoding >> endobj xref 0 9 0000000000 65535 f 0000000008 00000 n 0000000073 00000 n 0000000119 00000 n 0000000273 00000 n 0000000302 00000 n 0000000416 00000 n 0000000479 00000 n 0000000669 00000 n trailer << /Size 9 /Root 1 0 R /Info 5 0 R >> startxref 778 %%EOF

I worked on this on my local xampp with php 5.4.17..it is working. The required extensions were installed in my vps as shown in phpinfo.

What did I miss? Please help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.