Is there any way to convert rtf format to pdf using PHP?
Thanks
If you want to stick with pure PHP, you can probably use HTML as an intermediary:
Convert RTF to HTML
http://freshmeat.net/projects/rtf2htm/ , http://www.phpclasses.org/package/1930-PHP-RTF-to-HTML-converter-with-latin-character-support.html
Optionally: clean up the HTML
http://htmlpurifier.org/
Convert HTML to PDF
http://dompdf.github.io/
You can use OpenOffice command line interface for that. Check my answer to a similar question.
Ted is the tool you're looking for. Ted brings also a script called rtf2pdf.sh you can execute by PHP to create a PDF file.
You should try out livedocx livedocx.com . The latest Zend Framework 1.10 has a ready built module to help you out. You can read more about it at this place http://www.phpfreaks.com/tutorial/template-based-document-generation-using-livedocx-and-zend-framework
Related
I need to read certain parts from a complex PDF. I searched the net and some say FPDF is good, but it cant read PDF, it can only write. Is there a lib out there which allows to get certain content of a given PDF?
If not, whats a good way to read certain parts of a given PDF?
Thanks!
I see two solutions here:
converting your PDF file into something else before: text, html.
using a library to do so and bad news here, most of them are written in Java.
https://whatisprymas.wordpress.com/2010/04/28/lucene-how-to-index-pdf-files/
What about that ?
http://www.phpclasses.org/package/702-PHP-Searches-pdf-documents-for-text.html
ps: I don't test this class, just read the description.
$result = pdf2text ('sample.pdf');
echo "<pre>$result</pre>";
How to get “clean” text :source code pdf2text
http://webcheatsheet.com/php/reading_clean_text_from_pdf.php
I'm trying to get Perl to read an offline pcap file and save the output into XML file so I can work with it in PHP.
I can't use PHP because its not my server but I can Perl. So my aim is to convert the PCAP file into XML so I have fun with it.
I have no idea where to start and have looked at the Perl Net::Pcap but I just don't understand the language.
Any ideas on what I should do?
Thank-you
Paul
Using Net::Pcap is a decent idea, although figuring out the format you'd want to write out the capture in doesn't seem all that easy. My favourite solution would be to use tshark (the command line version of wireshark) like so:
tshark -r $dmp_filename -Tpsml
This would give you the output in a XML standard format.
Of course if you don't have tshark, not very helpful...
what's the best way to convert a text embedded in a html tag to an image using php keeping the style written in the html tag ? for example :
convert :
<span class="Apple-style-span" style="font-size: xx-large;"><font class="Apple-style-span" color="#F4A460">Stack </font><font class="Apple-style-span" color="#800000">Overflow</font></span>
into :
is there any class for it ? or should I explode it and read the tags one by one ? any suggestion ?
Might want to have a look at Painty. Although it isn't exactly what you're looking for because you'll have to feed it an array of options, it should be a good resource on which you can expand.
Not sure if you also want to render the font(s) being used in your HTML snippet, but if you do, you would also have to get all the commonly used web-fonts and put them all in a folder from where the script can read.
Hope this helps.
With PHP GD Library support, yes:
http://visionmasterdesigns.com/tutorial-convert-text-into-transparent-png-image-using-php/ (font/size technique included)
http://corpocrat.com/2009/06/23/php-script-to-convert-textemail-address-to-image/
Check this one out
http://code.google.com/p/wkhtmltopdf/downloads/list
The project is centered around html to pdf using the webkit engine, but there are also binaries and source for html to image. It's an external binary though, so might not be useful to you in your use-case.
Otherwise I would look into imagemagick.
How can you make a Koch Snowflake Fractal using php gd so that it comes out like this...
Is it possible? Is there another resource I can use?
imageline, imagerotate, imagefill, and imagefilledpolygon are your friends. they're all in the php manual. as far as the math goes, you can add this to your references: http://www.fractaldesign.net/algor.htm
You can create an image and draw lines on it using imageline.
Another posibility is using SVG. Since SVG are basically XML documents, you can make an SVG image by simply echo'ing some XML.
echo '<line x1="'.$startx.'" y1="'.$starty.'" x2="300" y2="300" />';
Can you suggest some method of converting PHP Code Sniffer XML report into HTML page(s). I guess I might need some XSLT translation… Thanks in advance for the advice.
Few days ago I posted XSLT stylesheet on my blog: http://phpdojo.blogspot.com/2010/12/converting-phpcodesniffer-xml-report.html including new type of report: xsl.
Just to add: If you run phpcs through Jenkins, then you can output the report in 'checkstyle' format.
phpcs --report=checkstyle --report-file=/phpcs/out.xml
Then configure your Jenkins job to parse the output using that file.
Here's the plugin:
https://wiki.jenkins-ci.org/display/JENKINS/Checkstyle+Plugin
Here's some output samples:
XSLT is quite cumbersome to write, very few people I know can do it well; you can instead parse the XML in a PHP script and spit out HTML.
CodeSniffer can also output its report as a CSV file - if that's easier for you to parse, use that instead.