Platforms to show: All Mac Windows Linux Cross-Platform

/DynaPDF/Interlace PDFs

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/Interlace PDFs

This example is the version from Sat, 1st Jan 2021.

Project "Interlace PDFs.xojo_binary_project"
Filetype text
End FileTypes
MenuBar MenuBar1
MenuItem UntitledMenu1 = ""
MenuItem FileMenu = "&File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu5 = ""
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "Clear"
MenuItem UntitledMenu4 = ""
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = ""
End MenuBar
Class App Inherits Application
EventHandler Sub Open() Dim ti As Integer = Ticks // take one page from each and loop over all pages Dim file1 As FolderItem = FindFile("dynapdf_help.pdf") Dim file2 As FolderItem = FindFile("license.pdf") Dim destFile As FolderItem = SpecialFolder.Desktop.Child("output.pdf") Interlace file1, file2, destFile ti = ticks-ti MsgBox Format(ti/60.0, "0.0")+" seconds for "+str(pageCount)+" pages" destFile.Launch Quit End EventHandler
Function FindFile(name as string) As FolderItem // Look for file in parent folders from executable on dim parent as FolderItem = app.ExecutableFile.Parent while parent<>Nil dim file as FolderItem = parent.Child(name) if file<>Nil and file.Exists then Return file end if parent = parent.Parent wend End Function
Sub Interlace(file1 as FolderItem, file2 as FolderItem, destFile as FolderItem) Dim pdf As New DynapdfMBS pdf.SetLicenseKey "Pro" // For this example you can use a Pro or Enterprise License Call pdf.CreateNewPDF destFile Call pdf.SetImportFlags BitwiseOr(pdf.kifImportAll, pdf.kifImportAsPage) // allow multiple open files Call pdf.SetImportFlags2 pdf.kif2UseProxy // keep imported file in memory Call pdf.SetUseGlobalImpFiles(True) // open pdf file for importing Dim ImportHandle1 As Integer = pdf.OpenImportFile(file1, pdf.kptOpen, "") Dim PageCount1 As Integer = pdf.GetInPageCount // ImportHandle1 should be zero Dim ImportHandle2 As Integer = pdf.OpenImportFile(file2, pdf.kptOpen, "") Dim PageCount2 As Integer = pdf.GetInPageCount // ImportHandle1 should be one Dim page As Integer = 1 While page <= pageCount1 Or page <= pageCount2 // import a page If page <= pageCount1 Then Call pdf.ReOpenImportFile(ImportHandle1) Call pdf.ImportPDFPage(page) end if If page <= pageCount2 Then Call pdf.ReOpenImportFile(ImportHandle2) Call pdf.ImportPDFPage(page) End If page = page + 1 Wend pageCount = pdf.GetPageCount // write and close file Call pdf.CloseFile End Sub
Property pageCount As Integer
End Class
End Project

The items on this page are in the following plugins: MBS DynaPDF Plugin.

The biggest plugin in space...