Bothering LineFeed after FormFeed on Matrix-printer.

Stimulsoft Reports.WPF discussion
Post Reply
User avatar
PJoyeux
Posts: 160
Joined: Tue Nov 26, 2013 9:40 am
Location: Germany

Bothering LineFeed after FormFeed on Matrix-printer.

Post by PJoyeux »

Hi,

I am printing to a MatrixPrinter using the following code (using version 2014.1.1807.0):

Code: Select all

objReport.PrintToDotMatrixPrinter(aPrinter, System.Text.Encoding.GetEncoding(1252), false, Stimulsoft.Report.Export.StiTxtBorderType.Simple, false, false, false, false, 1, 1, 1, objReport.RenderedPages.Count, true, "EpsonFX");
This works, but something kept bothering me: the first page always started a row higher that all following pages. Regardless of how simple the report was, the first row of the first page was always higher. This wasn't all that tragic until now, where I have to fill a form with preprinted areas that I have to fill. Now the first printout always is out of order because the first row of the first printout doesn't start where the first rows of all following printouts start.

I have now created a Hex-Dump of everything the report sends to the printer and found out where the problems lies. It is not the first printout that is wrong, but all the following ones! :roll:

As you can see in the attache PNG-file, which is a scan of the HexDump, after each FormFeed some codes are inserted before the real text of the new page starts. Those are "20 OD OA" which translate to "BLANK", "Carriage Return" and "Line Feed".

Why are those codes inserted?

I have attached the Hex-Dump and the report so you can reprodue this behaviour and hope you can find the reason why this happens. Maybe a setting somewhere? Or is it a bug?

Cheers,
Pascal
Attachments
HexDump.png
HexDump.png (181.91 KiB) Viewed 4449 times
Test_123.mrt
(11.75 KiB) Downloaded 649 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Bothering LineFeed after FormFeed on Matrix-printer.

Post by HighAley »

Hello.

We have made an improvement.
Please, check our next prerelease build, which will be available on January 31.

Thank you.
User avatar
PJoyeux
Posts: 160
Joined: Tue Nov 26, 2013 9:40 am
Location: Germany

Re: Bothering LineFeed after FormFeed on Matrix-printer.

Post by PJoyeux »

Hi,

I just tested it with the version 2014.1.1809 but unfortunately the problem is still there. I made a Hex-Dump and it the same as the one I sent you. Further at the END some more useless commands are sent after the last FF: 20 0D 0A 0D 0A 0D 0A

To check this you have to print the report at least twice directly one after the other (for example in a loop).

The printer is installed as "Generic / Text Only" and I have not set anything in the driver so I think everything that ends up in the Hex dump must have been sent by StimulSoft...

You said you made an improvement, can you explain what you chanded? Do I have to recreate my report to test this?

Cheers,
Pascal
Andrew
Posts: 4108
Joined: Fri Jun 09, 2006 3:58 am

Re: Bothering LineFeed after FormFeed on Matrix-printer.

Post by Andrew »

Dear Pascal,
I just tested it with the version 2014.1.1809 but unfortunately the problem is still there.
I made a Hex-Dump and it the same as the one I sent you.
Further at the END some more useless commands are sent after the last FF: 20 0D 0A 0D 0A 0D 0A
You said you made an improvement, can you explain what you chanded?
We improved the property PutFeedPageCode.
If it is set to true, the feed command (FF, FormFeed) is automatically inserted page after each page.
Earlier, after this command, an extra code CR/LF was inserted. Now it is not inserted.
Do I have to recreate my report to test this?
There is no need to do this again.
The best solution is to remove the FF command from the textbox and use the PutFeedPageCode property for the automatic insertion of the FF command.
If you still want to embed the FF command, you have to insert it at the beginning of a text line, rather than at the end of it, because the text line is always terminated with the code CR/LF.

Thank you.
User avatar
PJoyeux
Posts: 160
Joined: Tue Nov 26, 2013 9:40 am
Location: Germany

Re: Bothering LineFeed after FormFeed on Matrix-printer.

Post by PJoyeux »

Hi Andrew,

thanks for your answer.

So if I want to still use the embedded <#ff> I would have to put this at the start of each document? So each printout would start with an empty page and all subsequent pages would be correct... I would have to change my documents slightly and move them one row upwards.

I have tried the other way around and removed the <#ff>. But now there is no FormFeed at all. I use the following code to print:

Code: Select all

objReport.PrintToDotMatrixPrinter(aPrinter, System.Text.Encoding.GetEncoding(1252), false, Stimulsoft.Report.Export.StiTxtBorderType.Simple, true, false, false, false, 1, 1, 1, objReport.RenderedPages.Count, true, "EpsonFX");
I have set the fifth parameter to "true" (it was set to "false" before) but no FormFeed is sent.

How does the report generator decide when to send an FF?

I have attached a small sample. The page has the size "GermanFanFold". On it there is one band roughly one third of the size of the band. This band contains one Textfield. If I print this, the band is repeated on the same page until the end of the page is reached. I need the band to be printed once and then I need a FF to move on to the next page... I have tried setting the "NewPageAfter"-Property of the band but that didn't change anything. Then I changed the size of the band in order to fill the whole page, and that didn't change anything too...

Can you please alter the report or tell me what I settings I need to use "PutFeedPageCode" properly?

Thanks,
Pascal
Attachments
123 mit Band.mrt
(14.8 KiB) Downloaded 564 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Bothering LineFeed after FormFeed on Matrix-printer.

Post by HighAley »

Hello.

Why don't you set seventh (not fifth) parameter to true? The Form Feed symbol will be inserted automatically.

Thank you.
User avatar
PJoyeux
Posts: 160
Joined: Tue Nov 26, 2013 9:40 am
Location: Germany

Re: Bothering LineFeed after FormFeed on Matrix-printer.

Post by PJoyeux »

Aleksey Andreyanov wrote:Why don't you set seventh (not fifth) parameter to true? The Form Feed symbol will be inserted automatically.
Well, because of this excerpt of the help-file:
Bild 5.png
Bild 5.png (97.31 KiB) Viewed 4389 times
I couldn't imagine that other overloads of this method, that have more parameters than this one, would change the order of the parameters... :o :shock: :x

Now I know I have to use the seventh... :roll:
Bild 7.png
Bild 7.png (91.08 KiB) Viewed 4389 times
Let's put it this way: changing the sequence of params in overloaded methods that extend the list of parameters is really unfortunate...

But thanks nonetheless for pointing that out.

Cheers,
Pascal
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Bothering LineFeed after FormFeed on Matrix-printer.

Post by HighAley »

Hello.

As you see, there are a lot of overloads of the PrintToDotMatrixPrinter method. Sometimes it's impossible to keep parameter position. For example:

Code: Select all

SomeMethod(bool A, bool B)
SomeMethod(bool A, bool C)
SomeMethod(bool A, bool B, bool C)
As you see parameter C could be on second and third position.

Thank you.
Post Reply