This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.ThreadLocalRandom; | |
int minimum = 10; | |
int maksimum = 25; | |
int randomSayi = ThreadLocalRandom.current().nextInt(minimum, maksimum + 1); | |
/* Maksimuma 1 eklememizin sebebi nextInt() metodu maksimum değeri dahil | |
etmiyor bu nedenle 1 ekleyerek 25 dahil olacak şekilde sayı üretebiliriz. */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Random; | |
//Normal Random sınıfını ekliyoruz | |
Random random = new Random(); | |
int minimum = 10; | |
int maksimum = 25; | |
int randomSayi = random.nextInt((maksimum - minimum ) + 1) + minimum; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Random random = new Random(); | |
// Burada minimum sayı 10(dahil) - maksimum sayı 25(dahil değil) | |
// Yani 10 ile 24 arası sayılar üretilecektir | |
int randomSayi = random.nextInt(10) + 25; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int minimum = 10; | |
int maksimum = 25; | |
int randomSayi = new Random().nextInt((maksimum - minimum ) + 1) + minimum; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.ThreadLocalRandom; | |
int minimum = 10; | |
int maksimum = 25; | |
int randomSayi = ThreadLocalRandom.current().nextInt(minimum, maksimum); | |
// Alttaki şekilde kullanırsanız maksimum değeri de dahil edecektir. | |
randomSayi = ThreadLocalRandom.current().nextInt(minimum, maksimum + 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Her Sayfayı A4 Boyutuna getirdik | |
pdfDosyam.setPageSize(PageSize.A4); | |
// Şu şekilde A5 boyutuna da getirebiliriz | |
// Bunun gibi bir çok boyutu bulunmakta | |
pdfDosyam.setPageSize(PageSize.A5); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pdfDosyam.addTitle("PDF Başlığı"); | |
pdfDosyam.addSubject("PDF Açıklaması"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Oluşturma tarihini girdik | |
pdfDosyam.addCreationDate(); | |
// Yazar ve Kurucu adını ekledik | |
pdfDosyam.addAuthor("PDF Yazar Adı"); | |
pdfDosyam.addCreator("PDF Oluşturucu Adı"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
// Document pdfDosyam = new Document(); | |
// pdfDosyam isimli dosyayı yukarıdaki gibi önce oluşturmalıyız. | |
// Oluşturmadan sonra aşağıdaki gibi kaydediyoruz | |
PdfWriter.getInstance(pdfDosyam, new FileOutputStream(new | |
File(Environment.getExternalStorageDirectory(),"test.pdf"))); | |
} catch (DocumentException | FileNotFoundException e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Paragraph paragraf = new Paragraph("Merhaba Dünya"); | |
// Paragrafın konumunu ayarlamak | |
paragraf.setAlignment(Element.ALIGN_CENTER); | |
// Paragrafı pdf dosyamıza ekleme | |
pdfDosyam.add(paragraf); |
OlderNewer