Platforms to show: All Mac Windows Linux Cross-Platform

/PDFlib/pditest
Feedback.

Function:
You find this example project in your Plugins Download as a Realbasic project file within the examples folder: /PDFlib/pditest
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 doc, page as integer
dim sheetwidth, sheetheight as single
dim p as PDFLibMBS
dim e as integer
dim fi,fo as FolderItem

if not p.APIloaded then

if TargetMachO then
e=p.LoadFramework(getfolderitem("PDFlib.framework"))
elseif TargetWin32 then
e=p.LoadDLL("PDFlib.dll")
end if

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

p=new PDFLibMBS


p.SetParameter("compatibility", "1.4") // for compatibility to older and newer Acrobat Readers.

fi=GetFolderItem("input.pdf")
fo=GetFolderItem("output.pdf")

if p.openFile(fo)<>-1 then

doc = p.openPDI(fi, "")

if doc>=0 then

page = p.OpenPDIPage(doc, 1, "")

if page>=0 then
sheetwidth = p.getValuePDI("width", doc, page, 0)
sheetheight = p.getValuePDI("height", doc, page, 0)
p.beginPage(sheetwidth*2, sheetheight*2)

p.FitPDIpage(page,0,0,"")

p.ClosePDIPage(page)
p.endPage
else
msgbox "Couldn't open page 1 of PDF file input.pdf."
end if
else
msgbox "Couldn't open PDF input file input.pdf."
end if

p.close
else
msgBox "Could not create file output.pdf."
end if

fo.launch

MsgBox "Finished."
quit

Exception ex as PDFLibExceptionMBS
MsgBox "PDF Lib Exception: "+ex.ErrorMessage+" ("+str(ex.ErrorNumber)+", "+ex.FunctionName+")"

quit
End Sub
End Class





Links
MBS Realbasic Plugins - Bilder aus Nickenich