Click here to Skip to main content
15,894,106 members
Please Sign up or sign in to vote.
1.40/5 (3 votes)
See more:
Hi All,

I have print a photo on crystal report. want to rotate image on crystal report while printing. reply.


Thanks
Posted
Updated 7-Jan-21 2:48am
Comments
Sandeep Mewara 30-Apr-11 5:57am    
What do you mean by rotate image while printing?

AFAIK it's impossible. You can't rotate images in crystal report.

But you can Rotate the text in Crystal reports Crystal Reports : Rotating Text[^]

So you have to rotate images externally, save them and then get those images in crystal reports.

For your information
C# Tutorial - Image Editing: Rotate
[^]

But I'll try myself an experiment regarding this & will let you know. Cheers.
 
Share this answer
 
You Have TO First insert it to your database on below code then it will be rotated...........



SqlConnection con2 = ConnectionClass.SQLCONNECTION();
SqlDataAdapter da2 = new SqlDataAdapter();
string query= ("insert into HRCard values("@image");
da2.InsertCommand = new SqlCommand(query2, con2);
con2.Open();
var stream2 = new MemoryStream(binaryphoto3);
Image im2 = Image.FromStream(stream2);
im2.RotateFlip(RotateFlipType.Rotate90FlipNone);
MemoryStream ms2 = new MemoryStream();
im2.Save(ms2, ImageFormat.Jpeg);
byte[] bmpBytes2 = ms2.ToArray();

da2.InsertCommand.Parameters.Add("image", SqlDbType.VarBinary).Value = bmpBytes2;
int RowsEffected2 = da2.InsertCommand.ExecuteNonQuery();
con2.Close();
 
Share this answer
 
v2
Comments
Richard Deeming 7-Jan-21 9:09am    
Ignoring the fact that this is a very old question, your (unformatted) code has at least one obvious syntax error which means it would not compile.

The OP also wanted to rotate the image when they printed it, not when they inserted it into the database. In fact, there's no indication that their image was stored in the database at all.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900