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

Free Support Forum - aspose.com

Insert new Page and ignore the rotation

Hi,


Is there a way to add a rotated image to an existed pdf and ignore the rotation, than save the document ??

Thank you in advanced

Hi Hiba,


Thanks for using our products and sorry for this delayed response.

As per my understanding, you need to rotate an image file and then you need to add the rotated image to PDF document. If so is the case, then please try using the following code snippet.

[C#]

Bitmap source_image = new
Bitmap(“c:/pdftest/StampedPDF.png”);<o:p></o:p>

source_image.RotateFlip(RotateFlipType.Rotate90FlipX);

// save the rotated image in Stream object

MemoryStream stream = new MemoryStream();

source_image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);

//create PdfFileMend object to add text

PdfFileMend mender = new PdfFileMend();

// bind the source PDF file

mender.BindPdf("c:/pdftest/LineSpacing_HelloWorld.pdf");

//add image in the PDF file

mender.AddImage(stream, 1, 100, 600, 200, 700);

//save the PdfFileMend object

mender.Save("c:/pdftest/LineSpacing_HelloWorld_WithImage.pdf");

stream.Close();

hi,


No actually i’m trying to save the document with no rotations at all. If the inserted image is originally rotated i need to save it without rotation.

Hi Hiba,


In case the image inserted in PDF is rotated, you may first consider rotating the respective PDF page and then save the document. Please try using the following code snippet to rotate the page of PDF file.

[C#]

Document doc = new
Document(“input.pdf”);<o:p></o:p>

// rotate first page to 90 degree

doc.Pages[1].Rotate = Rotation.on90;

// save updated document

doc.Save(“PageRotated.pdf”);