I have a script that generates a pdf file using DOMPDF. Locally it generates fine the way I want it to be but online, the formatting is scattered. These are the two samples
I am using PHP 5.3.x locally and online. I don't know what the problem is. Please could someone help
I also gone through the same problem. Dompdf is perfectly working on localhost but not on live server. Actually my localhost is having php-version-5 and the server is running on php7.
So here's the solution:
just use dompdf-0.8.6 on server .
This worked for me.
you can download it from here : https://github.com/dompdf/dompdf/archive/v0.8.6.zip
My fix was to use asset to access my css file on live server, for example {{asset('css/style.css')}} and that fixed my issue, while on local server, what worked was using the public_path to access the css file, example {{public_path('css/style.css')}}
I just had the same issue... the problem is using custom fonts.
Don't just try normal #fontface css embedding, use DomPDF's font loader and 'install' the font.
See link for usage for load_font.php : https://github.com/dompdf/dompdf/wiki/UnicodeHowTo#use-the-load_fontphp-script-included-with-dompdf
In my case (v 0.7.0), the problem was that I was missing some required libraries in the "lib" folder, namely:
php-font-lib
php-svg-lib
Both can be downloaded from Github, and then add 2 folders with the above names into the lib folder, where you should dump all the downloaded files.
Or, better yet, just use Composer next time! (this is a note to self)
I've same problem and solved by deleting just a single file. The file which is under 'dompdf/lib/fonts/dompdf_font_family_cache.php'
You may get this answer better
Related
so, I have a setup with apache2, php5, Mysql, etc... everything seems to work alright and I'm using default directory /var/www/html.
I can upload pdfs into directory /var/www/html/uploads, and also display the pdfs uploaded into directory in list of links by using scandir(php method).
I've also checked permissions on the directory, pdf files, and /etc/mime.types.
And ofc, the files are there too. I have also tried naming my pdf files with lower case without any special characters.
The error code is 404 Not found:The requested URL /var/www/html/uploads/cv.pdf was not found on this server. When I try to download the file, by right-clicking link and downloading, i just get a broken pdf that isnt readable. However, the pdf files seem perfectly fine, since when I scp them back to my local computer and read them they're not broken at all.
Any suggestions on why I may be experiencing this error?
All suggestions and help appreciated.
I have an app that renders PDFs with FPDF.
It was working fine and for some reasons I had to change the PDF files and now I get this error:
Unable to find "startxref" keyword
If I restore the original files, the same error happens.
How do I fix this error?
You simply have to pass a local path instead of an URI to setSourceFile().
The problems lies (sometimes) in the pdf compression.
If you are using linux you can use this to uncompress the pdf:
podofouncompress compressed.pdf decompressed.pdf
I faced this problem recently. I'm using TCPDF to merge uploaded pdf files.
Curiousilly something went wrong when importing some pdf files. Some cases, following error was printed:
Unable to find "startxref" keyword. in pdf_parser->_findXref()
So I tried to solve by reopen these pdfs files in Google Chrome and save it as PDF again. For my surprise, TCPDF worked! I still dont know how it can be but now I got a temporary solution.
I tried to use Google Doc Embedder by using this code
[gview file="http://localhost/wordpress/wp-content/uploads/2013/07/list.pdf"]
but this error keeps on showing up..
Sorry, we were unable to find the document at the original source. Verify that the document still exists.
You can also try to download the original document by clicking here.
I checked in the directory/path to verify and its still there. So what is the reason that this error keeps on showing up?
Google Docs doesn't have access to your local machine. It will need to be on publicly accessible web server for that to work.
Your file path is wrong. You are pointing to localhost for your server. This is something running on your machine only so google reader would not be able to point to a file on your machine.
You should upload your file to a public server.
You can try even
<iframe src="http://localhost:8080/pdf">
I think there are plugins for iframe in wordpress ,Try it out..
In my Wordpress I use this plugin for Google Docs to embed .pdf
DirtySuds - Embed PDF
Then in the post use this:
[embed width="620" height="600"]http://site.com/file.pdf[/embed]
edit:
You will need live host to upload your .pdf files there.
I'm using a CMS called 'Nukeviet' and I installed it on my localhost. I'm facing a very strange problem, I've tried to search for the solution but nothing found.
I can see that css files are not working at all. When I use Firebug to find the problem, I switch to the tab 'CSS' and... all the required css files are there but it says... there're no rules! When I use the Developer tools of Google Chrome, in Resources tab, Chrome can see all the css files, but the contents of them are abnormal, like in this image:
.
I checked the encoding but it's normally ANSI. And, of course, the contents in all the css files are normal ANSI, no international text.
I tried copying the css files to a new place and write a new HTML for testing, those CSS works perfectly as usual without any problem.
So I can't understand why there're "ugly" question marks like that. Something... encrypted it?
Javascript files get the exact same problem, but image files are ok, all the others are ok, just problem with CSS and Javascript.
I think your javascript and css files are compressed for example with gzip-compression ...
Please check the configuration of your webserver if the gzip-comression is enabled.
If you're using Apache this can also be done in the .htaccess-files instead of the server-configuration - but I think that's stuff you know - don't you?
For further information:
http://developer.yahoo.com/performance/rules.html#gzip
At this page you can also check if some header-informations are missing in the response you get from your server if you request the css-file.
I am using Kohana 3. Up to now my downloadable files were residing in my application document root. So far using $this->request->send_file($download_file); it was working perfectly right.
But now my downloadable files are on another server can be accessed using http say http:://www.test.com/download/test1.doc. So Kohana's $this->request->send_file is no more working.
Can anybody tell me what could be alternate solution?
You will probably want to use Remote::get to download the file locally, then use Request::send_file to download the file.
If the server is public, you can simply redirect to the file in question.
$this->response->send_file($file);
worked for me ..