text -> pdf. formatting important

ZippyDan

Platinum Member
Sep 28, 2001
2,141
1
81
I have a bunch of text files that are created by a legacy inventory system.

When viewed in notepad in windows, they have a bunch of formatting that looks fine (think ascii art to create boxes and stuff)

I need to save some of these text files as pdfs. I tried using CuteWriter PDF's free utility, but it completely messes up the formatting.

One of the problems (but not the only problem) is that these text files are very wide, so lines will tend to wrap. I tried changing the orientation to landscape, but that only helped a little (and as I said, that's not the only problem)

There is a dotmatrix printer that prints these inventory sheets. Interestingly, when I print from DOS (using the print command), the formatting is preserved but squished to fit nicely on a normal 8.5X11 paper. If I print using normal Windows Printing, the formatting looks terrible just as when I try to printtoPDF.

Can anyone give me any tips on how I might preserve this ASCII formatting when printing to PDF?
 

Cogman

Lifer
Sep 19, 2000
10,286
147
106
Why do you need to convert it to PDF? A txt file seems more portable.
 

ZippyDan

Platinum Member
Sep 28, 2001
2,141
1
81
Why do you need to convert it to PDF? A txt file seems more portable.

I need to pass it on to persons whom I do not want editing the file.

Certainly I could do that with a password protected word file, but at that point, PDF becomes more portable

And certainly someone could still edit a pdf file, but it is less easy to do so, and less likely that it could happen by accident.
 

Cogman

Lifer
Sep 19, 2000
10,286
147
106
I need to pass it on to persons whom I do not want editing the file.

Certainly I could do that with a password protected word file, but at that point, PDF becomes more portable

And certainly someone could still edit a pdf file, but it is less easy to do so, and less likely that it could happen by accident.

Could you host it on the network, read-only? Heck, you might even be able to get away with changing the extension from .txt to .html (though, it might still screw up the formatting, but most aren't savvy enough to realize that .html files are just .txt files with a different extension.)

I'm not familiar enough with pdf to give a good suggestion there unfortunately.

You might give http://sourceforge.net/projects/pdfcreator/ a try
 

amddude

Golden Member
Mar 9, 2006
1,711
1
81
Could you pm me one of the files? I work with data processing almost exclusively at work (hospitals, to get billing info). I might be able to help.
 

MrChad

Lifer
Aug 22, 2001
13,507
3
81
I'm not familiar with how the CutePDF utility works, but assuming you are using a fixed-width font (like Courier) and a reasonably small font size, preserving ASCII formatting should be fairly trivial.

One thing you might want to do is replace any tab characters in the text with a series of spaces. The "width" of a printed tab character can vary depending on the device or application, so you'll get more consistent results if you replace tabs with spaces.
 

corkyg

Elite Member | Peripherals
Super Moderator
Mar 4, 2000
27,370
240
106
Pull 'em into Word. Then format as needed. Then print via PDF. You can change to landscape, then change the font to fit.

Alternatively, scan 'em and send them as graphic files - they can be read but not edited easily.

They can also be scanned directly into PDF files.
 
Last edited:

amddude

Golden Member
Mar 9, 2006
1,711
1
81
If you don't end up pm'ing me anything, I would suggest opening the file in notepad++ or gsview
 

lxskllr

No Lifer
Nov 30, 2004
60,926
11,258
126
I usually use Open Office for that kind of thing, and export as PDF. You can try that and see if it works.
 

ZippyDan

Platinum Member
Sep 28, 2001
2,141
1
81
thanks for all the suggestions.

>Could you host it on the network, read-only?

I want to email the files to external persons, so that doesn't work.

>you might even be able to get away with changing the extension from .txt to .html

I'm leaning towards pdf because most of these files are invoices, and I think pdf just seems more professional.

>Could you pm me one of the files?

Certainly, within a couple of hours.

>One thing you might want to do is replace any tab characters in the text with a series of spaces.
>Pull 'em into Word. Then format as needed.

Both of these solutions require editing every single document. I need a slightly more elegant solution.

>Alternatively, scan 'em and send them as graphic files - they can be read but not edited easily.

This is actually exactly what the office was doing. But this is horrible inefficient and also quite stupid: the data already exists on the computer in digital form. They are printing out a piece of physical paper from a digital document just to scan in back into digital form. For now at least, I have them taking a screenshot of the opened text file and saving that as jpg which at least keeps the data on the computer, and is more consistent and professional looking than a scan.

>how bout just code something to parse the tab/cr/lf in perl/php/java?

That is more work than I am willing to do: I can program, but I'm not a programmer, so that would take me much longer to get done and working correctly.
 

Gooberlx2

Lifer
May 4, 2001
15,381
6
91
Try altering the page size/margins/paper properties (legal vs letter), since CutePDF Writer acts like a printer.
 

Emulex

Diamond Member
Jan 28, 2001
9,759
1
71
really perl? php? that would take like 5 minutes.

maybe 1 hour if you wanted to convert the invoice to pdf using a free pdf lib.

come on man. you've spent that much time typing this thread -
 

Fullmetal Chocobo

Moderator<br>Distributed Computing
Moderator
May 13, 2003
13,704
7
81
Definitely CutePDF, and just print it to PDF. CutePDF works perfect for stuff like this.