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
// Separator tanımlama ve renklendirme | |
LineSeparator lineSeparator = new LineSeparator(); | |
lineSeparator.setLineColor(new BaseColor(0, 0, 0, 68)); | |
// Ekleme | |
pdfDosyam.add(new Chunk(lineSeparator)); |
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
// 2 Sütunlu tablo oluşturma | |
PdfPTable tablo_1 = new PdfPTable(2); | |
// Hücre oluşturma kısmı | |
PdfPCell hucre_1 = new PdfPCell(new Paragraph(new Chunk("Satır - 1"))); | |
PdfPCell hucre_2 = new PdfPCell(new Paragraph(new Chunk("Satır - 2"))); | |
// Hücrelere iç boşluk verme | |
hucre_1.setPadding(5); | |
hucre_2.setPadding(5); |
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
Chapter bolum1 = new Chapter("Bölüm", 1); | |
Paragraph bolum1_icerik = new Paragraph("Bölüm 1 İçerik"); | |
bolum1.add(bolum1_icerik); | |
pdfDosyam.add(bolum1); | |
Chapter bolum2 = new Chapter("Bölüm", 2); | |
bolum2.add(new Paragraph("Bölüm 2 İçerik")); | |
pdfDosyam.add(bolum2); |
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
List liste1 = new RomanList(); | |
liste1.add(new ListItem("Item 1")); | |
liste1.add(new ListItem("Item 2")); | |
pdfDosyam.add(liste1); | |
List liste2 = new List(); | |
liste2.add(new ListItem("İtem 1")); | |
liste2.add(new ListItem("İtem 2")); |
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 { //******************* iText Resim EKLEME ******************* | |
// Logoyu bitmap'e çevirip stream ile baytlara ayırıp pdfe basıyoruz | |
Bitmap bmp = BitmapFactory.decodeResource(context.getResources(), | |
R.drawable.home); | |
ByteArrayOutputStream stream = new ByteArrayOutputStream(); | |
bmp.compress(Bitmap.CompressFormat.PNG, 100, stream); | |
byte[] byteArray = stream.toByteArray(); |
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
// Fontu Çekip Türkçe Karakter Sorununu Atlatmak İçin Ayarladığımız Kısım | |
BaseFont arial = null; | |
try { | |
arial = BaseFont.createFont("assets/arial.ttf", | |
BaseFont.IDENTITY_H,BaseFont.EMBEDDED); | |
} catch (Exception e) { | |
Log.e("hata","Font Çekme Hatası "+e.toString()); |
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
package com.harun.pdfolusturucu; | |
import android.content.Context; | |
import android.graphics.Bitmap; | |
import android.graphics.BitmapFactory; | |
import android.os.Environment; | |
import android.util.Log; | |
import android.widget.Toast; | |
import com.itextpdf.text.BaseColor; |
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
// Bu kodları MainActivity İçerisine Yazabilirsiniz | |
// İlgili resimleri kendi resimlerinizin adıyla değiştiriniz | |
ArrayList<Integer> resimId = new ArrayList<>(); | |
resimId.add(R.drawable.harun_xyz); | |
resimId.add(R.drawable.harun_xyz_opacity_25); | |
// Context ve Resim idlerini yolluyoruz | |
new PDFOlusturucu().pdfOlustur(MainActivity.this,resimId); |
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
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | |
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> |
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 android.app.ProgressDialog; | |
import android.content.Context; | |
import android.os.AsyncTask; | |
import android.os.Environment; | |
import android.util.Log; | |
import android.widget.Toast; | |
import java.io.File; | |
import java.util.Properties; |