Platforms to show: All Mac Windows Linux Cross-Platform
/DynaPDF/Million pages test/Import page 1000000
Required plugins for this example: MBS DynaPDF Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /DynaPDF/Million pages test/Import page 1000000
This example is the version from Sun, 17th Mar 2012.
Project "Import page 1000000.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
' Register DynaPDF
// with DynaPDF 3 expect a time less than one second and less than 100 MB of memory used
// with DynaPDF 2.5 expect a few seconds (depending on hard disk speed) and over 1 GB of memory used
dim inputfile as FolderItem = SpecialFolder.Desktop.child("PDF with 1000000 pages.pdf")
dim pdf as new MyDynapdfMBS
dim file as FolderItem = SpecialFolder.Desktop.Child("test "+DynaPDFMBS.kDYNAPDF_VERSIONSTRING+".pdf")
dim t as integer = ticks
call pdf.CreateNewPDF file
/// If the imported document should be edited then avoid
// the conversion of pages to templates (see SetImportFlags()
// for further information).
'call pdf.SetImportFlags(bitwiseOr(pdf.kifImportAll,pdf.kifImportAsPage))
// Import the PDF file so that it can be edited
call pdf.OpenImportFile(InputFile,pdf.kptOpen,"")
call pdf.append
dim x as integer = pdf.ImportPage(1000000)
call pdf.PlaceTemplateEx(x, 0, 0, pdf.GetPageWidth, pdf.GetPageHeight)
call pdf.EndPage
MsgBox Format((ticks-t) / 60.0, "0.0")+" seconds with DynaPDF "+pdf.kDYNAPDF_VERSIONSTRING
call pdf.CloseImportFile
call pdf.CloseFile
pdf = nil
file.Launch
quit
End EventHandler
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Class MyDynaPDFMBS Inherits DynaPDFMBS
EventHandler Function Error(ErrorCode as integer, ErrorMessage as string, ErrorType as integer) As integer
// output all messages on the console:
System.DebugLog str(ErrorCode)+": "+ErrorMessage
// and display dialog:
Dim d as New MessageDialog //declare the MessageDialog object
Dim b as MessageDialogButton //for handling the result
d.icon=MessageDialog.GraphicCaution //display warning icon
d.ActionButton.Caption="Continue"
d.CancelButton.Visible=True //show the Cancel button
// a warning or an error?
if BitAnd(ErrorType, me.kE_WARNING) = me.kE_WARNING then
// if user decided to ignore, we'll ignore
if IgnoreWarnings then Return 0
d.Message="A warning occurred while processing your PDF code."
// we add a third button to display all warnings
d.AlternateActionButton.Caption = "Ignore warnings"
d.AlternateActionButton.Visible = true
else
d.Message="An error occurred while processing your PDF code."
end if
d.Explanation = str(ErrorCode)+": "+ErrorMessage
b=d.ShowModal //display the dialog
Select Case b //determine which button was pressed.
Case d.ActionButton
Return 0 // ignore
Case d.AlternateActionButton
IgnoreWarnings = true
Return 0 // ignore
Case d.CancelButton
Return -1 // stop
End select
End EventHandler
Property IgnoreWarnings As Boolean
End Class
End Project
See also:
The items on this page are in the following plugins: MBS DynaPDF Plugin.