I followed this tutorial:
https://github.com/EllisLab/CodeIgniter/wiki/PDF-generation-using-dompdf
However, I can't seem to set the path right. On the config file of dompdf (config_dompdf.inc.php) I did the following:
define("DOMPDF_DIR", realpath(dirname('./system/plugins/dompdf/')));
I get this error:
Message: require_once(/var/www/myApp/system/plugins/include/functions.inc.php) [function.require-once]: failed to open stream: No such file or directory
Filename: dompdf/dompdf_config.inc.php
Line Number: 233
As per the tutorial, I placed the dompdf directory under system/plugins. But you can see above that on line 233, there is an error because of an incorrect path. How do I fix the path?
(define("DOMPDF_DIR", realpath(dirname('./system/plugins/dompdf/')));)
Thanks!
A custom loader that is on autoload is conflicting with DOMPDF, that's the reason it doesn't work. Switched to TCPDF since the custom loader is used by all controllers of the app.
this file take $_GET['input_file'] as the name of the file that should be converted to pdf
http://localhost/dompdf/dompdf.php?input_file=[nameofyourfile]
You only need to change the value of DOMPDF_DIR if you have moved dompdf_config.inc.php from its usual location in the dompdf directory. Otherwise, dompdf is already set up to populate that constant with the correct path. Based on the information you have provided I do not believe you should have modified the default value.
Related
I have uploaded all my files in var/www/html and in one of my php files I have this line :
require_once('libraries/stripe/init.php');
the structure of my folders are list this:
www
-html/
-libraries
-> Stripe -> init.php
-register.php
I keep getting this error message:
Warning: require_once(libraries/Stripe/init.php): failed to open stream: No such file or directory in /var/www/html/register.php on line 116
Fatal error: require_once(): Failed opening required 'libraries/Stripe/init.php' (include_path='.:/usr/share/php:/var/www/html/') in /var/www/html/register.php on line 116
my php.ini file used to be like this
include_path= ".:/usr/local/php/pear/"
but based on some answers here i changed it to
include_path='.:/usr/share/php:/var/www/html/'
but it's not working!
Edit: in my libraries folder I have file called index.php the content is:
<?php
header("Location: ../"); die();
I wouldn't leave library paths to chance like that:
require_once(__DIR__ . '/libraries/Stripe/init.php');
This would make sure you include the script using the absolute directory path of the currently running script.
Update
Failed opening required '/var/www/html/libraries/Stripe/init.php'
Well, then the file is simply not there; if this file was generated by some other tool, e.g. composer, it would need to be done again on a new server (or ideally at every deployment).
i think the problem is my Stripe folder is in "s" but I'm using capital "S". is there anyway to make not case sensitive?
File systems under Linux are case sensitive by default (not even sure whether it can be changed) as opposed to Windows. Make sure you use capitalisation consistently.
That not what you are looking for. it says that php.ini file can't find the path of the file that you specified. that's why you should use absolute path to the file
require_once "path/to/file";
I'm using Laravel to build an web application. I want to create an PDF document, therefore I use the DOMPDF class by BarryVDH. (https://github.com/barryvdh/laravel-dompdf/tree/0.4)
In my view, when I use an CSS asset, I get the following error:
file_put_contents(XXXX/app/storage/fonts/6fb68711b6675ac0a3fd0da8c654f06d.ttf): failed to open stream: No such file or directory
Does anyone knows how I can fix this?
There is definitly a problem with the destination folder path.
change your path
XXXX/app/storage/fonts/
or check maybe u don't have that directory or don't have file in that directory!
I am trying to run 2 example of PHPExcel
01simple-download-xlsx.php and 07reader.php
01simple-download-xlsx.php Working Perfect but this example 07reader.php is showing error mentioned below Why can't understand since last 4 hours.
Any one can kindly tell me why this is happening when the file is using same directory structure.
Warning: require_once(../Classes/PHPExcel/IOFactory.php): failed to
open stream: No such file or directory in
C:\xampp\htdocs\manazeschool\software\office_admin\exam_excel\Examples\07reader.php
on line 37
Fatal error: require_once(): Failed opening required
'../Classes/PHPExcel/IOFactory.php'
(include_path='.;C:\xampp\php\PEAR') in
C:\xampp\htdocs\manazeschool\software\office_admin\exam_excel\Examples\07reader.php
on line 37
Some of the examples (such as the 01* files) correctly use an absolute pathname __DIR__ . '../Classes/...' to include the main PHPExcel library, which means you don't need to be in the /Examples directory to run them.
Other examples (07reader.php included) simply use a relative pathname '../Classes/...'to include the main PHPExcel library, which means you do need to be in the /Examples directory to run them.
To resolve the issue, either ensure that you're in the /Examples folder when you run these files, or modify the include to use the absolute pathname.
I believe I've now fixed all of these example files to use the absolute pathname in the development branch on github.
i want to include a php file .module file like this using hook_init
function drupsocial_init() {
require_once base_path().(drupal_get_path('module', 'drupsocial') . '/libraries/dsinvoke.php');
}
but showing this error
Fatal error: require_once() [function.require]: Failed opening required '/drupal6/trunk/sites
/all/modules/drupsocial/libraries/dsinvoke.php' (include_path='.;D:\xampp\php\PEAR') in D:\xampp\htdocs
\drupal6\trunk\sites\all\modules\drupsocial\drupsocial.module on line 32
how can i include such file
You normally can include any file if you know the full path of the file and the file is accessible. Check the path to the library, correct it and you should not have any problem.
Start with the full path to the file first. If that works, you can think about using a dynamic path to the file.
why drupal trying to load the file in the trunk directory ? are you working on a svn repo ? i think there's something wrong with that path.
I also suggest you to check permissions
Hope this helps
i have found some pdf file geneartion program in php. When i run it i get the following error Warning:
Warning: include(helveticab.php) [function.include]: failed to open stream: No such file or directory in E:\wamp\www\raj19\fpdf.php on line 789
Warning: include() [function.include]: Failed opening 'helveticab.php' for inclusion (include_path='.;C:\php5\pear') in E:\wamp\www\raj19\fpdf.php on line 789
FPDF error : Could not include font metric file
I think the fpdf.php is missing .I have searched on their site but i could not find the english version. can anyone provide me full link of english version?
helveticab.php is a font definition file, which is shipped with FPDF. Get it here:
http://www.fpdf.org/
Since your code is not able to locate font library, add this line to your code.
define('FPDF_FONTPATH','fpdf/font/');
All you have to do is to copy the entire folder, and check for "fonts" one. Go inside and search for the file you're looking for.
If nothing works. Try with $font = 'fonts/arial.ttf'; and in the "fonts" folder put the TTF file. If you don't know where to get it. Search in your explorer "fonts" and get the TTF file by dragging it to the fonts folder or copying it.
If doens't works, copy the code line where you're trying to call the font file.
Depends on where the library is in the root directory. if Is in the same place just use
$str = 'fpdf.php';
require($str);
if your output is in a directory called fpdf and your php output is in another directory i.e. mydoc, you need to go up one step
$str = '../fpdf.php';
if your php output is down 2 steps i.e. root/myfolder/mydoc/output.php then you need to up two steps $str = '../../fpdf/fpdf.php'; i'm assuming that you have your fpdf library in the folder root/fpdf/fpdf.php