Generating pdfs with pdflib all images are blurry - php

we are currently working on a PHP project for one of our customers where we had to increase the PHP version (5.6.40) and the version of PDFLIB (9.1.1.p3). Since then we have the problem that all images are blurred, as if there is a white veil over them. We don't understand what the reason can be, because there have been no changes in the code.
before update
after Update

When I look at the pictures, two possible causes come to mind:
The colour profile in the image is sometimes processed and sometimes not.
an intermediate step processes the images before they are loaded and that has also changed.
It would also be good to know which PDFlib version you used before and whether the image is also manipulated on the server.
Probably the best thing to do is to open a support case directly with PDFlib support. https://www.pdflib.com/licensing-support/opening-a-support-case/
Then you can also send more details and an example PDF before and after the update. It is also best to share an example input image.

Related

Creating an image from an HTML document at runtime

I am currently working on a website project that requires the creation of an image based on user input on a form. Basically, I'm trying to create an image from existing HTML markup with the form data replacing some of text. The text is almost always unique.
I have explored several options for creating such an image, mainly:
imagecreate with PHP that wasn't flexible enough, and
PhantomJS which I can't really install on the server
wkhtmltopdf and php-wkhtmltox
I am working in a shared-hosting environment that limit my available options. The environment supports PHP (compiled with GD), Perl, and Python.
Is there a reliable way to implement such a behavior?
I use CutyCapt software to render images from html, it works perfectly. The only issue is that you need to build it on your shared hosting. Probably the workaround could be in building it on your local machine, uploading it to your hosting and running it from there, but I don't believe it will work, because it requires X server.
Another possible solution could be use of GD library to build the image manually. If you know how your html is looks like, you can replicate it by drawing all elements on a blank image. It is not easy to do, but looks like this is only one solution which you can use.

PHP un-editable pdf/file export option

I am developing an application in the Kohana PHP framework that assesses performance. The end result of the process is a webpage listing the overall scoring and a color coded list of divs and results.
The original idea was to have the option to save this as a non-editable PDF file and email the user. After further research I have found this to be non as straight forward as I hoped.
The best solution seemed to be installing the unix application wkhtmltopdf but as the destination is shared hosting I am unable to install this on the server.
My question is, what's the best option to save a non editable review of the assessment to the user?
Thank you for help with this.
I guess the only way to generate a snapshot, or review how you call it, is by storing it on the server side and only grant access via a read only protocol. So basically by offering it as a 'web page'.
Still everyone can save and modify the markup. But that is the case for every file you generate, regardless of the type of file. Ok, maybe except DRM infected files. But you don't want to do that, trust me.
Oh, and you could also print the files. Printouts are pretty hard to be edited. Though even that is not impossible...
I found a PHP version that is pre-built as a Kohana Module - github.com/ryross/pdfview

tint images without imagemagick

I have an upload form for images that once uploaded are then displayed automatically and randomly on a website. I would like to apply a colour tint to the images before they are saved, at the very least one green but preferably various colour tints which are saved in relevant folders /green/ /red/ /blue/ etc. so I can make skins for the site.
My hosting package doesn't allow me to install imagemagick so I'm looking for a way to achieve these results in html css and php preferably, as that's where my limited knowledge lies, but if that's not possible I will consider other options.
is gdlib enabled?
or you use aviary or one of their apis http://developers.aviary.com/filter-list
http://developers.aviary.com/
Update: as Aviary is no more offering this service as before but here are some more good solutions:
take a look at Pixastic (coloradjust)
https://github.com/jseidelin/pixastic
http://www.pixastic.com/lib/docs/actions/coloradjust/
or PaintbrushJS (colour tint)
https://github.com/mezzoblue/PaintbrushJS
http://mezzoblue.github.com/PaintbrushJS/demo/
If the PHP on your hosting package is compiled with the GD library you could use that instead. imagefilter

Pdf on web page: best solution

I need to include pdf files in some webpages, and I'm gettin' in troubles.
The app is a simple newspaper's archive, in which i can read right on page or download as pdf files, one file per page. What my customer can provide me is one pdf file for each page; what my customer wants from me is to navigate them in indexes (with page thumbnail) and have a read from a choosen one direcly in page; I'm using php/mysql.
I started trying out to use the <object> tag with type="application/pdf", but i found it's deprecate 'cause it's not crossplatform at all (there's no support on linux's browsers, but even my windows' firefox 3.5 couldn't show me anything).
I guessed I could transform that pdf in something different (html or simply images are good enough), but the only thing i found is ImageMagick, that I cannot use as I must install on server and I can't, as I'm not admin of that machine.
So, I'm finally looking for suggestions
Thanks
Display the pdf inline using an IFRAME. The thumbnail you can generate with imageMagik. You should be able to use the command line version of ImageMagik to resize and convert to jpg.
edit
Your best bet is to talk to the server admin and have them install php support for ImageMagik then you can use it as a class.
If you can't get support to install on the server, you will have to use the command line version.
You might be able to Google around for a library that wraps the command line, but it would be trivial to write it yourself.
With this in place you can create a large readable black and white png for each page. It should click through to the pdf.

PHP Replace Images with GD Library Resampled Images in Joomla

I am the tech intern for an online independent newspaper, and the writers on the staff are not tech-savvy. They don't quite understand how web pages work, and often they upload and include images straight from their digital cameras, or scanned from original media. These images become a burden when there are 10 images on the front page each at 3.5Mb each.
We are trying to work out some sort of training method for teaching them how to resize and optimize the images they want to include in their articles, but like I said, they are not very tech savvy, and any method we attempt to employ may go way over their heads.
So, I wanted to know if it is outside of reason to attempt to resample and cache images that are included in the articles using a PHP function and the GD library in order to stream line the amount of data that has to be passed per article.
I think it's possible, I'm just trying to figure out if it would be worth it to just take the time and effort to train the writers, or if creating an automated process would be better.
You'd be better off doing the GD image processing during the upload process. GD can take up quite a bit of resources, so processing each image on every request would not be a preferable solution. If you can't do it during the upload process, you should cache all the resampled images and use those if/when available.
It's certainly possible, and I'd be very surprised if Joomla! doesn't already have modules that do just that.
With the current web site that I'm working on I needed to answer a similar question. I've opted for using the joomla addon Easy Gallery. The two stand out features for me are the automated thumbnail creation and the image resize feature. The sizes are configurable with the components configuration page. You'll have a thumbnail, a resized image and the original image with each upload.
This component is a Joomla 1.0 component, so, if you're running a Joomla 1.5 install you will need to turn on legacy mode. Work seems to be in progress for a native 1.5 version.
I also found a couple of places where the generated thumbnails weren't being displayed. I raised the question on the Easy Gallery forum, and managed to work out the answer for myself.

Categories