VB6, ActiveReports, and Ricoh printers: Rotating the Page? - printing

I have a BEAST of a program written in VB6. It uses ActiveReports to generate letters.
The reports are processed in a loop; with verbage-building loops and (a whole lotta) nested 'if' and 'case' statements. Fugly!
The reports are sent to the printer like such:
Function PrintIt(ltrobj as Object)
Set ltrobj = MyARdocument '(.Dsr file)
ltrobj.txtfield1 = strVerbage 'This string was populated somewhere else
ltrobj.Printer.DisplayProgressDialog = False
ltrobj.PrintReport False
End Function
Now here's the weird part: The pages physically come out of the printer rotated 90 degrees each iteration of the loop. What's even weirder -- this only happens for my VB6 application -- other Word documents, reports, batch jobs, whatever come out normal.
So the first page comes out like normal, the header first (pointing North). The second page comes out sideways (header pointing West). The third comes out of the printer like the first, the fourth comes out like the second, and on and on...
The printer: A Ricoh Aficio MP5000
I cannot find a setting on the printer, or a property in ActiveReports that controls this.
Any ideas, help, or a general direction would be greatly appreciated!
Thanks,
Jason

There is no "rotation" setting in ActiveReports. The closest things that might impact this would be the page size and orientation, but at worst I would expect them to flip back and forth not actually rotate the page. I would try to do a few things:
Trace the printer & page settings related to orientation and page size as report prints.
Try printing to another printer to see if it happens on all printers or just this one.
Preview the reports on screen and see if they're rotated in the preview or not (or export them to PDF with report.Export(...) ad see if they're rotated there).
To trace page settings you should do it in a couple places. One on the printer, and another on each page (or Canvas) in the report. There is also the ActiveReport.PrintWidth (the width of the report, not the pages) that may also be relevant. So just before printing each report try tracing out the following values:
report.PrintWidth
' the default settings for the report
report.PageSettings.TopMargin
report.PageSettings.RightMargin
report.PageSettings.BottomMargin
report.PageSettings.LeftMargin
' actual printer's current settings:
report.Printer.PaperSize
report.Printer.PaperHeight
report.Printer.PaperWidth
report.Printer.Orientation
' settings for a specific page:
for each page in report.Pages:
report.Pages(...).Width
report.Pages(...).Height
report.Pages(...).Orientation
BTW: ActiveReports COM Help is here.
If the preview/PDF test seems okay then I'd focus on the printer itself. Same for the print to another printer obviously. Otherwise, focus on ActiveReports settings.
Hope this helps
Scott Willeke
GrapeCity

Related

Printing a Crystal Report directly to printer

I am creating a label printing function in a program that needs to create labels for the given information. I have created a label in Crystal Reports 9 but I'm having trouble printing it.
I don't want to save the label, I just want it to print directly after the system has created it.
Dim ap9 As craxdrt.Application
Dim rpt9 As craxdrt.Report
Dim dbt As craxdrt.DatabaseTable
Set ap9 = New craxdrt.Application
On Error GoTo errError2
Set iniFile = New CIniFile
On Error GoTo errError3
Set rpt9 = ap9.OpenReport(iniFile.pathReports & REPORT_LABEL_IN)
On Error GoTo errError4
For Each dbt In rpt9.Database.Tables
dbt.Location = iniFile.pathDbCosmet
If dbt.ConnectionProperties.count <= 5 Then
dbt.ConnectionProperties.Add "Database Password", iniFile.passwordCosmet
End If
Next
rpt9.RecordSelectionFormula = sFormula
rpt9.PrintOut False, CInt(txtPacksReceived.Text)
The following code allows me to select a printer
and after clicking 'Print' at that point I am shown another dialog
However, the code executes fine, there are no errors, but the print queue doesn't show any documents and the report doesn't print.
Is there some reason why I'm not able to print my labels?
I've had problems with Zebra printers in the past that all turned out to be driver related. Have you uninstalled the printer driver and reinstalled it? Otherwise try unplugging and removing the device, plugging it into a different port and trying again?
Most likely your report doesn't contain any data - some logical error in selection/suppression formulas or similar.
If you print to any other printer, does something print out? Tracing SQL (assuming your report is bound to SQL server), can you see issued query? Does it look correct?

FastReport trouble print

I am having trouble printing reports with FastReport in Delphi 2010.
When printing to the printer the first time, it prints correctly, but the second time that I try to print the report does not print correctly.
Viewing on my computer is working correctly, the problem is when I will print on the printer that the problem happens.
frxReport1.LoadFromFile(FileRep);
if isPrint then begin
frxReport1.PrepareReport();
frxReport1.Print;
end else
frxReport1.ShowReport;
For exemple:
The wrong form (the first time):
The correct form (the second time):
Try to use latest FR 5.5.11. If problem still exists - create small demo project with error and send it to FR's support https://support.fast-report.com/tickets

