Example: /DynaPDF/Interlace PDFs

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

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"
FileTypes
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.


💬 Ask a question or report a problem