cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with labels in landscape mode

Former Member
0 Kudos

I'm importing a Crystal Reports Visual Studio 2005 that is working fine, but in Crystal Reports Visual Studio 2010 do not.

The report have a custom size h=10cm v=8cm in the paper, and in the report h=8cm v=10cm, and I want the report print in landscape mode to rotate 90ª and fit to the paper.

The problem is that I can't do it, I have tried all the posibilites I think is possible, changing paper sizes by default in the printer, and changing landscape and portrait mode in the report, but always print bad.

I think the printer is not the problem because I use 2 different printers (TEC B-SA4G and Godex EZ-1100 Plus) and both have the same problem with the new report and both work fine with the old one.

Any ideas?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

In case anyone like myself is still having this issue, the problem is reportedly fixed in SP5.

However you must obtain a keycode to install the service pack, which has been giving lots of people including us quite a bit of difficulty.

former_member183750
Active Contributor
0 Kudos

Hello Rob

Just wanted to jump in here and clear things up before the statement re. Keycode creates all kinds of foot stomping...

There is NO keycode required for SAP Crystal Reports, developer version for Microsoft Visual Studio(CR4VS), which this post and this particular forum is all about. As far as a keycode for Business One SP 5 is concerned, you'll have to post to the B1 forum, or talk to support engineers that support B1. As far as unistall / reinstall, for CR4VS, this is also incorrect. A simple install of SP 5 is all that is needed. E.g.; CR2VS is to B1 as potato is to a banana.

- Ludek

SCN Moderator

Follow us on Twitter

Got Enhancement ideas? Try the SAP Idea Place

Share Your Knowledge in SCN Topic Spaces

0 Kudos

And to further clarify for Rob and others the fix is in Crystal Reports Developer for Visual Studio SP 5. CR for Business One may be Crystal Reports 2008 although I heard CR 2011 is now available for B1 customers through Service Market Place. So yes CR 2008 runtime does require a keycode to distribute your application with. But we won't go into this in this thread. Search first, lots of post on distribution packaging for CR 2008.

You can find the installer and redist packages here for CR for Visual Studio:

http://scn.sap.com/docs/DOC-27917

Don

Answers (1)

Answers (1)

0 Kudos

Hello Diego,

Funny you should post this... I've been doing a lot of testing with Label printers recently, Zebra and Argox and using the Zebra drivers and Argox ( made by Seagull Scientific ) and I have them working mostly.

Are you printing them in code or from the print button in the viewer?

If so are you using CR For VS 2010 Service Pack 2? Version of the dll's should be 13.2.x.x.

Who's printer driver are you using? Click on About box in the driver config.

A few things that MUST be configured properly:

1. In the Page Options make sure the Dissociate... is checked OFF and No Printer is check off also. You should see the Paper size you want to use and if orienting the page do you see what you want on screen?

2. Make sure your printer driver is also configured properly, default paper size is set and orientation is set normal.

I tried using the Nice Label Drivers and there are side by side issues with Zebra and Seagull Drivers, still working on that driver.

Don

Former Member
0 Kudos

Thanks for your response.

I check all you said:

I'm printing using code: Reporte.PrintToPrinter(1, False, 0, 0)

I'm using version 13.0.2000.0 of the dll's

I have upgraded my toshiba drivers and have tried Nice Label Drivers.

I have verified in page options your configurations.

I have checed default paper size and orientation.

Even I tried all the possible combination of configurations, but I have the same problem.

If I print with the same configuration with CR VBNET 2005, is working ok, but same configuration is working bad in CR VBNET 2010.

Any other idea?

0 Kudos

Try the Seagull Driver: http://members.driverguide.com/driver/detail.php?driverid=947815

And/or print to printer using this code:

