Can't certificate PDF file with TCPDF - laravel

I want to certificate a PDF File with Laravel and sign it with two signatures (one of the employee and one of the recruiter). I tried TCPDF Library with slef-signed certificate (generated with openssl) but the pdf generated was not certified, also I can't add image in pdf, an error was occured : TCPDF ERROR: TCPDF requires the Imagick or GD extension to handle PNG images with alpha channel. I try to solve it with adding Imagick to xampp but it's not solved .
Any suggestions to certifcate the pdf and sign it with multiple signatures !?

Add to your php.ini file this extensions.
extension=php_imagick.dll
extension=php_gd2.dll
Unix
extension=imagick.so

Related

After I datamined apk files the png images. I tried to open it. I get error message saying that it doesn't support this file format

Well, my question as it says in title. I managed to get all apk assets but every png file doesn't open.
What is more interesting that when I check file extension in the google of the image it says this.
File Type: data
MIME Type: application/octet-stream;
Suggested file extension(s): bin lha lzh exe class so dll img iso
Anyone have any guess how to make every png file work ?

Laravel 4.2 throws NotReadableException "Unsupported image type. GD driver is only able to decode JPG, PNG, GIF or WebP files."

After checked about 20 solutions I gave up and need help.
I've got 2 JPG files. Both have proper mime, they are not too big for upload_max_filesize, names are ok, path is ok. Every solution was about one of those issues.
My problem is when I run script on first image it is ok, no error, object is created:
$image1 = Image::make(public_path()."/uploads/goodimage.jpg");
See example:
https://app.esticrm.pl/uploads/goodimage.jpg
When I run it on other picture I'm getting error:
$image2 = Image::make(public_path()."/uploads/badimage.jpg");
See example:
https://app.esticrm.pl/uploads/badimage.jpg
Error message:
Intervention \ Image \ Exception \ NotReadableException Unsupported
image type. GD driver is only able to decode JPG, PNG, GIF or WebP
files.
Same situation on Windows and Linux. Files are opening on every graphic program and browser I've checked.
Those problems has started after PHP upgrade from 5.5.x to 5.6.35. Was fine before.
Ok, I found solution:
$image2 = Image::make(file_get_contents(public_path()."/uploads/badimage.jpg"));
Works also on file object from form:
$image2 = Image::make(file_get_contents(Input::file('upload_file'));
I had the same problem and my way of solving was the next.
I had to change the size that nginx allowed the user to upload in /etc/nginx.conf, like this:
http {
client_max_body_size 100M;
}
And I had to change also my php.ini, to increase the size of the files uploaded and the total size:
upload_max_filesize = 4M
post_max_size = 16M
I hope helps someone
change following variables in php.ini file
post_max_size = 128M
upload_max_filesize = 128M
print phpinfo() to find your php.ini location.
If its cpanel its under software section->php versions-> click on "Switch To PHP Options" . Then change the value.
Also change the max_execution_time to 600
if you are downloading remote image and use it with Image::, make sure that image is downloaded correctly. Sometimes when you are using file_get_contens(), image will not be downloaded or it will have size 0.
So better way to download remote image is to use CURL, but in this case you have to be sure that remote url is https
$content = $this->url_get_contents(str_replace('http://','https://',$remote_img_path));
where url_get_contents() is curl to get remote image
as explained on floyk.com:
https://floyk.com/en/post/laravel-unsupported-image-type-gd-driver-is-only-able-to-decode-jpg-png-gif-or-webp-files
The error message "Unsupported image type image/tiff" means that the GD library being used by the Intervention Image library does not support TIFF images. The GD library is a graphics library for PHP that provides image manipulation functionality, and it only supports a limited number of image formats.
To convert a TIFF image to a PNG image, you will need to use a different library or tool that supports TIFF images. One option is to use the Imagick PHP extension, which provides a set of functions for working with images and supports a wider range of image formats, including TIFF.
To use the Imagick extension, you will first need to install it on your server and then update your code to use the Imagick functions instead of the GD functions. Here is an examp…
$imagick = new Imagick();
$imagick->readImage('input.tif');
$imagick->setImageFormat('png');
$imagick->writeImage('output.png');
Alternatively, you could use a command-line tool like ImageMagick to convert the TIFF image to a PNG image. You can then use the PHP exec() function to call the ImageMagick command from your PHP code.
exec('convert input.tif output.png');

How can add signature to pdf with laravel 5.5 laravel-snappy

I'm using Laravel 5.5 laravel-snappy to create PDF.
I just wanted to add a signature in my PDF.
I am not able to find nothing, is any pluging or something for that?
Thanks
In your pdf template, you could have an image of the signature (With transparant background i.e png) or signature text at the bottom and control its appearance as you like. for example opacity, size etc.
But if you want to digitally sign your pdf then you can use tcpdf

Open downloaded file in browser pdf format

I am using paperclip to upload docx doc and pdf files to my railsapp, is there any way I can view this uploaded files in the browser itself in pdf format, without downloading it ?
Try pdf.js.
Firefox recently started using it as viewer for PDF files, but you can integrate it in your app. But you still need to 'download' it, that is, load into the browser.

Uploading a Jpeg image in Drupal 7?

I am uploading images using Media Gallery for Drupal 7. Using png image files is fine but when trying to upload jpg files I get the following error
Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: 'public://bob-ross-landscape-painting-281-28.jpg' is not a valid JPEG file in image_gd_load() (line 237 of /web/stud/u0763092/Picture/modules/system/image.gd.inc).
Any help appreciated
Thanks
As stated by the error message, your .jpg file is not readable by PHP's imagecreatefromjpeg function (par of the GD library). Are you sure your image is a valid JPG file ?

Resources