Printer escape characters and iTextSharp

D

David

Hi all,

I have data intended for a printer, which I need to analyse, but I also want
to create a PDF file.

I have escape codes, namely esc 14 and esc 15.

ESC 14 (Enlarged - one line)
ESC 15 (Condensed print)

This is in the raw data, and what I want to do is to use these so that the
PDF now looks like what would have been printed. I don't want the printer
driver that does it, as I have to automate it.

I know about iTextSharp, but have not been able to find any information on
being able to use standard epson escape codes.

Can this be done?

Is there a link I can take a look at to see how it is done?

Any help would be appreciated.

On another note... slightly related, When I read the data intended from the
printer, I want to also display it in the RichTextBox, using the same escape
codes to format the data. Is there any way that I can do this? Could it be
the same as what I am looking for the PDF file that I want to create?

Thanks.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
 
A

Arne Vajhøj

I have data intended for a printer, which I need to analyse, but I also want
to create a PDF file.

I have escape codes, namely esc 14 and esc 15.

ESC 14 (Enlarged - one line)
ESC 15 (Condensed print)

This is in the raw data, and what I want to do is to use these so that the
PDF now looks like what would have been printed. I don't want the printer
driver that does it, as I have to automate it.

I know about iTextSharp, but have not been able to find any information on
being able to use standard epson escape codes.

Can this be done?

Is there a link I can take a look at to see how it is done?

Any help would be appreciated.

On another note... slightly related, When I read the data intended from the
printer, I want to also display it in the RichTextBox, using the same escape
codes to format the data. Is there any way that I can do this? Could it be
the same as what I am looking for the PDF file that I want to create?

PDF is not based on Epson escape codes. PDF is based on PS.

You can certainly do the same thing in PDF, but it has nothing
to do with escape codes.

Arne
 
D

David

Hi,

Thank you Peter and Arne,

I am aware that PDF and RTF don't support escape codes and that the escape
codes are specifically for printer devices. However, researching the escape
codes gives me information that I can use so that I might be able to emulate
it.