private void frmMain_Load(object sender, System.EventArgs e)
{
if (System.Drawing.Printing.PrinterSettings.InstalledPrinters.Count > 0)
{
  foreach(String myPrinter in System.Drawing.Printing.PrinterSettings.InstalledPrinters )
  {
   cboCurrentPrinters.Items.Add(myPrinter);
  }
  cboCurrentPrinters.SelectedIndex = 0;
}
else
{
  rdoCurrent.Enabled = false;
  EnableDisableCurrentControls(false);
}
//For printers exposed to System account as per MS Kbase
//http://support.microsoft.com/default.aspx?scid=kb;en-us;184291

//Look to HKEY_USERS\.Default\Software\Microsoft\Windows NT\CurrentVersion\Devices
Microsoft.Win32.RegistryKey mySystemPrinters =
  Microsoft.Win32.Registry.Users.OpenSubKey(@".DEFAULT\Software\Microsoft\Windows NT\CurrentVersion\Devices");
foreach (String defaultPrinters in mySystemPrinters.GetValueNames())
{
  cboDefaultPrinters.Items.Add(defaultPrinters);
}
if (cboDefaultPrinters.Items.Count > 0)
{
  cboDefaultPrinters.SelectedIndex = 0;
}
else
{
  rdoDefault.Enabled = false;
}
}

private void cboCurrentPrinters_SelectedIndexChanged(object sender, System.EventArgs e)
{
cboCurrentPaperSizes.Items.Clear();
cboCurrentPaperTrays.Items.Clear();
System.Drawing.Printing.PrintDocument pDoc = new System.Drawing.Printing.PrintDocument();
  
    pDoc.PrinterSettings.PrinterName = this.cboCurrentPrinters.Text;
foreach(System.Drawing.Printing.PaperSize myPaperSize in pDoc.PrinterSettings.PaperSizes)
{
        cboCurrentPaperSizes.Items.Add(myPaperSize.PaperName);
}
if (cboCurrentPaperSizes.Items.Count > 0)
{
  cboCurrentPaperSizes.SelectedIndex = 0;
}
foreach(System.Drawing.Printing.PaperSource  myPaperSource in pDoc.PrinterSettings.PaperSources)
{
  cboCurrentPaperTrays.Items.Add(myPaperSource.SourceName);
}
    if (cboCurrentPaperTrays.Items.Count > 0)
    {
        cboCurrentPaperTrays.SelectedIndex = 0;
    }

}


System.Drawing.Printing.PrintDocument pDoc = new System.Drawing.Printing.PrintDocument();     

CrystalDecisions.Shared.PrintLayoutSettings PrintLayout = new CrystalDecisions.Shared.PrintLayoutSettings();     

System.Drawing.Printing.PrinterSettings printerSettings = new System.Drawing.Printing.PrinterSettings();     

     

printerSettings.PrinterName = cboCurrentPrinters.SelectedItem.ToString();     

     

PrintLayout.Scaling = PrintLayoutSettings.PrintScaling.DoNotScale;     

     

System.Drawing.Printing.PageSettings pSettings = new System.Drawing.Printing.PageSettings(printerSettings);     

     

rpt.PrintOptions.DissociatePageSizeAndPrinterPaperSize = false;     

     

System.Drawing.Printing.PageSettings pageSettings = new System.Drawing.Printing.PageSettings(printerSettings);     

     

// XPS printer only allows 1 copy     

//pDoc.PrinterSettings.Copies = 2;     

     

rpt.PrintToPrinter(printerSettings, pSettings, false, PrintLayout);     

     

MessageBox.Show(rpt.PrintOptions.PrinterName.ToString());

Dialog box handles the indexed printer listing:

Thanks

Don

Former Member
0 Kudos

Hi, Don.

First thing thanks for your efforts.

I have tried you seagull driver but is the same that toshiba driver I had, and my driver is new (7.2.2 vs 7.1.1)

I have tried your code but works bad also (I translated it to Visual Basic).

I want say to you that I'm using Visual Basic, it can be possible works fine in C and works bad in Basic? I say this because you have tried a lot of printers and works fine, but for your code I think you are using C.

I'm very confusing how to resolve this problem, because in Crystal Reports 2005 works fine, and in Crystal Reports 2011 works bad for both printers I have.

If you want I'll send you my report.

Thanks.

ido_millet
Active Contributor
0 Kudos

One of my customers ran into the same exact issue with label printing. Works fine with RDC, but in Crystal for VS10 the label gets rotated and rescaled to fit across the narrow dimension of the label (as if landscape is forced into portrait if page length is greater than page width).

