PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, September 19, 2022

[FIXED] How to convert a series of images into one pdf document in php

 September 19, 2022     imagick, php     No comments   

Issue

I have searched for a while and can not find a clear answer to this.

I have a folder with images: 001.png, 002.png ....etc.

what I have tried.

$allImages = 'folder/001.png folder/002.png folder/003.png';
//and
$allImages = 'folder/001.png,folder/002.png,folder/003.png';
//and
$allImages = '-adjoin folder/001.png -adjoin folder/002.png -adjoin folder/003.png';

then:

exec(convert $allImages folder/newdoc.pdf);
//and
exec(convert -density 150 -format pdf{} ".$all_images folder/newdoc.pdf);

This only puts one page into the pdf and the pdf has a header of png so it really is not readable by a pdf viewer.

I do not want to use (convert *.png newdoc.pdf) as i need the pdf in a certain sequence. EDIT: this does not work either.


Solution

You can use mPDF. All the information you need is here: mPDF Github project



Answered By - John Alexander Betts
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing