11

I'm running into an extremely strange issue that a user of mine is reporting: A Crystal Reports report is printing blank pages past a certain point. My troubleshooting has sort of narrowed down the culprit, but at the same time, has displayed some inconsistent results.

Here's the lowdown:

  • The application is a VB.NET application, using .NET 4.
  • There are multiple Crystal Report reports embedded in the solution, and a single form is used to display and print any report.
  • Which report to display is handled through the code backend, and assigned to the form's CrystalReportViewer object before showing the form.
  • For the problem report, the datasource comes from a SQL query run in the code, and then assigned as the report's datasource, and then the report is assigned as the reportsource for the CRV object in the form.
  • The label printer is attached via USB to the computer in question, with the installer used to provide the drivers.
  • If it matters, it's a Citizen CLP-7201e label printer.

The code that assigns the datasource to the report is as follow:

    myCommand = New SqlClient.SqlCommand(strSQL, conPlanning)
    myCommand.ExecuteNonQuery()

    Da = New SqlClient.SqlDataAdapter(myCommand)

    Da.Fill(dsData, "TempPrintLabels")

    rptPrintLabels.SetDataSource(dsData.Tables(0))
    rptPrintLabels.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Portrait

    frmReports.rptViewer.ReportSource = rptPrintLabels

    frmReports.Show()

strSQL is a basic SQL statement, based on which report is selected from this particular form. The report's SQL query is, SELECT * FROM TempPrintLabels.


There's the basic info. The report generates fine, and for reports with ~100 labels, it prints fine. The strangeness happens when the report exceeds that limit; it's somewhere in the 95-120 label range. It doesn't seem to be consistent. The report will print, up until it hits that certain point. At that time, it will print nothing but blanks for the rest of the report. There will be as many blanks as there are supposed to be remaining pages. If you start the job again at the point where the blanks started, though, it prints fine.

When I look at this report in the CrystalReportViewer, it looks fine; all the labels render properly. When I print it to a PDF or text file printer, all the pages are there. So the report and print generation seems to be working to me.

I thought it was the printer. To test that, I printed a 185 page job to PDF, and then printed that to the printer. That printed absolutely fine.

I'm at a loss to explain this, or even diagnose this further. There is no code in the form for printing; it uses the CrystalReportViewer object to handle everything. If it was this CRV object, the printing to PDF should've given me blank pages. It didn't. If it was the printer, it should have started printing blanks from the PDF right around the same point as printing directly from the CRV object did. It didn't.

What else can I look for?

