BlueShoes Application Framework made with PHP http://www.blueshoes.org/


Packageindex Classtrees Modulegroups Elementlist Report XML Files

File: C:/usr/local/lib/php/blueshoes-4.2/core/file/converter/Bs_FileConverter.class.php
BlueShoes Application Framework - file/converter

Bs_FileConverter

Bs_Object
   |
  +-- Bs_FileConverter

Pseudostatic utility class to convert files from one format to another.

 

public class Bs_FileConverter extends Bs_Object

Pseudostatic utility class to convert files from one format to another.
WISHLIST--------FROM TO | CONVERTER LINUX | CONVERTER WIN32 | COMMENTS |---------------+-------------------------+-------------------------+----------------------------|html -> text | php (strip tags) | as linux | |html -> word | | | |html -> pdf | | | |word -> html | wvware | as linux (win32 binary) | word me,2000,98,97,95,6.0,2.0 |word -> text | catdoc | as linux (win32 binary) | word me,2000,98,97,95,6.0,2.0 could need 'lynx'. |word -> pdf | | | word me,2000,98,97,95,6.0,2.0 wvware could do this job if the adobe distiller ($$$) is installed. |pdf -> word | | | |pdf -> html | | | |pdf -> text | | | |xls -> html | xlhtml | xlhtml | |xls -> text | | | |xls -> pdf | | | |xls -> csv | xlhtml | catdoc | xlhtml | catdoc | |csv -> xls | biffwriter | | |ppt -> html | | | |ppt -> text | | | |rtf -> htmlrtf -> textpng -> gif | | | |png -> jpg | | | |gif -> jpg | | | |gif -> png | | | |gif -> ascii | | | |jpg -> gif | | | |jpg -> png | | | |bmp -> jpg | | | |tiff -> jpg | | | |all methods are called like 'htmlToText', and not the fancy way 'html2text'. this is becauseof things like 'word62word7' where 'word6ToWord7' looks much better.WORD:the wordTo methods should work with versions 2,6,7,8,9 (known as word 2, 6, 95, 97 and 2000)and are tested using versions 6 and xp. (version 2 is not fully supported.)wordxp supports versioning, that means you can store multiple versions of a document in onefile. even then it works fine by using the latest version of your document.the images are not converted. i don't see why. others have similar problems, and i thinkmore work will be done to make the whole install simpler and make everything work. also someppl have asked for a php module, and that would be nice :).dependencies: Bs_System is loaded right away because it's used often.Bs_HtmlUtil is loaded on demand.

Authorsandrej arn <andrej@arn.li>
Version4.0.$id$
Copyrightblueshoes.org

 
Direct known subclasses: Bs_FileConverterExcel

Methods inherited from Bs_Object

isex, isexception, tostring, tohtml, persist, unpersist, bs_object, bbsetoutput, bbawake, bbisawake, bbxmsg, bbxfunctionstart, bbxfunctionend, bbxecho, bbxvar, bbxvardump, bbforcetrace, bbbufferstart, bbbufferget, bbbufferendflush, bbbufferendclean

Public Method Summary

bool

capable(string $functionName)

Tells whether we can do a conversion or not.
string

&htmlToText(string $htmlString)

Convert Html => Text
mixed

&wordToText(string $from)

converts a word document to plain text.
mixed

&wordToHtml(string $from)

converts a word document to html.
mixed

&wordToWml(string $from)

converts a word document to wml.
mixed

&wordToLatex(string $from, [ string $to, string $clean ])

converts a word document to latex.
mixed

&wordToAbi(string $from)

converts a word document to abiword.
array

wordSummary(string $filePath)

returns information about the given word document.
array

wordVersion(string $filePath)

returns information about the word version.
void

Bs_FileConverter()

Warning: documentation is missing.

Private Method Summary

void

&_wordConvert( $from, $filter, string $to)

void

loadBsHtmlUtil()

Warning: documentation is missing.
void

htmlToWord()

Warning: documentation is missing.
void

htmlToPdf()

Warning: documentation is missing.

Private Field Summary

array

$_APP

reference to the global settings array
string

$_Bs_System

reference to the global pseudo-static object
string

$_Bs_Html

reference to the global pseudo-static object.
object [unknown]

$_Bs_File

instance of Bs_File, if used at all.

Private Constant Summary

BS_FILECONVERTER_VERSION >>4.0.$x$<< Warning: documentation is missing.

Public Method Details

capable

public bool capable( string $functionName )

  Tells whether we can do a conversion or not.

Parameter
string $functionName
not case sensitive.
Returns bool

true if we can, false if not
@throw NULL on an unknown $functionName


&htmlToText

