Platforms to show: All Mac Windows Linux Cross-Platform
/PDFlib/pdflib hello
Feedback.
Function:
You find this example project in your Plugins Download as a Realbasic project file within the examples folder: /PDFlib/pdflib hello
This example is the version from Fri, 25th Feb 2010.
Notes: Last modified: Fri, 25th Feb 2010
Feedback.
Function:
You find this example project in your Plugins Download as a Realbasic project file within the examples folder: /PDFlib/pdflib hello
This example is the version from Fri, 25th Feb 2010.
Notes: Last modified: Fri, 25th Feb 2010
Class App
Inherits Application
// Event implementations
Sub Open()
dim p as PDFLibMBS
dim n as integer
dim fonthandle as integer
dim f as folderItem
dim e as integer
dim filename as String
if not PDFLibMBS.APIloaded then
#if TargetMachO
e=PDFLibMBS.LoadFramework(getfolderitem("PDFlib.framework"))
#elseif TargetCarbon
e=PDFLibMBS.LoadCFMLibrary("PDFlib Carbon")
#elseif TargetPPC
e=PDFLibMBS.LoadCFMLibrary("PDFlib Classic")
#elseif TargetWin32
e=PDFLibMBS.LoadDLL("PDFlib.dll")
#endif
if e<>0 then
MsgBox "LoadAPI: "+str(e)+EndOfLine+EndOfLine+"You need the PDFLib library in the correct place. Check the source code!"
quit
end if
end if
if not p.APIloaded then
MsgBox "Can't load the shared library. Please place it into the folder of this application!"
quit
end if
p=new PDFLibMBS
filename="hello "+p.PluginName+".pdf"
f=GetFolderItem(filename)
n=p.BeginDocument(f,"")
if n<0 then
msgBox "Error: couldn't open PDF file."
quit
else
p.setinfo "Creator","Realbasic test application"
p.setinfo "Author", "Christian Schmitz"
p.setinfo "Title","Hello World (RB)"
p.beginPage 500,500
fonthandle=p.FindFont("Helvetica-Bold","host",0)
p.setfont fonthandle,24
p.settextpos 50,400
p.show "Hello World!"
p.continueText "(says Realbasic)"
p.continueText "PDFlib: "+str(p.GetValue("major",0))+"."+str(p.GetValue("minor",0))+"."+str(p.GetValue("revision",0))
p.continueText p.pluginname
p.endpage
// second page with a lot of fonts...
p.beginPage 500,500
fonthandle=p.FindFont("Helvetica-Bold","host",0)
p.setfont fonthandle,24
p.settextpos 50,400
p.show "Hello World!"
p.continueText "(says Realbasic)"
fonthandle=p.FindFont("Helvetica","host",0)
p.setfont fonthandle,14
p.settextpos 50,220
p.show "Helvetica"
fonthandle=p.FindFont("Helvetica-Bold","host",0)
p.setfont fonthandle,14
p.settextpos 50,200
p.show "Helvetica-Bold"
fonthandle=p.FindFont("Helvetica-Oblique","host",0)
p.setfont fonthandle,14
p.settextpos 50,180
p.show "Helvetica-Oblique"
p.endpage
p.EndDocument ""
f=GetFolderItem(filename)
f.Launch
end if
quit
Exception ex as PDFLibExceptionMBS
MsgBox "PDF Lib Exception: "+ex.ErrorMessage+" ("+str(ex.ErrorNumber)+", "+ex.FunctionName+")"
quit
End Sub
End Class
See also:
Links
MBS Realbasic tutorial videos - Pfarrgemeinde St. Arnulf Nickenich