cancel
Showing results for 
Search instead for 
Did you mean: 

Print Custom Size Report using PrintToPrinter function

Former Member
0 Kudos

Hi all,

I am using Crystal report 13.0.2000.0 runtime v2.0.50727 with Win7 .NET Winforms application.

I need to print custom size labels on Zebra printer by using PrintToPrinter command. I set the following parameters in my code:

MyReportDocument.PrintOptions.DissociatePageSizeAndPrinterPaperSize = True

MyReportDocument.PrintOptions.PaperOrientation = PaperOrientation.Portrait

MyReportDocument.PrintOptions.PrinterDuplex = PrinterDuplex.Simplex


printPrompt.PrinterSettings.DefaultPageSettings.PaperSize.Height = 400

printPrompt.PrinterSettings.DefaultPageSettings.PaperSize.Width = 400

oLayout.Scaling = PrintLayoutSettings.PrintScaling.DoNotScale

MyReportDocument.PrintToPrinter(printPrompt.PrinterSettings, printPrompt.PrinterSettings.DefaultPageSettings, False, oLayout)

The problem is that the report keeps using the driver settings for the paper (6x2), and I would like to use my custom 4x4 size.

I know that I need to disassociate printer. But when I do so, the system refuses to use DoNotScale setting, and scales to fit the size difined in the driver. The driver itself allows to override the settings:

Is there a way to override driver settings and print custom size?

Thank you.

Helen.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Helen,

13.0.2000 is the assembly version, it never changes. Need to know what actual Service Pack you are using? Check the Programs and Feature for the version:

If you are not using SP 14 then download it from here:

First link is to integrate into VS, do not install the redist packages on your DEV PC.

And then search for this KBA - 2163438, I attached a sample app that shows and explains how printing works and when using custom Paper Sizes.

P2P will not likely work for you, it's CR Basic so you will need to use PrintOutputController, which is now selectable as the default Print Button option.

P2P uses the paper Size ENUM which is not likely the same on each PC, unless you use the Seagull Scientific driver which allows you to manually set the custom paper size ENUM.

SP 14 now will search for the Custom Paper by name, so be sure to create it on each users PC exactly the same as the original source. So P2P may work for you...

You'll have to test...

Don

0 Kudos

And moving you post to the .NET SDK forum

Former Member
0 Kudos

Hi Don,

I am using CR version 13.0.14.1720.

From your reply I understand that I can not use P2P, but instead I need to use PrintOutputController.

Could you please show me how?

What do I need to reference in order to have access to this feature?

Thank you

Helen.

0 Kudos

Hi Helen,

Did you search for that KBA I posted above that has all of the answers...

Don


Former Member
0 Kudos

Hi Don,

The KB you mentioned is just an overview of updates.

http://search.sap.com/notes?id=0002163438&boj=/sap/bc/bsp/spn/scn_bosap/notes.do?access=69765F6D6F64653D3939382669765F7361706E6F7465735F6E756D6265723D30303032313633343338http://Hi

It has a link to DOC-57978 which, in turn, has links to various pages explaining how to print from Crustal Reports but only through the gui (no code samples).

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

Notably the section "Custom Printer Sizes" is marked Under Construction, and is plain text, not even a link.

Reading other - numerous - posts on the topic reveals insane amount of frustration, failed attempts in code, and no real solutions.

Could you please post real code for me that I can follow.

It is not that I am attempting to build a space craft from scratch - just printing a custom size report.


Please help me.

Thank you.

0 Kudos

"And then search for this KBA - 2163438, I attached a sample app that shows and explains how printing works and when using custom Paper Sizes."

Answers (0)