Don, minor comment about your code above:
sSystem.Drawing.Printing.PageSettings pageSettings = new System.Drawing.Printing.PageSettings(printerSettings);
is not used for anything (because you use another pSettings declaration).  

Once I get a sample report from my customer, I'll test and share results.

Former Member
0 Kudos

One question, what is RDC?

ido_millet
Active Contributor
0 Kudos

RDC was the ActiveX object model used before Crystal 2008 transitioned to .NET.

0 Kudos

Hi Ido,

It's all part of my main test app and sometimes I miss removing all declarations, it's used elseware or it may just be there and not used, trying all combinations...

One thing to MAKE SURE you HAVE DISSOCIATE... checked off in the report. And validate you are setting print options on the same report object as you sending to the printer.

A good check is set the:

rpt.PrintOptions.DissociatePageSizeAndPrinterPaperSize = false;

to true, it should pop up an exception, if it doesn't somethign else is wrong.

Don

Former Member
0 Kudos

I have tried rpt.PrintOptions.DissociatePageSizeAndPrinterPaperSize = true, and have a exception.

The message is (I'm translating from my Spanish version):

The size of format page is not equal to size of the physical page. PrintScaling must be ShrinkOnly or Scale to ajust the report to the physical page. Name of the parameter: layoutSettings.

0 Kudos

Hi Diego,

OK so this is weird... I had duplicated your issue and then to see if changing the orientation defined in the printer Custom User paper would counter the orientation in CR Designer to see if that would work and it did... In the Preferences in the Seagull UI I changed the orientation to Landscape. Applied and then opened up the Designer again and a report and set the paper size to the custom one and CR then stopped rotating the page.

So I undid all of the paper setting to show someone and now when I go back into CR, after setting the Printing Preferences back to Portrait CR now gets the correct orientation.... very strange...

See if this works for you?

Open the Printer Preferences for the Seagull Driver and change the Orientation to Landscape, apply the change. Then start up CR Designer and open your label report and Set Page and see if you now see the correct sizes in the correct places?

If you do then close the designer, don't save the report, and then go back into the Preferences and change it back to Portrait. Then do the above again and see what happens?

Thanks

Don

Message was edited by: Don Williams

Former Member
0 Kudos

I don't understand you very well, but I've tried it, and seem like CR Designer donot understand the driver Portrait/Landscape, because in both configuration I have the same page size.

I attach you 2 jpg files with my screen snapshots.

ido_millet
Active Contributor
0 Kudos

Don, some of the confusion is probably due to not being explicit about what preferences you are referring to: Crystal Report layout preferences or the Printer settings.

In any case, given that you were able to replicate the problem, perhaps we are half way to a solution

0 Kudos

Hi Diego,

Sorry guys for not being clear...

Here's my steps, need a few more screen shots.

Setting up the page

In CR Designer I do see the correct orientation:

I DO NOT see the problem in CR Designer

I'll try installing the TEC B-SA4G Driver by Seagull and see what happens.

Don

0 Kudos

Thanks for the screen shots, I noticed you have the orientation set to Landscape in the Designer. Is this correct? What happens if you use Portrait?

Don

Former Member
0 Kudos

I've tried all combination of orientations in CR Designer and printer driver. And I want to remember you that my report is an importation of another that is working fine in CR2005, so I think the report is OK.

I've tried also to create a new report to try if the problem is due to is a imported one, but also works bad with a new one.

My label physical label is w100xh83 (mm), so in my original configuration I try to define in this mode in the printer driver, and set to landscape. Then I open the CR Designer, and put portrait because I want in the screen w83xh100 (is working fine), and do the label. But when I try to print it, the label is not rotate 90º to adjust it to the label. And in all my test, I never have a rotate text in the label.

But if I try the report doing the same in a HP A4 printer (I select A4 normal, and put portrait in CR, the text is rotated 90º in my physical sheet).

I hope you understand me, I think one of muy problems to understand your before message is that my english is not very good.

So I hope that Ido and you can help me with the problem.

I think that the problem is in the CR component, because in CR2005 is working fine, what do you think?

ido_millet
Active Contributor
0 Kudos

Can you make your rpt file with saved data available so we can experiment with it? In Crystal, the option to save the rpt with data is under the File menu.

Former Member
0 Kudos

I try it.

But How can I send you the rpt file? Here can't attach rpt files (or I don't know how to do)

