Skip to main content

Using Half Size Form in Crystal Reports

i have a hard time trying to solve this one

scenario: at first, we using Letter format to print Delivery Order and Invoice..it run smoothly and in CR we just using Letter as the Page Setup..

now new paper format is coming which is half of the Letter size
at first i thougt it is easy because we only need to create new paper size on Server Properties under Printer and Faxes then use the new size at Paper Size in CR then redesign it to fit but it all when wrong, eventhough it display correctly but when i want to print it, it turn up everything that vertical become horizontal..very2 strange behaviour

so i give using CR.PrintReport method..i ended up format it to .rtf then print it using this code
Dim oDoc As New ReportDocument
Dim sFileName As String = String.Empty

oDoc.Load(_ReportPath)

'must use this line to make sure it print using the new size
'credit goes to Ali from dotnet.netindonesia.net
Dim printDoc As System.Drawing.Printing.PrintDocument = New System.Drawing.Printing.PrintDocument

Dim i As Integer

Dim rawKind As Integer = 0

For i = 0 To printDoc.PrinterSettings.PaperSizes.Count
If printDoc.PrinterSettings.PaperSizes(i).PaperName = "NEW_SIZE_PAPER" Then

rawKind = CInt(GetField(printDoc.PrinterSettings.PaperSizes(i), "kind"))

Exit For
End If

Next i

oDoc.PrintOptions.PaperSize = CType(rawKind, CrystalDecisions.Shared.PaperSize)
'oDoc.PrintToPrinter(1, False, 0, 0)

Dim CrExportOptions As ExportOptions = New ExportOptions()
Dim CrDiskFileDestinationOptions As DiskFileDestinationOptions = New DiskFileDestinationOptions

Dim CrFormatTypeOptions As PdfRtfWordFormatOptions = New PdfRtfWordFormatOptions
CrDiskFileDestinationOptions.DiskFileName = sFileName

CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile
CrExportOptions.ExportFormatType = ExportFormatType.RichText
CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions
CrExportOptions.FormatOptions = CrFormatTypeOptions

oDoc.Export(CrExportOptions)

Dim myProcess As New Process()

myProcess.StartInfo.FileName = sFileName
myProcess.StartInfo.Verb = "Print"
myProcess.StartInfo.CreateNoWindow = True
myProcess.StartInfo.ErrorDialog = False
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
myProcess.Start()

it print correctly now, hope it turn up well in Live

see u

Comments

Popular posts from this blog

Crystal Report 2010 - Failed to load database information

"Failed to load database information" error when i try deploy my program with CR 2010 using TTX file as report definition this is because there is missing .dll, call "CRDB_FIELDDEF.DLL"..u need to manually copy the file to "C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86" folder then the report is loading again it said that TTX is old tech but i'm still using it because i don't need to connect the report to any DB, but until i found new one to replace :D check this link to read it [EDIT 25 Jan 2011] i think i'll using ADO.NET Dataset next time :D until then

Session timeout problem in IIS

Hi, Long time no post, i will try to post again since i came out searching a typical solution over and over again :D Now i'm gonna post about session. Since i got this from other link so here it is So I started looking into the IIS settings and came to know that i missed two things to change : Application pool’s Idle Time-out (minutes) Session state  – State server’s Time-out (seconds) Once I have changed above settings than after Session timeout worked. So after that I have made one checklist that can help us to validate Session timeout settings, here i am sharing it with you as well so that you will also get some benefits from it : Application Pool  – Advanced Settings Menu – Process Model – Idle Time-out (minutes) Sites –  Session State  – Cookie Settings – Time-out (minutes) If you are using  State Server  or  SQL Server  to manage your session (instead of InProcess), Here is the steps to follow :    ...

Could not load file or assembly error in VS 2010 and CR

when u received this kind of error "Could not load file or assembly 'file:///C:\Program Files\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1\crdb_adoplus.dll' or one of its dependencies. The system cannot find the file specified." try to add this to your .config file (usually app.config) PS: don't forget to remove extra space after " see u