Я хочу создать файл PDF из кода Java. И это то, что я написал до сих пор-
public class IOExp {
public static void main(String args[]) throws java.io.IOException {
java.io.FileOutputStream fout=new java.io.FileOutputStream("MyFile.pdf");
byte [] arr=("Hello World.\n"+"My name is Prateek Mathur, and I am a great programmer.\n").getBytes();
fout.write(arr);
}
}
MyFile.pdf создается без проблем, но при его открытии Adobe Reader отображает следующее сообщение:
'Abode Reader can not open 'MyFile.pdf' because it is either not a supported file
type or because the file has been damaged (for example, it was sent as an email
attachment and wasn't correctly decoded.'
Я уже знаком с iText API и хочу знать, как создавать PDF-файлы вручную.
В чем проблема с моим кодом и какие изменения необходимо внести для успешного создания файла PDF??