0 Kudos

Hi Diego,

Use the Advanced Editor then you'll have the option to attach a file. We've discovered the the system automatically zips the files so don't zip it first. It can handle up to a 1 meg file.

Oh and we discovered the only way for now to attach a file is it must have a txt extension, so rename your rpt file to *.txt and then the system will zip it up. You jsut download it, unzip it and then rename it to .rpt.

Don

Message was edited by: Don Williams

Former Member
0 Kudos

Here you have the rpt file renamed to txt file.

Now I'm downloading CR Service Pack 3 to check if works fine or not.

I'll send you if works as soon as possible.

0 Kudos

Hi Diego,

Thank you for the report... Now that I have it I can do more testing...

I'm using the Seagull Drviers and an Argox 4" wide by 3" high label.

I used you report and it printed just fine, sort of because your paper size is slightly larger than my label size, but as you can see it worked just fine from the designer.

Rename my attached file to picture.zip from picture.txt

Using this setting it prints fine from CR Designer, however... it doesn't print through my test app properly at all...

It appears CR or the FRamework is scalling and rotating the page.

I'll have to do more testing.

Don

0 Kudos

I figured it out.... I think...

The reason this is happening is this... CR has logic ( and that's debatable ) when the paper width is narrower than the page length then you have a Portrait page. Because you set the paper size in the Printer Configuration to Landscape so it Previews and prints properly in the designer you therefore have to Set Dissociate.. in code to True. Which is the opposite when not setting the Orientation in the Printer Configuration settings. If you had not changed the Printer default settings then dissociate must be false. But of course what you see in the report does not match your label.

One other change you may need to do in the Report Design. Go to File, Report Options and change the "Preview Page Starts With"  to "Fits Page". Unfortunately there is no API to change this at runtime. I

ll be adding this as an enhancement request and TRY to get it into SP4.

Use this code, and I have not tested it but I assume this is the same for PrintToPrinter:

private void btnPOController_Click_1(object sender, System.EventArgs e) // Print To P button

{

    System.Drawing.Printing.PrintDocument pDoc = new System.Drawing.Printing.PrintDocument();           

    CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions rasPROpts = new CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions();

    CrystalDecisions.Shared.PrintLayoutSettings PrintLayout = new CrystalDecisions.Shared.PrintLayoutSettings();

    CrystalDecisions.ReportAppServer.ReportDefModel.PrintOptions RASPO = new CrystalDecisions.ReportAppServer.ReportDefModel.PrintOptions();

    RASPO.PrinterDuplex = CrPrinterDuplexEnum.crPrinterDuplexSimplex;

    PrintLayout.Scaling = PrintLayoutSettings.PrintScaling.DoNotScale;

    if (pDoc.PrinterSettings.SupportsColor)

    {

        MessageBox.Show("Printer Supports Color", pDoc.PrinterSettings.SupportsColor.ToString());

    }

    if (rdoCurrent.Checked)

    {

        //CrystalDecisions.ReportAppServer.ReportDefModel.ISCRPrintOptions.DissociatePageSizeAndPrinterPaperSize

        RASPO.DissociatePageSizeAndPrinterPaperSize = true;

        rasPROpts.PrinterName = cboCurrentPrinters.Text;

        rasPROpts.PaperSize = (CrPaperSizeEnum)cboCurrentPaperSizes.SelectedIndex;

        rasPROpts.PaperSource = (CrPaperSourceEnum)cboCurrentPaperTrays.SelectedIndex;

        rasPROpts.NumberOfCopies = 1;

                               

        //rasPROpts.PrinterDuplex = (CrPrinterDuplexEnum)pDoc.PrinterSettings.Duplex;

        //rptClientDoc.PrintOutputController.ModifyPrintOptions((CrPrinterDuplexEnum).crPrinterDuplexSimplex);

        rasPROpts.PrinterDuplex = CrPrinterDuplexEnum.crPrinterDuplexSimplex;

        System.Drawing.Printing.Duplex myDup = new Duplex();

        myDup = Duplex.Simplex;

        rasPROpts.PrinterDuplex = (CrPrinterDuplexEnum)myDup;

       

        // THIS IS TO COUNTER THE REPORT ORIENTATION LOGIC

        if (pDoc.DefaultPageSettings.PaperSize.Height > pDoc.DefaultPageSettings.PaperSize.Width)

        {

            rptClientDoc.PrintOutputController.ModifyPaperOrientation(CrPaperOrientationEnum.crPaperOrientationPortrait);

        }

        else

            rptClientDoc.PrintOutputController.ModifyPaperOrientation(CrPaperOrientationEnum.crPaperOrientationLandscape);

        string MyRptName = rpt.FileName.ToString();

        MyRptName = MyRptName.Substring(MyRptName.LastIndexOf(@"\") + 1, (rpt.FileName.Length - 3) - (MyRptName.LastIndexOf(@"\") + 2));

        rasPROpts.JobTitle = MyRptName;

    }

    else

    {

        rasPROpts.PrinterName = cboDefaultPrinters.Text;

        rasPROpts.PaperSize = (CrPaperSizeEnum)cboDefaultPaperSizes.SelectedIndex;

        rasPROpts.PaperSource = (CrPaperSourceEnum)cboDefaultPaperTrays.SelectedIndex;

        rasPROpts.NumberOfCopies = 1;

        //rasPROpts.PrinterDuplex = (CrPrinterDuplexEnum)pDoc.PrinterSettings.Duplex;

        string MyRptName = rpt.FileName.ToString();

        MyRptName = MyRptName.Substring(MyRptName.LastIndexOf(@"\") + 1, (rpt.FileName.Length - 3) - (MyRptName.LastIndexOf(@"\") + 2));

        rasPROpts.JobTitle = MyRptName;

    }

    try

    {

        rptClientDoc.PrintOutputController.PrintReport(rasPROpts);

    }

    catch (Exception ex)

    {

        MessageBox.Show ("ERROR: " + ex.Message);

        return;

    }

    MessageBox.Show("Printing report.", "RAS", MessageBoxButtons.OK,MessageBoxIcon.Information );

}

Please test and let me know?

Former Member
0 Kudos

Hi!

When I've read:

The reason this is happening is this... CR has logic ( and that's debatable ) when the paper width is narrower than the page length then you have a Portrait page.

I've tried to create a new paper size w100xh110 with portrait in printer, and I've choosed it in CR and not dissociate and Landscape, and works!!!!! The report is rotated 90º in the printer, but the problem is that is not my label size, and only works fine for my first label, the second is not in the correct position.

Then the problem is the CR logic (I suppose CR for Visual Studio 2005 don't do it). Is not possible dessactivate it?

I don't test your code yet. Can you think that this code can resolve the problem?

Also I've update to 10.0.3 but works equal 10.0.2 for me.

Former Member
0 Kudos

Hi!

I've tried your last code, but I have problems because there are a lot of variables that are not defined in the code.

On the other hand, I've tried to print multiples labels when there are a size label with height bigger than with, and rotate well, but I have the problem that one label is well printed and next is empty and next is well printed,..

On resume, I think the problem is CR has logic ( and that's debatable ) when the paper width is narrower than the page length then you have a Portrait page. I think is neccesary that can be possible change it manually.

Is possible you change this for next SP4 (for work as CR2008), or can you have a manual solution for this problem?

0 Kudos

This issue has now been fixed in SP 5.

Former Member
0 Kudos

It should be noted that you cannot just install service pack 5. It is a full reinstall which requires a keycode which many people including myself appear to have a hard time obtaining from a partner or SAP themselves. We have Buisness One which came with a site license for SP4. We cannot obtain a keycode for SP5 which seems silly.

Former Member
0 Kudos

Hi!

Labels are working fine with Crystal Reports Visual Studio 2010 SP5 (13.0.5)

Thanks a lot!

You can download here : http://scn.sap.com/docs/DOC-7824

Choose install executable Support Pack 5 for the computer where visual studio is installed.

Choose msi 32 bits or msi 64 bits for client computers.