{"action":"created","issue":{"url":"https://api.github.com/repos/barryvdh/laravel-dompdf/issues/37","labels_url":"https://api.github.com/repos/barryvdh/laravel-dompdf/issues/37/labels{/name}","comments_url":"https://api.github.com/repos/barryvdh/laravel-dompdf/issues/37/comments","events_url":"https://api.github.com/repos/barryvdh/laravel-dompdf/issues/37/events","html_url":"https://github.com/barryvdh/laravel-dompdf/issues/37","id":31375560,"number":37,"title":"Page count and page number","user":{"login":"wemersonjanuario","id":38724,"avatar_url":"https://avatars.githubusercontent.com/u/38724?v=3","gravatar_id":"","url":"https://api.github.com/users/wemersonjanuario","html_url":"https://github.com/wemersonjanuario","followers_url":"https://api.github.com/users/wemersonjanuario/followers","following_url":"https://api.github.com/users/wemersonjanuario/following{/other_user}","gists_url":"https://api.github.com/users/wemersonjanuario/gists{/gist_id}","starred_url":"https://api.github.com/users/wemersonjanuario/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wemersonjanuario/subscriptions","organizations_url":"https://api.github.com/users/wemersonjanuario/orgs","repos_url":"https://api.github.com/users/wemersonjanuario/repos","events_url":"https://api.github.com/users/wemersonjanuario/events{/privacy}","received_events_url":"https://api.github.com/users/wemersonjanuario/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2014-04-12T03:38:35Z","updated_at":"2015-10-01T11:59:23Z","closed_at":"2014-07-01T07:29:48Z","body":"How to access Page count and page number inside blade views?"},"comment":{"url":"https://api.github.com/repos/barryvdh/laravel-dompdf/issues/comments/144706585","html_url":"https://github.com/barryvdh/laravel-dompdf/issues/37#issuecomment-144706585","issue_url":"https://api.github.com/repos/barryvdh/laravel-dompdf/issues/37","id":144706585,"user":{"login":"ksdev-pl","id":4216259,"avatar_url":"https://avatars.githubusercontent.com/u/4216259?v=3","gravatar_id":"","url":"https://api.github.com/users/ksdev-pl","html_url":"https://github.com/ksdev-pl","followers_url":"https://api.github.com/users/ksdev-pl/followers","following_url":"https://api.github.com/users/ksdev-pl/following{/other_user}","gists_url":"https://api.github.com/users/ksdev-pl/gists{/gist_id}","starred_url":"https://api.github.com/users/ksdev-pl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ksdev-pl/subscriptions","organizations_url":"https://api.github.com/users/ksdev-pl/orgs","repos_url":"https://api.github.com/users/ksdev-pl/repos","events_url":"https://api.github.com/users/ksdev-pl/events{/privacy}","received_events_url":"https://api.github.com/users/ksdev-pl/received_events","type":"User","site_admin":false},"created_at":"2015-10-01T11:59:23Z","updated_at":"2015-10-01T11:59:23Z","body":"Another way to solve this problem:\r\n\r\n* publish vendor files for this package: `php artisan vendor:publish`\r\n* edit `/config/dompdf.php` and enable `DOMPDF_ENABLE_PHP`\r\n* now you can add inline php code in your view (taken from https://code.google.com/p/dompdf/wiki/FAQ)\r\n```php\r\n<script type=\"text/php\">\r\n    if ( isset($pdf) ) {\r\n        $font = Font_Metrics::get_font(\"helvetica\", \"bold\");\r\n        $pdf->page_text(72, 18, \"Header: {PAGE_NUM} of {PAGE_COUNT}\", $font, 6, array(0,0,0));\r\n    }\r\n</script>\r\n```\r\n\r\nYou can write the rest of the code like earlier:\r\n```php\r\n$pdf = PDF::loadView('whatever', $data);\r\n$pdf->save($filePath);\r\n```"}}