cancel
Showing results for 
Search instead for 
Did you mean: 

Export to PDF limitations in papersize ?

Former Member
0 Kudos

I am exporting to PDF from my app developed in C# VS2008.

Trying to set papersize to custom size eg. A0, A1....

But i got exception in this funktion :

reportDocument1.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, tmpfile + ".Pdf");

but in crviewer it works fine if i print directly to printer..

//regards Jorgen

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

Need more info:

What version of Crystal Reports are you using?

Have you applied any Service packs for your version of CR?

What is the actual exception message?

Can you export pdf format to disc from the CR viewer?

Can you export any other format using the viewer and / or code?

Ludek

Former Member
0 Kudos

Hello!

I am using Crystal Reports 2008 with sp1 fixpack7

But our customers have only sp0 but there is the same result.

Exception is "Memory full"

*****************************************************************************************************************************************************

System.Runtime.InteropServices.COMException (0x80041004): Minnet är fullt.

Det går inte att exportera rapporten.

Tillräckligt minne saknas för åtgärden.

vid CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext)

*******************************************************************************************************************************************************

The reportfile is designed with CR2008 editor with 5 different page sizes: A0,A1,A2,A3 and A4

the sizes for A4 and A3 works fine in both CRViewer and to export as PDF.

The sizes for A0,A1 and A2 works fine in CRViewer but can not export to PDF, but print to printer works fine..

We set the papersize from code like this:

reportDocument1.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperA4;

reportDocument1.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperA3;

but for the other ones so can we not use this because the PaperA0,A1 and A2 does not exist in "CrystalDecisions.Shared.PaperSize" so we use

"CrystalDecisions.Shared.PaperSize.DefaultPaperSize" instead.

Have tryed to manually set papersize object but there is no difference.

The print application is called from an c++ MFC application via COMInterop if this helps you to guess this problem.

The RPT file have these settings in "Page Setup" in the designer:

No printer (Optimize for screen display) (is checked)

Dissociate formatting page size and printer papersize (is checked)

User defined size (for A0)

Width: 84.088 cm

Height: 118.882 cm

The rpt file contains very little text. The whole page is an "OLE Object" or eg. picture (WMF) that is set from the applicaton at runtime.

regards Jorgen

Edited by: jorglund on Jul 21, 2009 5:58 PM

former_member183750
Active Contributor
0 Kudos

1) If you do not use code:

reportDocument1.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperA4;

reportDocument1.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperA3;

and instead export using the export button of the viewer, does this work?

2) Does an export to any other format work?

3) Need more detail re.:

The reportfile is designed with CR2008 editor with 5 different page sizes: A0,A1,A2,A3 and A4

Is there 5 reports? report 1 = A0, report 2 = A1, report 3 = A2, report 4 = A3 and report 5 = A4?

4) As you see PaperSize A4 and A3, but not A0, A1 and A2, I suspect that those paper sixes are not available on t e default printer(?). Certainly, if I use reportDocument1.PrintOptions.PaperSize, intellisense only displays those paper sizes actually defined. Can you see A0, A1 and A2 in the CR designer? Or put another way; do you get the same issue on the computer where you have designed the reports?

Ludek

Former Member
0 Kudos

Hi Ludek !

Tnx for your quick response

My Answers:

1) No it does not.

2) PDF: No, XLS: Yes, RTF: No, DOC: No, XML: Yes, RPT: Yes

But in XLS and XML i can´t see the picture object from the report..

3) Yes

4) In my computer i have all the papersizes available at my printer.

The reports are developed and created at my computer and i get the same issue here.

..Jorgen

former_member183750
Active Contributor
0 Kudos

Ok. Stand by while I try to do a bit more testing on this today. Meanwhile, I'm not sure if you have Service Pack 1 for CR 10.5 installed. If you do not, please download it from here:

https://smpdl.sap-ag.de/~sapidp/012002523100009351512008E/crbasic2008sp1.exe

Ludek

Former Member
0 Kudos

Hi Ludek !

Do i need that sp ?

I am using CR2008 Developer in VS2008 ?

The version of CR Designer is 12.1.7.1144

Assembly version of CrystalDecisions.CrystalReports.Engine is 12.0.2000.0

..Jorgen

former_member183750
Active Contributor
0 Kudos

Ooops. Now you do not need that SP. You're as up tp date as you can be.

Ludek

former_member183750
Active Contributor
0 Kudos

Ok, got it. So what is happening is that the choices yousee in the .NET intellisense for paper sizes, is a list of constans for all (or most printers). Dynamically created or custom paper sizes do not show up. Those you have to retrieve as enaums using teh framework, then set the enum to the paer size. E.g.; on my computer I have a cusom size of of a label 4'' X 8.5''. I do not see this custom paper size in .net. But using the Devcap utiltiy (attached) , I see the paper size and the enum is 117. Thus setting the paper size to 117 allows me to now use that paper size.

Ludek

Former Member
0 Kudos

Hi Ludek !

Tnx for your answer, but i have tested that already aswell.

My printer reports for A0 size the ID of 270 and that is what your utility says too.

setting the papersize is done by this:

reportDocument1.PrintOptions.PaperSize = (CrystalDecisions.Shared.PaperSize)rawKind

where rawKind for example has the value of 270.

I have tryed to make a simple form applikation (VS2008 wizard) with only crviewer and loading the A0 report that i have

without any changes and trying to export to pdf from viewer with the same result.

link to rptfile with xml data source: http://www.jetoma.se/Filer/RPT.zip

..Jorgen

Answers (0)