I am building a web application that requires a number of dynamically generated RTF files to be generated, these files are currently .RTF files but I need to build them all within my application in RTF format, does anyone know a program or something that I can open them in and view the raw RTF code that creates the file eg.
{\rtf\ansi\deff0{\fonttbl{\f0\froman Tms Rmn;}{\f1\fdecor
Symbol;}{\f2\fswiss Helv;}}{\colortbl;\red0\green0\blue0;
\red0\green0\blue255;\red0\green255\blue255;\red0\green255\
blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\
green255\blue0;\red255\green255\blue255;}{\stylesheet{\fs20
\snext0Normal;}}{\info{\author John Doe}
{\creatim\yr1990\mo7\dy30\hr10\min48}{\version1}{\edmins0}
{\nofpages1}{\nofwords0}{\nofchars0}{\vern8351}}\widoctrl\ftnbj \sectd\linex0\endnhere \pard\plain \fs20 This is plain text.\par}
Thanks for any help.
J.
Notepad, or any text editor will do. As you are creating the files yourself programatically, you will want to be liberal with carriage returns and line feeds to make the files more readable.
Related
I have used file.create and file.append successfully to aggregate multiple .txt files. When I try it with .rtf files, however, I get a larger rtf file that only shows the contents of the first .rtf of many to be aggregated.
So I have 5 .rtf files, for example. dirFiles is the list of names to be aggregated:
file.create(fileCollection_r)
file.append(fileCollection_r,dirFiles_r)
Is this a bug, and I would I report it?
How can I aggregate multiple .rtf files?
First of all, it is not clear what file.create() resp. append is doing. You didn't tag for a specific programming language, so that part of your question is really unclear and you need to improve that.
Having said that: RTF files, are in the end, pure text files. They contain formatting information, such as
{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf100
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
So, theoretically, you can just pull that text content from multiple RTF files, and put all of that into a single file.
Thus: simple use a file viewer, such as less, cat, or some windows/macos pendant, and A) check the textual content of your single RTF files and B) check out the textual content of the file that you created this way. That will tell you if the pure textual append did work.
But beyond that: it could very well be that the RTF format itself has certain limitations, that simply make it not possible to just append arbitrary RTF file content and end up with something that works as a correct RTF document.
As quoted in the "Developer Guide" of Amazon EMR, the files in the input directory should be formatted as plain text. Does it mean that i cannot upload some binary files or .png files and parse them by python script?
Likely not. See for example: https://groups.google.com/a/cloudera.org/forum/?fromgroups=#!topic/cdh-user/AUUZ0DKiJGw
what you can do is to have an input data be the file names themselves (either in S3 or HDFS). The Hadoop streaming script will get file names as input that it can open and process as it sees fit.
I have a parent folder with around 30 subfolders which each contain pdfs,.doc,.docx, and .jpg files. I need to combine all files into one large pdf. I want the order in which the files are appended into the 'master pdf' to reflect my current folder and file order (which is alphabetic for the subfolder names and numeric for the files within each subfolder).
I am fairly new to Unix and am a bit stuck on this....I would be most grateful for any advice you may have on how to approach this problem. Thank you.
There are three problems here:
Traverse the directory tree to find all documents
Convert each file into PDF
Merge the PDFs
For the first part you could use the find command to get the list of files or script the directory traversal.
For the second part you could use OpenOffice/LibreOffice command line driver to convert .doc and .docx files and ghostscript to convert .jpg files.
For the third part, probably ghostscript again.
Alternatively there are good PDF APIs available for some programming languages, such as iText from Lowagie for Java.
Plain and simple: is there a way to read (not run) .sas files on osx in order to rewrite old SAS programs in another language, e.g. R? Note I do not refer to reading sas data files – I know there are several ways, I am just interested in reading old SAS code.
.sas files containing SAS code should just be a text file. You can use any text editor that you like to open and modify these files. Since the system probably doesn't have .sas files associated with any particular program you can either use the "Open with" option when "right-clicking" on the file or you could open the editor first and then open the file from within the editor.
TextEdit will work. Another editor that I like is Komodo Edit.
How to generate Rich Text Format (RTF) document in ASP.NET?
The RTF specification from Microsoft:
http://msdn.microsoft.com/en-us/library/aa140277%28office.10%29.aspx
Or, in order to bypass the RTF learning curve, you could generate HTML from ASP.NET then shell out and use the html2rtf tool to convert it to rtf:
http://www.gkrueger.com/personal/html2rtf/index.html
Or, if your doc is going to be used in template-like manner, you could create the rtf file by hand in WordPad and save it with special strings that you invent, like $YOUR_NAME_HERE$. Later, you read the your saved rtf file and replace your special strings.
Just follow the spec:
http://en.wikipedia.org/wiki/Rich_Text_Format
Start your file with
MyFile.WriteLine("{\\rtf1 ")
and just follow the spec linked by Spencer.