public string &htmlToText( string $htmlString )

  Convert Html => Text
at first it stripps all tags, then converts html entities back to orig values.problems occur if the html is bad, for example if closing tags are missing.

Parameter
string $htmlString
Returns string

without html (and php etc) tags.


&wordToText

public mixed &wordToText( string $from )

  converts a word document to plain text.
converted format may be saved to file or returned.

Parameter
string $from
the path and filename to the original word doc.
Returns mixed

(bool TRUE if output is saved to file, string otherwise)

Throws bs_exception (with custom error text that we can't control cause it comes from the shell.)

&wordToHtml

public mixed &wordToHtml( string $from )

  converts a word document to html.
converted format may be saved to file or returned.

Parameter
string $from
the path and filename to the original word doc.
Returns mixed

(bool TRUE if output is saved to file, string otherwise)

Throws bs_exception (with custom error text that we can't control cause it comes from the shell.)

&wordToWml

public mixed &wordToWml( string $from )

  converts a word document to wml.
converted format may be saved to file or returned.

Parameter
string $from
the path and filename to the original word doc.
Returns mixed

(bool TRUE if output is saved to file, string otherwise)

Throws bs_exception (with custom error text that we can't control cause it comes from the shell.)

&wordToLatex

public mixed &wordToLatex( string $from, [ string $to, string $clean ] )

  converts a word document to latex.
converted format may be saved to file or returned.clean parameter:there are 2 xml definition files, wvLaTeX.xml and wvCleanLaTeX.xml. i don'tknow what the difference is, what it means, but i guess the not-clean oneis recommended because of the naming (it's not latex and latexDirty).

Parameter
string $from
the path and filename to the original word doc.
string $to = >>NULL,<<
the path and filename to the newly created file. if set to NULL then the converted format will be returned as string.
string $clean = >>FALSE<<
default is FALSE, see above
Returns mixed

(bool TRUE if output is saved to file, string otherwise)

Throws bs_exception (with custom error text that we can't control cause it comes from the shell.)

&wordToAbi

public mixed &wordToAbi( string $from )

  converts a word document to abiword.
converted format may be saved to file or returned.

Parameter
string $from
the path and filename to the original word doc.
Returns mixed

(bool TRUE if output is saved to file, string otherwise)

Throws bs_exception (with custom error text that we can't control cause it comes from the shell.)

wordSummary

public array wordSummary( string $filePath )

  returns information about the given word document.
it looks like word6 documents don't work.i've read that the wordcount is wrong. what you can do is wordToText and then countthe words yourself, for example using the unix standard utility wc (wordcount) whichtells chars, words and lines.return value; hash with these keys:title, subject, author, keywords, comments, template, lastAuthor, rev (=reference number),appName (application), pageCount, wordCount, charCount, security, codepage.

Parameter
string $filePath
the path and filename to the word doc.
Returns array

(hash, see above.)

Throws FALSE

wordVersion

public array wordVersion( string $filePath )

  returns information about the word version.
return value; hash with these 2 keys:'version' => (string)['word6', ...]'encrypted' => (bool)[TRUE|FALSE]note: wordxp identifies itself as word8 (word2000 is older and is word9 ...).

Parameter
string $filePath
the path and filename to the word doc.
Returns array

(hash, see above.)

Throws FALSE

Bs_FileConverter

public void Bs_FileConverter( )

 

Warning: documentation is missing.

Returns void


Private Method Details

&_wordConvert

private void &_wordConvert( $from, $filter, string $to )

 

Parameter
$from
Warning: documentation is missing.
$filter
Warning: documentation is missing.
string $to
Warning: documentation is missing.
Returns void


loadBsHtmlUtil

private void loadBsHtmlUtil( )

 

Warning: documentation is missing.

Returns void


htmlToWord

private void htmlToWord( )

 

Warning: documentation is missing.

Returns void


htmlToPdf

private void htmlToPdf( )

 

Warning: documentation is missing.

Returns void


Private Field Details

$_APP

private array $_APP

>><<

reference to the global settings array


$_Bs_System

private string $_Bs_System

>>NULL<<

reference to the global pseudo-static object


$_Bs_Html

private string $_Bs_Html

>>NULL<<

reference to the global pseudo-static object.
used by htmlToText()


$_Bs_File

private object [unknown] $_Bs_File

>><<

instance of Bs_File, if used at all.


Private Constant Details

BS_FILECONVERTER_VERSION

define( BS_FILECONVERTER_VERSION, >>4.0.$x$<< )
Case: default: case sensitive




Packageindex Classtrees Modulegroups Elementlist Report XML Files
PHPDoc 1.0beta