Prathik
Prathik

Reputation: 29

Is there any way to rotate a PDF file created using PdfDocument canvas in android

Is there any way to rotate a PDF file created using PdfDocument canvas in android or is there any way to rotate a pdf file before saving to phone on android ?

Upvotes: 1

Views: 557

Answers (1)

Nabin Bhandari
Nabin Bhandari

Reputation: 16409

Yes there is a way. Use canvas.rotate(90); before drawing anything in the canvas of PDF document.

canvas.save();
// rotate with respect to center of the page.
canvas.rotate(90, canvas.getWidth() / 2, canvas.getHeight() / 2);
canvas.draw(/*whatever*/);
canvas.restore();

Upvotes: 1

Related Questions