Re: [Module] pbPDF-Module
Verfasst: 30.01.2020 10:44
Update: PDF::GetStringHeight() added
Code: Alles auswählen
PDF::Cell(#PDF, "نشوان عبد الرزاق عبد الب" + Chr(Asc("ا"))+" " + Chr(Asc("ق"))+ " " + Chr(Asc("ي")),20,10,#False,PDF::#Right,"",#False)
Code: Alles auswählen
PDF::EmbedFont(#PDF,"Amiri","","")
PDF::SetFont(#PDF, "Amiri","B", 16)
PDF::Cell(#PDF, "نشوان عبد الرزاق عبد الب" + Chr(Asc("ا"))+" " + Chr(Asc("ق"))+ " " + Chr(Asc("ي")),20,10,#False,PDF::#Right,"",#False)
Code: Alles auswählen
Procedure Header()
pdf_SetFont("MS Sans Serif Standard","B",14)
pdf_SetY(Rand\ro)
pdf_Cell(0,16, FormatString(Rand\HT),#PDF_CELL_BOTTOMBORDER,0,#PDF_ALIGN_CENTER)
pdf_SetY(Rand\ro +24)
EndProcedure
Procedure Footer()
pdf_SetFont("MS Sans Serif Standard","",10)
pdf_SetY(Rand\ru-Rand\FH)
pdf_Cell(0,rand\FH,FormatString(Rand\FT),#PDF_CELL_TOPBORDER,0,#PDF_ALIGN_RIGHT)
EndProcedure
Code: Alles auswählen
If Rand\HS
pdf_SetProcHeader(@Header())
EndIf
If Rand\FS
pdf_SetProcFooter(@Footer())
EndIf
Code: Alles auswählen
pdf_Create
pdf_SetDisplayMode
pdf_DisplayPreferences
pdf_AliasNbPages
pdf_SetTitle
pdf_SetSubject
pdf_SetCreator
pdf_SetAutoPageBreak
pdf_SetMargins
pdf_SetFont
pdf_SetProcHeader
pdf_SetProcFooter
pdf_SetProcCompression
pdf_AddPage
...
...
Code: Alles auswählen
XIncludeFile ".\pbPDFModule.pbi"
#PDFFILE = 1
Procedure Header()
PDF::SetFont(#PDFFILE,"Arial","I",8)
PDF::SetColorRGB(#PDFFILE,PDF::#TextColor,127,255,127)
PDF::Cell(#PDFFILE,"Header",#False,8,#False,PDF::#NextLine,PDF::#CenterAlign,#False,"")
PDF::Ln(20)
EndProcedure
Procedure Footer()
PDF::SetPosY(#PDFFILE,-20,#False)
PDF::SetFont(#PDFFILE,"Arial","I",8)
PDF::SetColorRGB(#PDFFILE,PDF::#TextColor,127,0,127)
PDF::Cell(#PDFFILE,"Dies ist eine Fußzeile mal ohne Angabe von Seitenzahlen",#False,8,#False,PDF::#NextLine,PDF::#CenterAlign,#False,"")
EndProcedure
If PDF::Create(#PDFFILE);,"P","mm",PDF::#Format_A4)
; ===== General Settings =====
PDF::EnableHeader(#PDFFILE,#True)
PDF::EnableFooter(#PDFFILE,#True)
PDF::SetAutoPageBreak(#PDFFILE,#True)
PDF::SetPageNumbering(#PDFFILE,#True)
; ===== Meta Settings =====
PDF::SetInfo(#PDFFILE,PDF::#Author,"Author Name")
PDF::SetInfo(#PDFFILE,PDF::#Title,"Document Title")
PDF::SetInfo(#PDFFILE,PDF::#Subject,"Document Subject")
PDF::SetInfo(#PDFFILE,PDF::#Keywords,"Document Keywords")
PDF::SetInfo(#PDFFILE,PDF::#Creator,"Who has written this document")
; ===== File Control =====
PDF::SetHeaderProcedure(#PDFFILE,@Header())
PDF::SetFooterProcedure(#PDFFILE,@Footer())
; ===== File content =====
PDF::AddPage(#PDFFILE)
PDF::SetFont(#PDFFILE,"Arial","",10)
PDF::SetColorRGB(#PDFFILE,PDF::#TextColor,127,127,127)
PDF::Cell(#PDFFILE,"Hier beginnt das Formular",#False,8,#False,PDF::#NextLine,PDF::#CenterAlign,#False,"")
PDF::AddPage(#PDFFILE)
PDF::SetColorRGB(#PDFFILE,PDF::#TextColor,227,227,227)
PDF::Cell(#PDFFILE,"Hier beginnt das Formular Seite 2",#False,8,#False,PDF::#NextLine,PDF::#CenterAlign,#False,"")
PDF::AddPage(#PDFFILE)
PDF::SetColorRGB(#PDFFILE,PDF::#TextColor,27,27,27)
PDF::Cell(#PDFFILE,"Hier beginnt das Formular Seite 3",#False,8,#False,PDF::#NextLine,PDF::#CenterAlign,#False,"")
; ===== Finalize Document =====
PDF::Close(#PDFFILE,"test.pdf")
RunProgram("test.pdf")
EndIf