Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

 

MergedPDFs.jpg

We got a new example database for MBS FileMaker Plugin to show how to merge PDFs. One of the feature beside adding page numbers is to build a table of contents for the document with clickable entries:

Set Variable [ $pdf ; Value: MBS("DynaPDF.New") ] 

#

# create dummy page for table

Set Variable [ $r ; Value: MBS("DynaPDF.AppendPage"; $pdf) ] 

Set Variable [ $r ; Value: MBS("DynaPDF.EndPage"; $pdf) ] 

# create table for index

Set Variable [ $r ; Value: MBS("DynaPDF.SetPageCoords"; $pdf; "TopDown") ] 

Set Variable [ $table ; Value: MBS("DynaPDF.Table.Create"; $pdf; 10; 2; 500; 20) ] 

Set Variable [ $r ; Value: MBS("DynaPDF.Table.SetFont"; $table; -1; -1; "Helvetica"; 0; 1; "unicode") ] 

Set Variable [ $r ; Value: MBS("DynaPDF.Table.SetFontSize"; $table; -1; -1; 14) ] 

Set Variable [ $r ; Value: MBS( "DynaPDF.Table.SetColWidth"; $Table; 0; 450; 1 ) ] 

Set Variable [ $r ; Value: MBS( "DynaPDF.Table.SetColWidth"; $Table; 1; 50;1 ) ] 

# Build Table Of Contents

Go to Record/Request/Page [ First ]

Set Variable [ $destPage ; Value: 2 ] 

Loop

# open PDF

If [ not IsEmpty ( Merge PDFs::InputPDF ) ] 

Set Variable [ $r ; Value: MBS("DynaPDF.OpenPDFFromContainer"; $pdf; Merge PDFs::InputPDF) ] 

If [ MBS("IsError") ] 

Show Custom Dialog [ "Failed to open PDF." ; $r ] 

Exit Script [ Text Result:    ] 

End If

Else If [ not IsEmpty ( Merge PDFs::InputPath ) ] 

Set Variable [ $r ; Value: MBS("DynaPDF.OpenPDFFromFile"; $pdf; Merge PDFs::InputPath) ] 

If [ MBS("IsError") ] 

Show Custom Dialog [ "Failed to open PDF." ; $r ] 

Exit Script [ Text Result:    ] 

End If

Else

# no PDF?

End If

# check if we have pages to import

Set Variable [ $pageCount ; Value: MBS( "DynaPDF.GetImportPageCount"; $PDF ) ] 

If [ $pageCount > 0 ] 

Set Variable [ $lastPage ; Value: MBS("DynaPDF.ImportPDFFile"; $pdf; $destpage) ] 

If [ GetAsNumber($lastPage) >0 ] 

# put in a named destination for this new page

Set Variable [ $NamedDest ; Value: "Record" & Get(RecordID) ] 

Set Variable [ $NamedDestHandle ; Value: MBS( "DynaPDF.CreateNamedDest"; $PDF; $NamedDest; $DestPage; "Fit") ] 

# add table entry

Set Variable [ $rowNum ; Value: MBS("DynaPDF.Table.AddRow"; $table) ] 

Set Variable [ $r ; Value: MBS("DynaPDF.Table.SetCellText"; $table; $rowNum; 0; "left"; "top"; Merge PDFs::InputName) ] 

Set Variable [ $r ; Value: MBS("DynaPDF.Table.SetCellText"; $table; $rowNum; 1; "right"; "top"; $destPage) ] 

# add click action

Set Variable [ $Action ; Value: MBS( "DynaPDF.CreateGoToActionEx"; $PDF; $NamedDestHandle) ] 

Set Variable [ $r ; Value: MBS( "DynaPDF.Table.SetCellAction"; $Table; $rowNum; 0; $action; "Invert" ) ] 

Set Variable [ $r ; Value: MBS( "DynaPDF.Table.SetCellAction"; $Table; $rowNum; 1; $action; "Invert" ) ] 

Set Variable [ $destPage ; Value: $lastPage + 1 ] 

End If

End If

# optionally close import files

Set Variable [ $r ; Value: MBS("DynaPDF.CloseImportFile"; $pdf) ] 

# next file

Go to Record/Request/Page [ Next ; Exit after last: On ]

End Loop

# Draw Table

Set Variable [ $r ; Value: MBS("DynaPDF.EditPage"; $pdf; 1) ] 

Set Variable [ $r ; Value: MBS("DynaPDF.Table.Draw"; $table; 50; 50; 742) ] 

Set Variable [ $r ; Value: MBS("DynaPDF.EndPage"; $pdf) ] 

# show final PDF

Set Field [ Merge PDFs::FinalPDF ; MBS("DynaPDF.Save"; $pdf; "Merged.pdf") ] 

Set Variable [ $r ; Value: MBS("DynaPDF.Release"; $pdf) ] 

 

The example file will be included in the next plugin prerelease of MBS FileMaker Plugin. Please do not hesitate to contact us with questions.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.