Standard print button is inoperative in custom Report

My customer has reported a problem that standard ''print'' button in Z-report which a developer wrote before is not working.
How can I enable the button?
MODULE user_command_0100 INPUT.
DATA: GS_STATUS TYPE SLIS_STATUS,
XS_STATUS LIKE GS_STATUS.
CASE sy-ucomm.
WHEN 'BACK' OR '%EX' OR 'RW'.
LEAVE TO SCREEN 0.
WHEN '&RNT'.
ENDCASE.
ENDMODULE.
Then button needs a usercommand assigned, which is then processed in pai. usually with a general form called get_ucomm (many developers call it similar). You also can issue /h in transaction field and then press the print-button. /h will trigger the debugger and You can inspect the report step by step.
That's all I can say without seeing the code. Hope this will help.
Which user command do you define in your GUI status?
If you have a standard list (what I expect when you write about a z-report), then you should define the command PRI to print the list:
If you define a screen (using the screen painter) or an ALV-Grid... then this solution will not help you.
If you don't know, what a GUI status is: Scan your source code for the command
SET PF-STATUS 'XXXX'.
Then double click on 'XXXX' and you should be directed to the status definition. There may by multiple status (and status with generic names).
I've seen your code and for the &RNT option there's no code to execute, so if the user wants to print the button will do nothing.
MODULE user_command_0100 INPUT.
DATA: GS_STATUS TYPE SLIS_STATUS,
XS_STATUS LIKE GS_STATUS.
CASE sy-ucomm.
WHEN 'BACK' OR '%EX' OR 'RW'.
LEAVE TO SCREEN 0.
WHEN '&RNT'.
" There's no code
ENDCASE.
ENDMODULE.
I've used the 'STANDARD' GUI Status from the function group 'KKBL' and '&RNT' is the code of the print button and that's why I think that is the print button you are refering in your program.
Can you post the GUI Status you are using please?

Send raw printer codes after writing a FlowDocument, but before automatically cutting

