Jump to content
Server Maintenance This Week. ×

Multi Column Output for PDFs with FileMaker


This topic is 1191 days old. Please don't post here. Open a new topic instead.

Recommended Posts

For MBS FileMaker Plugin we recently added a new DynaPDF.SetPageBreakExpression function. Have you seen it? 
It allows you to define a page break expression. This calculation is evaluated when a text rectangle is filled with text and we need a new page or a new rectangle on the same page. 

Look on this sample database with three columns filled over many pages with one big text block:

multiColumn1.jpg

Here is a sample call for DynaPDF.SetPageBreakExpression: 

Set Variable [ $r ; Value: MBS("DynaPDF.SetPageBreakExpression"; $pdf; "Let ( [

$CurrentColumn = $CurrentColumn + 1;

t = If ( $CurrentColumn < $ColumnCount ; 

    Let ( [ 
        $PosX = $StartPosX + $CurrentColumn * ($ColumnWidth + $Distance) ]; 
    0) ; 

    Let ( [ 
        $PosX = $StartPosX; 
        $CurrentColumn = 0; 
        a = MBS( \"DynaPDF.EndPage\"; $pdf); 
        a = MBS( \"DynaPDF.AppendPage\"; $pdf)]; 
    0) 
);

a = MBS( \"DynaPDF.SetTextRect\"; $pdf; $PosX; $PosY; $ColumnWidth; $ColumnHeight )
]; 0 )") ]

As you see this calculation gets called when the text rectangle is filled. It uses a Let statement to compound multiple statements and first increases the CurrentColumn variable. If we have room left, we define a new rectangle for the column. Otherwise we end the page, start a new blank page and start with a first column again.

This page break calculation can be used with DynaPDF.WriteFText(Ex) function. But if you like to pass styled text directly from a FileMaker field, you an use  DynaPDF.WriteStyledText(Ex) function. In the following screenshot we put a FileMaker update announcement to layout it over the columns:

multiColumn2.jpg

For every call you can specify an alignment to start with. And on every calculation you can return a new alignment. We return zero above to keep the alignment, but we could also return 1 for left alignment, 2 for right alignment, 3 for center alignment or 4 for justify alignment. 

Finally note that you are not required to have the new rectangle right to the other. It can be anywhere on the page, so you can have multiple rectangles with space between, e.g. to place a picture.

Please don't hesitate to contact us if you have questions.

Link to comment
Share on other sites

  • 4 weeks later...
×
×
  • Create New...

Important Information

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