KCFinder & Ckeditor PDF file corupt upload issues - file-upload

When we upload PDF using KCfinder on our CKeditor package the file somehow converts to an image or the pdf file gets corrupted. Cannot be open. Anyone experience this same issue and found a fix?
PHP Version 5.4.

Another solution is to avoid resizing images.
In KCFinder config file (conf/config.php) set lines
'maxImageWidth' => 0,
'maxImageHeight' => 0,

I have found a solution to my own question. If anybody else has this issue please see below.
The problem seems to be that with PHP 5.4 Imagick and Magick Wand. What I did was disabled Imagick, and Magick Wand from the PHP Settings.
Then in KCFinder config file (conf/config.php) changed line 45 from
'imageDriversPriority' => "imagick gmagick gd",
to
'imageDriversPriority' => "gd",
You may get away with just editing the KCFinder config file and leaving the php settings alone. I hope this was helpful.

Related

Merge PDF PHP with PdfMerger

I use this project to merge some PDFs :
https://github.com/libremente/PDFMerger
But recently it stops working, because of certain unsupported PDF.
I have an example of a file which doesn't work.
I can reproduce the problem locally, but there is no error in PHP logs, nothing.
How could I know what is going on in my PDF ?
Here is the properties of this faulty PDF in Acrobat :
Thanks

How to open a disk file with Capacitor?

I'm saving a file by running the following code with Capacitor:
Filesystem.writeFile({
path: fileName,
data: content,
directory: FilesystemDirectory.Documents,
//encoding: FilesystemEncoding.UTF8
});
Now, I would like to open it (it's a pdf). However, I don't see anything in FileSystem documentation about how to achieve that? I'm missing a FileOpener function.
The goal is that it gets opened with whichever pdf app the user has in the phone.
I'm using Vuejs.
I hope that this is helpful to you, a package for capacitor to read pdf. https://www.npmjs.com/package/capacitor-pdf-viewer-plugin

Can't import PDF with mpdf

everyone.
I started using mpdf on my website recently. Creating new pdfs is working fine, but i can't import existing ones. I get this error whenever i try to execute the import:
mPDF error: Cannot open ../folder1/folder2/folder3/folder4/folder5/thisisthepdf.pdf !
(that is not the real path)
I included the mpdf in the php. The folder and the files are on chmod 777 and the pdfs are all version 1.4
This is the way i am trying to import.
$mpdf=new mPDF();
$mpdf->SetImportUse();
$pagecount = $mpdf->SetSourceFile('../folder1/folder2/folder3/folder4/folder5/thisisthepdf.pdf');
$tplId = $mpdf->ImportPage($pagecount);
$mpdf->UseTemplate($tplId);
$mpdf->WriteHTML('Hallo World');
$mpdf->Output();
I tried various ways to import i found on stackoverflow and other sites, but nothing worked. Not even the code from the official mpdf manual i am using (the one above) is working.
Trying to solve this issue for quite a while now, but i am out of ideas. I Hope someone can help me. Thanks in advance!
This error message is raised because of a failing call of a simple fopen(). Which means that the PHP script simply cannot access the file.
So ensure that the path is valid by e.g. passing it to realpath(), as it seems to be a relative path. If this evaluates to false the path is simply wrong. Otherwise it is a permission issue.

Opera Themes error when uploading a zip file

I am looking to customize my browsers by uploading the addons on Opera Themes. I get an error: persona.ini is invalid. Please correct it and try uploading again. The parser reported: Invalid The Blues/persona.ini file, section Window Image not found. Please fix it and try again.
I have tried new Images in my file, but it is not working. Any ideas?
put persona.ini in the folder of extension,
in persona.ini write code
[Window Image]
Type = BestFit
Tile Center = "image.png"
Colorize = 0
image.png put in the same folder

pdfkit not rendering correctly in rails 3.1

I have followed the following railscast about adding pdfkit to an application, and I am having some issues with the generation of pdfs. Here are the following things that I have done:
I downloaded wkhtmltopdf via the homebrew package manager
brew install wkhtmltopdf
Then I added the pdfkit gem to my gemfile and ran the bundle install command. I added the following to my config/application.rb file
require 'pdfkit'
...
config.middleware.use PDFKit::Middleware, :print_media_type => true
I then changed my application layout file to include all stylesheet types.
If I run rake middleware, the command works and I can see the pdfkit middleware
When I try to append pdf to the end of my routes the application just hangs and I have to exit via the command line. If I create a link to the page I want to make into a pdf, it changes all of the markup so it looks like a corrupted file. (it looks like you opened a text file into a word processor or vice versa I can provide images if that helps) If I try to make css changes in my stylesheet they do not go into effect when I view them with the link to pdf. I am assuming that this has something to do with the new asset pipeline in rails has anyone else experienced this issue?
So I was right in assuming that my error had something to do with the asset pipeline, after doing some research it looks like you need to create a new initializer and add the following code:
ActionController::Base.asset_host = Proc.new { |source, request|
if request.env["REQUEST_PATH"].include? ".pdf"
"file://#{Rails.root.join('public')}"
else
"#{request.protocol}#{request.host_with_port}"
end
}