The Good: I'm building a FlowDocument in my app and sending it to a Star Micronics TSP100 thermal receipt printer, and I can print bar codes as well by sending ESC codes to the printer directly.
The Bad: It's automatically cutting the paper after the FlowDocument, before the bar codes have had a chance to print.
The Question: Is there a better way to print the FlowDocument so it doesn't tell the printer it's done printing? Or to have the some part of that trigger an event handler so I can squeeze my bar code commands in before it tells the printer it's done?
Here's where I am now:
The flow document is called, creatively enough, "doc".
FlowDocument doc
Then of course, I add a whole bunch of stuff to the FlowDocument. Then I grab the printer and print the FlowDocument:
string printerName = "Star TSP100 Cutter (TSP143)";
LocalPrintServer local = new LocalPrintServer();
PrintQueue rcptpq = local.GetPrintQueue(printerName);
Xps.XpsDocumentWriter xpsdw = PrintQueue.CreateXpsDocumentWriter(rcptpq);
IDocumentPaginatorSource dps = doc;
If that all worked without errors (error handling not copied--this is what I'm stepping through), I write out the receipt:
// print MOST of the receipt
xpsdw.Write(dps.DocumentPaginator);
The printer cuts here automatically. I don't want it to. I want it to cut after the bar code.
// print the bar code
RawPrinterHelper.SendStringToPrinter(printerName,"\x1b\x62\x2\x2\x30" + "MyUPC123\n");
// Cut the paper
RawPrinterHelper.SendStringToPrinter(printerName,"\x1b\x64\x02");
(RawPrinterHelper is from the Star Micronics SDK sample, and what it does is pretty self explanatory, at least with my comments to describe the specific codes being used.)
I've tried some settings in TSP100's Configuration tool regarding "Page end detection", but so far all I've succeeded in doing is turning off all cutting, or turning off the explicit "cut the paper" command at the end. I can't just turn off the first cut.
You should wait until the printer is done processing the FlowDocument print job before sending the raw escape codes. This could possibly be done by polling the PrintQueue.IsPrinting or by checking PrintQueue.QueueStatus.

Zebra TLP 2844 printer refusing to print too many lines

I'm trying to print some vouchers with variable length on continuous paper. The problem is that the printer refuses to print anything beyond around 2300 points (approximately 26 cm or 10.4 inches) and just pretends it's not there. Very light code triggers the problem, so it's not a buffer issue. The printer also manages to read the "print" command and all the lines are formatted exactly the same, so it's not a formatting issue either. Here's a not quite minimal, but almost, example of code that illustrates my point:
N //clear buffer
Q10,0 //set paper to continuous mode with 10 points between documents
R0,0 //set reference point
ZT //print from top to bottom
A100,50,0,1,1,2,N,"ASDFQWERTY 50"
A100,100,0,1,1,2,N,"ASDFQWERTY 100"
A100,150,0,1,1,2,N,"ASDFQWERTY 150"
A100,200,0,1,1,2,N,"ASDFQWERTY 200"
A100,250,0,1,1,2,N,"ASDFQWERTY 250"
A100,300,0,1,1,2,N,"ASDFQWERTY 300"
A100,350,0,1,1,2,N,"ASDFQWERTY 350"
A100,400,0,1,1,2,N,"ASDFQWERTY 400"
A100,450,0,1,1,2,N,"ASDFQWERTY 450"
A100,500,0,1,1,2,N,"ASDFQWERTY 500"
A100,550,0,1,1,2,N,"ASDFQWERTY 550"
A100,600,0,1,1,2,N,"ASDFQWERTY 600"
A100,650,0,1,1,2,N,"ASDFQWERTY 650"
A100,700,0,1,1,2,N,"ASDFQWERTY 700"
A100,750,0,1,1,2,N,"ASDFQWERTY 750"
A100,800,0,1,1,2,N,"ASDFQWERTY 800"
A100,850,0,1,1,2,N,"ASDFQWERTY 850"
A100,900,0,1,1,2,N,"ASDFQWERTY 900"
A100,950,0,1,1,2,N,"ASDFQWERTY 950"
A100,1000,0,1,1,2,N,"ASDFQWERTY 1000"
A100,1050,0,1,1,2,N,"ASDFQWERTY 1050"
A100,1100,0,1,1,2,N,"ASDFQWERTY 1100"
A100,1150,0,1,1,2,N,"ASDFQWERTY 1150"
A100,1200,0,1,1,2,N,"ASDFQWERTY 1200"
A100,1250,0,1,1,2,N,"ASDFQWERTY 1250"
A100,1300,0,1,1,2,N,"ASDFQWERTY 1300"
A100,1350,0,1,1,2,N,"ASDFQWERTY 1350"
A100,1400,0,1,1,2,N,"ASDFQWERTY 1400"
A100,1450,0,1,1,2,N,"ASDFQWERTY 1450"
A100,1500,0,1,1,2,N,"ASDFQWERTY 1500"
A100,1550,0,1,1,2,N,"ASDFQWERTY 1550"
A100,1600,0,1,1,2,N,"ASDFQWERTY 1600"
A100,1650,0,1,1,2,N,"ASDFQWERTY 1650"
A100,1700,0,1,1,2,N,"ASDFQWERTY 1700"
A100,1750,0,1,1,2,N,"ASDFQWERTY 1750"
A100,1800,0,1,1,2,N,"ASDFQWERTY 1800"
A100,1850,0,1,1,2,N,"ASDFQWERTY 1850"
A100,1900,0,1,1,2,N,"ASDFQWERTY 1900"
A100,1950,0,1,1,2,N,"ASDFQWERTY 1950"
A100,2000,0,1,1,2,N,"ASDFQWERTY 2000"
A100,2050,0,1,1,2,N,"ASDFQWERTY 2050"
A100,2100,0,1,1,2,N,"ASDFQWERTY 2100"
A100,2150,0,1,1,2,N,"ASDFQWERTY 2150"
A100,2200,0,1,1,2,N,"ASDFQWERTY 2200"
A100,2250,0,1,1,2,N,"ASDFQWERTY 2250"
A100,2300,0,1,1,2,N,"ASDFQWERTY 2300"
A100,2350,0,1,1,2,N,"ASDFQWERTY 2350"
A100,2400,0,1,1,2,N,"ASDFQWERTY 2400"
A100,2450,0,1,1,2,N,"ASDFQWERTY 2450"
A100,2500,0,1,1,2,N,"ASDFQWERTY 2500"
A100,2550,0,1,1,2,N,"ASDFQWERTY 2550"
A100,2600,0,1,1,2,N,"ASDFQWERTY 2600"
A100,2650,0,1,1,2,N,"ASDFQWERTY 2650"
A100,2700,0,1,1,2,N,"ASDFQWERTY 2700"
A100,2750,0,1,1,2,N,"ASDFQWERTY 2750"
A100,2800,0,1,1,2,N,"ASDFQWERTY 2800"
A100,2850,0,1,1,2,N,"ASDFQWERTY 2850"
A100,2900,0,1,1,2,N,"ASDFQWERTY 2900"
A100,2950,0,1,1,2,N,"ASDFQWERTY 2950"
A100,3000,0,1,1,2,N,"ASDFQWERTY 3000"
P1
There's a blank line before the first "N", as specified in the EPL2 manual (http://www.zebra.com/content/dam/zebra/manuals/en-us/printer/epl2-pm-en.pdf). I also don't include comments when sending the commands to the printer. However, this only prints until the line that says "ASDFQWERTY 2300" and ignores everything beyond that. Any help is greately appreciated.
Answering myself from a support email I got from the company. This printer model is limited to 11 inches, so in the end I had to split the document onto several requests.

Resources