Java tutorial
import java.io.FileOutputStream; import com.lowagie.text.Document; import com.lowagie.text.Image; import com.lowagie.text.Paragraph; import com.lowagie.text.pdf.PdfWriter; public class MainClass { public static void main(String[] args) throws Exception { Document document = new Document(); PdfWriter.getInstance(document, new FileOutputStream("2.pdf")); document.open(); Image jpg1 = Image.getInstance("dog.jpg"); jpg1.scalePercent(80); jpg1.setRotation((float) Math.PI / 6); document.add(new Paragraph("rotate 30 degrees")); document.add(jpg1); document.add(new Paragraph("Original width: " + jpg1.width() + "; original height: " + jpg1.height())); document.close(); } }