Convert txt or doc to pdf using php

Does anyone come across PHP code that converts text or a document to pdf?

it should follow the same format as the original txt or doc file, which means a line, as well as a new paragraph ...

+3
source share
4 answers

Converting from DOC to PDF is possible with phpLiveDocx :

$phpLiveDocx = new Zend_Service_LiveDocx_MailMerge();
$phpLiveDocx->setUsername('username')
            ->setPassword('password');
$phpLiveDocx->setLocalTemplate('document.doc');
// necessary as of LiveDocx 1.2
$phpLiveDocx->assign('dummyFieldName', 'dummyFieldValue');
$phpLiveDocx->createDocument();
$document = $phpLiveDocx->retrieveDocument('pdf');
file_put_contents('document.pdf', $document);
unset($phpLiveDocx);

For PDF text, you can use the PDF extension - this is PHP. You can view examples here .

+4
source

See HTML_ToPDF . It also works for text.

+1
source

SO. OpenOffice , . , :)

+1
source

It has been a long time since I touched on PHP, but if you can make web service calls from it, try this product . It provides excellent conversion accuracy. It also supports additional formats, including Infopath, Excel, PowerPoint, etc., as well as support for watermarks .

Please note that I have been working on this product, so the usual disclaimers apply.

0
source

Source: https://habr.com/ru/post/1734704/


All Articles