I guess basically, what I am looking for is a conversion of some sort to be
able to take in the escape codes and convert them into what is
understandable by iTextSharp and also with RTF. (Two seperate conversions
won't be a problem)

I accept what you are saying about a graphics object. If that is the way I
need to go, then I don't have a problem with it, however, the underlying
issue still arises I think. At this point in time, I have two escape codes I
have to work with, ESC 14 and ESC 15, but there may be more as this is
developed to be suitable for other systems.

Hhhmmm... I guess it looks like I might have to just experiment with things.
 
A

Arne Vajhøj

I am aware that PDF and RTF don't support escape codes and that the escape
codes are specifically for printer devices. However, researching the escape
codes gives me information that I can use so that I might be able to emulate
it.

I guess basically, what I am looking for is a conversion of some sort to be
able to take in the escape codes and convert them into what is
understandable by iTextSharp and also with RTF. (Two seperate conversions
won't be a problem)

I accept what you are saying about a graphics object. If that is the way I
need to go, then I don't have a problem with it, however, the underlying
issue still arises I think. At this point in time, I have two escape codes I
have to work with, ESC 14 and ESC 15, but there may be more as this is
developed to be suitable for other systems.

Hhhmmm... I guess it looks like I might have to just experiment with things.

I am pretty sure tat the only thing you can do is to take:
- docs of escape codes
- docs for iSharpText
and start coding.

Big task!

Arne
 
D

David

I am pretty sure tat the only thing you can do is to take:
- docs of escape codes
- docs for iSharpText
and start coding.

Big task!

Arne

Hi,

At the current time, I only have two escape codes to work with. What I
actually did to help me (as trying to read through the specs for RTF is
going to take a long time) was to copy my text into wordpad and format it
the way I wanted, taking care to know where the control characters are.

I then saved that file and opened it in notepad and have extracted the bits
I need. I am now feeding that into the RichTextBox.RTF and it is working
well. As I build up my library of equipment that sends the data to my
software, my Escape code parser will expand, though it will always be pretty
basic as it does not need to work to the full RTF spec.

I then thought that iTextSharp might be able to take RTF and convert it to
PDF. It seems not. Also, iTextSharp is distinctly lacking in documentation.
I might be able to get away with just using an RTF file.

Thanks all.
Regards,
David Colliver.
 
J

Jeff Johnson

Also, iTextSharp is distinctly lacking in documentation.

I've been doing my PDF work in PDFsharp, which also isn't that big on
documentation (well, reference, yes, tutorials, no). I actually learned more
by first reading the PDF specs (they are VERY well-written) and then looking
at the object model and sample code from PDFsharp. All sorts of things made
far more sense then.
 
A

Arne Vajhøj

I then thought that iTextSharp might be able to take RTF and convert it to
PDF. It seems not. Also, iTextSharp is distinctly lacking in documentation.
I might be able to get away with just using an RTF file.

RTF2PDF would also be a huge task.

AFAIK then iTextSharp is a simple pDF API, where you have
to do things programmatically.

If RTF is good enough, then it is easier due to better
support in .NET.

Arne
 
J

James A. Fortune

I've been doing my PDF work in PDFsharp, which also isn't that big on
documentation (well, reference, yes, tutorials, no). I actually learned more
by first reading the PDF specs (they are VERY well-written) and then looking
at the object model and sample code from PDFsharp. All sorts of things made
far more sense then.

The RTF capabilities of the PDF format are so far beyond that of the
RichTextBox that I have little reason to use Microsoft's RTF. For
example, text font, text size, text color and sub-scripting or super-
scripting can be modified easily for each character. Text can follow
a curve or become an image mask. Even the angle of each letter can be
individually specified. I have also read many of the PDF specs (at
least for versions 1.4 through 1.7) and agree that they are well
written. At several key points, though, some useful examples are not
forthcoming; but Adobe had to find some way to keep the length of the
document under 1000 pages :). IMO, if a document reaches the point
of requiring some kind of RTF, then it's time to give the document the
additional capabilities of the PDF format and abandon whatever
simplified Microsoft output format was used to generate it. I realize
that RTF can stretch the usefulness of some Microsoft output a little,
but short of manipulating something like XPS, the amount of stretch is
quite limited.

James A. Fortune
(e-mail address removed)
 
J

Jeff Johnson

The RTF capabilities of the PDF format are so far beyond that of the
RichTextBox that I have little reason to use Microsoft's RTF.

I kind of think that comparing RTF and PDF is apples to oranges. (And PDF
doesn't have any "RTF capabilities," by the way. RTF is a file format.)

Basically, PDF is specifically for representing an EXACT image of a
document. Without very specialized code you cannot reflow a PDF, whereas
formats designed more for word-processing applications like RTF allow
reflowing of text. So I think deciding between RTF and PDF is a matter of
determining which is the right tool for the job.
 
J

James A. Fortune

I kind of think that comparing RTF and PDF is apples to oranges. (And PDF
doesn't have any "RTF capabilities," by the way. RTF is a file format.)

Basically, PDF is specifically for representing an EXACT image of a
document. Without very specialized code you cannot reflow a PDF, whereas
formats designed more for word-processing applications like RTF allow
reflowing of text. So I think deciding between RTF and PDF is a matter of
determining which is the right tool for the job.

PDF is also a file format :). As far as static positioning and
attributing of text goes, RTF is a file format that is used to do in a
difficult way what the PDF file format does easily. If your main
emphasis is different reflows for different output devices, then the
decision is really between RTF and the "tagged" PDF format, which was
specifically designed to allow that purpose. Most decisions between
RTF and PDF are simply ones of preference. It is not apples and
oranges unless you are just looking at things that PDF can do that RTF
can't. Microsoft has really closed the gap with XPS, but my remarks
were with respect to RTF only.

James A. Fortune
(e-mail address removed)
 
J

Jeff Johnson

If your main emphasis is different reflows for different output devices,
then the decision is really between RTF and the "tagged" PDF format

Any links to docs on this tagged PDF?
 
J

Jeff Johnson

The PDF Reference Manual discusses the Tagged PDF Format.

Ahhh, Document Interchange. I never got that far because it wasn't relevant
to the library I was using. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top