Convert RTF File into HTML in Objective C - html

How can I convert an RTF file into an HTMLformat ?? I have a text editor which saves the file in rtf format but I need to put the contents on my server. For that I need to convert the rtf file into that of an html.. I am unable to find any help with regards to Objective C . Thanks.

I don't know of any library in objective-c that does rtf to html conversion.
However if you are able to perform the conversion server side then that opens up a lot more possibilities, such as php and c# libraries, as well as gnu utilities.
For example (and you can google for many more):
php: Pa software's RTF to HTML converter (paid product), Martin Mevald's rtf2htm (old GPL'ed software), Marcus Fischer's RTF Parse class (GPL'ed code), Zend's LiveDocX or even alternatives to livedocx on SO alternative-for-phplivedocx .. etc
C#: On SO convert-rtf-to-html, simple-convert-rtf-to-html, or from MS Converting-between-RTF-and-HTML
GNU: GNU's UnRTF utility.
If you really want Objective-c then the source code of the php and GNU solutions could be translated - however that will not be a trivial task. As such I still think your best bet would be to do it server side.

Related

python 3 - .swf to html

Is there a way to decompile flash files into html in python 3?
I'm using urllib to gather html data from a website and would like to include flash content .. in html format, as part of the rest of the html content, preferably without downloading the file.
The few packages available are old and not made for python 3 or are not web based.
There are many free online decompiler tools for this so I thought it would have been easier to find code for this.
Thanks in advance!
UPDATE
As a workaround solution I have found this:
http://www.nowrap.de/flare.html
Which is a command line swf to html converter. I'm considering calling it as a subprocess unless someone has a better idea?

How to convert Html to PostScript using GhostScript?

I want to convert html to PDF in order to converting it i found that direct conversion is not possible so i choose a method html-->PS-->PDF i have successfully convert PS to PDF but cant convert html to PS through ghost script now can anyone please tell me is it actually possible or not and if it is then how ?
Platform - Windows
note - No thirt pary/paid/dll tools plesae
Ghostscript does not interpret HTML, so no you cannot take HTML and create a PostScript (or PDF) file using Ghostscript directly. Since you can't convert HTML to PDF using Ghostscript, why would you think you could convert HTML to PostScript with it ?
You can (in general) print from a browser window to a virtual PostScript printer in order to create PostScript.
If that isn't acceptable then you will need to use some other means to create PostScript from HTML, in which case you may as well just go straight to PDF. wkhtmltopdf is open source, you could try that.

xgettext to generate po file from html files

This is something I am trying so hard to get. tried a bunch of options, including this one found here Extracting gettext strings from Javascript and HTML files (templates). No go.
this is the sample html
<h1 data-bind="text: _loc('translate this')"></h1>
the command I have tried (php, glade..)
xgettext -LPHP --force-po -o E:\Samples\poEdit\translated.po --from-code=utf-8 -k_loc E:\Samples\poEdit\html\samplePO.html
glade seems to look only inside tags and completely skips the keyword. Anyone solve this problem?
We eventually ended up writing a small .net application to parse the html and create a json representation and used language PYTHON with xgettext to create the po file from javascript.

How do I use the Perl Text-MediawikiFormat to convert mediawiki to xhtml?

On an Ubuntu platform, I installed the nice little perl script
libtext-mediawikiformat-perl - Convert Mediawiki markup into other text formats
which is available on cpan. I'm not familiar with perl and have no idea how to go about using this library to write a perl script that would convert a mediawiki file to an html file. e.g. I'd like to just have a script I can run such as
./my_convert_script input.wiki > output.html
(perhaps also specifying the base url, etc), but have no idea where to start. Any suggestions?
I believe #amon is correct that perl library I reference in the question is not the right tool for the task I proposed.
I ended up using the mediawiki API with the action="parse" to convert to HTML using the mediawiki engine, which turned out to be much more reliable than any of the alternative parsers I tried proposed on the list. (I then used pandoc to convert my html to markdown.) The mediawiki API handles extraction of categories and other metadata too, and I just had to append the base url to internal image and page links.
Given the page title and base url, I ended up writing this as an R function.
wiki_parse <- function(page, baseurl, format="json", ...){
require(httr)
action = "parse"
addr <- paste(baseurl, "/api.php?format=", format, "&action=", action, "&page=", page, sep="")
config <- c(add_headers("User-Agent" = "rwiki"), ...)
out <- GET(addr, config=config)
parsed_content(out)
}
The Perl library Text::MediawikiFormat isn't really intended for stand-alone use but rather as a formatting engine inside a larger application.
The documentation at CPAN does actually show a way how to use this library, and does note that other modules might provide better support for one-off conversions.
You could try this (untested) one-liner
perl -MText::MediawikiFormat -e'$/=undef; print Text::MediawikiFormat::format(<>)' input.wiki >output.html
although that defies the whole point (and customization abilities) of this module.
I am sure that someone has already come up with a better way to convert single MediaWiki files, so here is a list of alternative MediaWiki processors on the mediawiki site. This SO question coud also be of help.
Other markup languages, such as Markdown provide better support for single-file conversions. Markdown is especially well suited for technical documents and mirrors email conventions. (Also, it is used on this site.)
The libfoo-bar-perl packages in the Ubuntu repositories are precompiled Perl modules. Usually, these would be installed via cpan or cpanm. While some of these libraries do include scripts, most don't, and aren't meant as stand-alone applications.

Generate HTML reports containing info stored in pdf files

I would like to generate an html report containing some outputs (graphs, statistics from R). The graphs are saved in pdf files.
My option : perl script that will generate the html report( by converting the pdf into jpeg)
What other options would be ideal in this case?
I am working in UNIX environment.
If you are familiar with R, you can probably look at the knitr package. R2HTML is based on Sweave, which is not quite extensible, and knitr is fully extensible and supports HTML naturually; see a minimal example with source.
You have many choices on how to save R graphics (pdf, png, jpeg, ...); see the dev option (graphical device). So there is no need for conversion from PDF to other bitmap formats on R's side.
You said you had Ruby and C output as well; I'm not sure how you are going to deal with them: do you want to generate the output dynamically (literate programming) or insert them manually? For the former, you can probably use the R function system() to run external programs (e.g. call C to generate PDF and call perl to convert). You can also define knitr hooks to do these jobs, but you may need to more to learn how hooks work in knitr.
Another approach is to convert your PDF output with a batch job, and modify the HTML code, e.g. replace <img src='foobar.pdf' /> with <img src='foobar.jpeg' /> in HTML after you have converted all PDF files to JPEG. This should easier.
If you have control over the how the graphs and statistics are created in R, your easiest approach would probably be using the R2HTML package to generate the HTML directly. This would include an sweave-like approach which would substitute R output in appropriate places in an HTML template.
Also, R can create jpeg files (or gif's) for graphs as easily as it creates PDF's, so that conversion step can be avoided entirely.