fbueckert
  • 393
  • 1
  • 5
  • 21
  • 2
    Hi, @Ajay2707. While your edit is appreciated, you're modifying specific sections that shouldn't be. For instance, CrystalReportViewer are objects that are referenced as such in Visual Studio; there should be no space between the words. Beyond that, the contractions are my own style, and have no bearing on improvement. – fbueckert Jul 09 '15 at 12:59
  • Is it the case that one particular report is demonstrating this blanking behavior, or does this happen across all Crystal Reports that are in excess of 90-120 labels? – ChicagoMike Jul 14 '15 at 15:44
  • @ChicagoMike There is only the one report that prints that many labels, so unfortunately, there is no other report I can test to see if it's an isolated incident. – fbueckert Jul 14 '15 at 16:02
  • Could you create a report that does that? It sounds silly, I know, but if your newly created report is able to print 120 labels, that's a huge insight. – ChicagoMike Jul 14 '15 at 16:36
  • @ChicagoMike I might be able to, but I'm unsure of what value that would offer; care to share your hypothesis? – fbueckert Jul 14 '15 at 16:46
  • Because if you're able to do it with a new report, this means there is something in the structure of the existing report that the printer isn't capable of handling. It may be a long shot, but something I would check. If the new report doesn't work either, this tells me that there is something common to how Crystal Reports talks to that particular printer that is causing problems. Since Crystal Reports talks accurately with the PDF driver, this would tell me that either the printer and/or its driver is faulty and I would either go to the manufacturer's website or contact the manufacturer. – ChicagoMike Jul 14 '15 at 17:20
  • @ChicagoMike One of the things I believe I've forgotten to mention: After the printer starts printing blank pages, you can go back into the report, and start a new print job at where the blanks started, and it'll print just fine. Since these are labels, it's tough to believe that the report structure would break halfway through another iteration of the details, when it's gone through twenty successful ones. That said, I'll see what I can do about arranging a test of a different report to that extent. – fbueckert Jul 14 '15 at 17:38
  • can you show your report as a image here and also how you try to print portrait or lanscape? Also assign of datasource is what? xml datasource or direct ds assign to report. good if you share that portion of code too. – Ajay2707 Jul 15 '15 at 07:50
  • @Ajay2707 I've added in the code and where the data comes from. I'm not sure how a report image would help; there's no logic in the report. It's just grabbing the fields and dumping them into the report. – fbueckert Jul 15 '15 at 13:31
  • where is your updated question, please update your answer with bold header text "updated answer" as other done. and good to attach image and what is your datasource in report. May be this will help to understand more, give quickly, i am late to go home – Ajay2707 Jul 15 '15 at 14:42
  • @Ajay2707 No, thanks, I won't be modifying my question to include irrelevant text such as, Edit, Update, or anything like that. I've added in the additional details about the datasource right after the basic details; it's the code section. I'm not seeing the need to attach an image of something there's no need to attach; not without a good reason to do so. It distracts from the relevant information. – fbueckert Jul 15 '15 at 14:52
  • This SOUNDS like the CRV object might be overloading the printer's built in cache? If the PDF that you generated eats up less space than the CRV file would, that would explain why the PDF works but the CRV object does not. – user2366842 Jul 16 '15 at 14:01
  • @user2366842 That sounds quite plausible. Isn't the print spooler service supposed to handle that, though? It should keep the printer's cache from overloading, and just feed it data as it's able. Is there any way to test this? – fbueckert Jul 16 '15 at 15:06
  • the print spooler service is SUPPOSED to handle it, yes. If that's actually happening as it should be or not is an entirely different story, unfortunately. I haven't worked heavily with label printers in quite a while, but you might want to do some more digging, or even try and contact their customer service and see if they have any thoughts on why the print spooler isn't working as it's supposed to be (might simply be a configuration change within the OS of the computer that the printer is attached to). – user2366842 Jul 16 '15 at 15:13
  • The best way to actually test the theory and verify it IS in fact the cache though, would be to try and create a rather large pdf and print it off to the label printer. The best way I can think to do this would be to dump a bunch of images into a document and copy/paste it until you have something that's sufficiently large then try and print it off to the label printer...if the document is composed of a bunch of images, it'll eat through the printer's cache much faster than plain text, so you might be able to get away with fewer labels before you see the issue. – user2366842 Jul 16 '15 at 15:18
  • @ChicagoMike I managed to test a different report, and it exhibited the same symptoms at about the same place, too. It's looking more and more like it has something to do with the CRV object's interaction with the printer. – fbueckert Jul 17 '15 at 14:25
  • @user2366842 I kept the printer's "See what's printing" open during this latest test. From what I can see, the Print Spooler is feeding pages to the printer like it's supposed to; it gives it a few pages right off the bat, then feeds it another page as it prints one off. Seems right to me, so about the only thing I can think of is the CRV object's interaction with this specific printer. – fbueckert Jul 17 '15 at 14:33
  • In that case then, I'm fresh out of ideas. Sorry. – user2366842 Jul 17 '15 at 15:19
  • @fbueckert I agree with your assessment. I would see whether the manufacturer has provided any recent firmware upgrades or driver upgrades. If so, install them and try again. If not, contact them and explain the problem and maybe they have a workaround. – ChicagoMike Jul 17 '15 at 16:00
  • Has there been any update/progress with this problem? – Karlta05 Jul 29 '15 at 13:36
  • @Karlta05 As far as diagnosis, no, not really. The workaround seems to be holding, and I haven't had time to dig in deeper. – fbueckert Jul 29 '15 at 23:26

1 Answers1

1

For this question, I have some thoughts which causes this behavior while printing.

  1. It may the width issue of your all label's length exceeds from the page size. So you can check all the labels and pages are not blank when you shrink the width of labels (even labels not show properly, we can handle separately). If it shows not (as currently you getting), then you just handle labels width by "Can grow" option to true for all labels.

  2. If everything fine, then I think you can check your printer's page setting / margin.

  3. If above is not work, then either create new report or existing report with just adding static labels and values and then first preview and then call from code. Something you find with this.

As per my experience(I may be wrong in this case), whenever blank page comes in crystal report when your columns will increase, the report's width create an issue. So either set report width to decrease or set printer page bigger. So it print, other wise it not throw error, but give blank pages.

Ajay2707
  • 5,345
  • 6
  • 34
  • 52
  • 2
    This very much is NOT a page size or margin issue; if it were, labels would be misprinting every job. It would not be displaying these symptoms. – fbueckert Jul 15 '15 at 16:47
  • Is there a page number on this label report? That would make a 3 digit overflow constantly display this behavior at page 100 though. – Jim Lutz Jul 20 '16 at 12:42
  • Configure the print queue to keep the job then examine the spool file and you'll be able to tell if it's not rendering properly or if the printer/driver is dying. – Terry Carmen Jul 22 '16 at 00:22