We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Tif to PDF page rotation

I have a tif page I am converting to PDF

I need to rotate the image 180 degrees.

I have tried the following code (I have a snippet of the code) and it does not seem to work.

// Instantiate BitMap object with loaded image stream
System.Drawing.Bitmap b = new System.Drawing.Bitmap(mystream);

// Set margins so image will fit, etc.
page.PageInfo.Margin.Bottom = 0;
page.PageInfo.Margin.Top = 0;
page.PageInfo.Margin.Left = 0;
page.PageInfo.Margin.Right = 0;

page.CropBox = new Aspose.Pdf.Rectangle(0, 0, b.Width, b.Height);
// Create an image object
Aspose.Pdf.Image image1 = new Aspose.Pdf.Image();

// Add the image into paragraphs collection of the section
page.Paragraphs.Add(image1);

// Set the image file stream
image1.ImageStream = mystream;

page.Rotate = Rotation.on180;

// Save resultant PDF file
pdfDoc.Save(sOutFile);

The image in the PDF is not rotated.
Can you point me to what I am doing wrong?

Thanks

Prakash


Hi Prakash,


Thanks for your inquiry. please note when we are creating a new PDF document, it is created dynamically by API and in order to get real PDF document we need to render its programming/dynamic model. We can render PDF document model by calling Save() method or ProcessParagraph(). Please amend your code as following, it will help you to accomplish the task.

<o:p></o:p>

// Set the image file stream

image1.ImageStream = mystream;

pdfDoc.ProcessParagraphs();

page.Rotate = Rotation.on180;

....


Please feel free to contact us for any further assistance.

Best Regards,

That worked.

Thanks for the awesome support.

Prakash

Hi Prakash,


Thanks for the acknowledgement.

We are glad to hear that your problem is resolved. Please continue using our API and in the event of any further query, please feel free to contact.