« xDev Magazine 19.4 | Home | DynaPDF Starter inclu… »

Things you can do with DynaPDF

We like to show you what you can do with our DynaPDF features in our MBS FileMaker Plugin.


Please see the topics below and take a look on the relevant example projects once you downloaded our plugin.

Create New PDF from scratch

Start a new blank PDF and add content to it. Just call DynaPDF.Append to add a new page and then while the page is open, draw some content on it. This may involve setting color with DynaPDF.SetFillColor or DynaPDF.SetStrokeColor functions and calling drawing functions like DynaPDF.MoveTo and DynaPDF.LineTo to draw a line. With DynaPDF.Rectangle, DynaPDF.DrawArc, DynaPDF.Bezier123 and our other drawing functions, you may build complex vector graphics.

To write text you can use DynaPDF.WriteText for simple text. Or you use a function like DynaPDF.WriteStyledTextEx to fill in some styled text from FileMaker directly into a rectangle on the page.

You can play pictures with DynaPDF.InsertImage function right from a container or with DynaPDF.InsertImageFile from a picture file. But if the picture should be a barcode, please consider using DynaPDF.InsertBarcode function instead to get your code as vector graphics.

Load PDF documents

You can load PDF documents into memory. Either you use DynaPDF.OpenPDFFromContainer for a container value, which may be a container field or some variable. Or you have a file and then use DynaPDF.OpenPDFFromFile function to open it. After you loaded a PDF and then you can inspect it:

Extract text

Once you have a page or the whole PDF imported, you can use DynaPDF.ExtractText function to extract text from a page or multiple pages. A special possibility is to specify an area in a page and only extract the text from that area, e.g. to read an invoice number.

You can store text of the whole document or per page into fields and later search for this text. That is how our PDF Library example can provide search and find words and know which page they belong to.

See Extract Text.fmp12 and PDF Library.fmp12

Extract images

With DynaPDF.GetImageCount function you can query how many images you have in your current PDF document. Then loop over them with DynaPDF.GetImage and query various values for those images like width and height.

MBS( "DynaPDF.GetImage"; $PDF; $Index; "Picture"; "test.jpg"; "JPEG" )

And his provides you the picture as JPEG file and you can assign it to a container field to show.

See Extract Images.fmp12

Merge PDF documents

Since you can import pages from a PDF file, you may loop and import from various PDF documents. Just call DynaPDF.OpenPDFFromContainer or DynaPDF.OpenPDFFromFile multiple times for different input PDF documents. Then import the content as needed with DynaPDF.ImportPDFFile or DynaPDF.ImportPDFPage functions for each document. There is always only one open import PDF, so you may switch between different ones with opening a new import document.

You can also add pictures as PDF pages. While you can do it manually with DynaPDF.AppendPage and DynaPDF.InsertImage, we got a convenience function for you: DynaPDF.AppendImagePage. With DynaPDF.AppendImagePages you can easily pass a list of native file paths and we loop over them to insert them all as pages.

If you like to split a PDF into new PDFs for each page, check the split example. We simply loop over page count, import one page into each its own new document. And than save each PDF into a separate field or container.

If you like to have chapter marks, you can check our bookmark functions.

See Merge PDFs.fmp12, Merge PDFs to File.fmp12, Split PDF.fmp12, Picture to PDF.fmp12, Bookmarks.fmp12 and Scan with WIA to PDF.fmp12

Add pages numbers

You may have a document created already, then import it and start to edit pages. The DynaPDF.GetPageCount function tells how many pages you have, so you can loop over them and call DynaPDF.EditPage to edit a page. As in our examples you may best just use DynaPDF.WriteFTextEx to draw your page number left or right aligned within a text box on the bottom right or left of a page.

See Add Page Numbers.fmp12 and Personalized PDFs.fmp12

Add watermark

You can use the same function as DynaPDF uses internally for the demo watermark in your own PDFs. So if you like to have a blue "PRIVATE" or "UNDER NDA" text on the page, you can set the color and use our DynaPDF.WriteDemoText function.

Since we can also do transparency for text or images, your watermark can be any text or image placed on the pages with high transparency. You may even place invisible text on a page to include information like the name of the user, who downloaded a confidential PDF, so you can identify it later.

See Watermark pages.fmp12 and Personalized PDFs.fmp12

Add links to pages or websites

When you merge PDFs, you may want to add an index page like in our merge example database. Once you draw the index page and you know where you draw the names and which page to jump to, you can add link annotations with DynaPDF.PageLink function. Since you may not yet know where to jump to, please use named destinations. You define a link with DynaPDF.PageLinkEx function to a named destination named e.g. "document1". Later when you add the pages for that, you add a named destination with DynaPDF.CreateNamedDest function.

If you use table functions to create the index page, you may use DynaPDF.CreateNamedDest, DynaPDF.CreateGoToActionEx and DynaPDF.Table.SetCellAction together. This creates the named destination, the go to action and then puts it in the cell to react on clicks. the big advantage is that you can merge documents and build the table while you loop the records. Once you merged all and your table is correct, you insert new pages on the beginning to output the table.

See Add Weblinks.fmp12 and "Merge with Table Of Content" script in Merge PDFs.fmp12

Draw styled text and multi page text

You can convert styled text from FileMaker format to the format needed in DynaPDF and output the text on a PDF page. And you can have text output over multiple pages with a calculation expression to decide what to do when the current box is full. Like you can decide to continue on a second column on the page. Or you create a new page and continue there.
MBS FileMaker Plugin with Styled Text to PDF
See Live Styled Text.fmp12, Styled Text.fmp12, WriteFText.fmp12 and Multi Column Output.fmp12

Render pages and previews

Instead of showing the full PDF in an interactive container and download the PDF every time someone goes to a record, you may just show a preview of the first page as picture. That may be much faster to show and produces less load on the server. And people may not export/print the PDF from the preview.

Use DynaPDF.GeneratePreview as a lightweight function to quickly get a preview for the PDF document. Or render various pages with DynaPDF.RenderPage function like our PDF Library example does. That way you can browser FileMaker records to see the various pages. Rendered pages may also get rendered with CMYK or in lower/higher resolution.

See Generate Previews.fmp12, PDF Library.fmp12, DynaPDF Batch Preview.fmp12 and Render Page.fmp12

Replace pictures

You may place pictures on a PDF page. But if you use a template PDF from your users, you may replace images. For example a real estate agency may have some fancy design, where some pictures of a house is shown with a framing picture on top. Then you may put in a default picture and use DynaPDF.ReplaceImage function to replace with with the actual picture you like to use.

See Replace Image.fmp12

Optimize PDF documents

File sizes for PDFs created in FileMaker may high. Images embedded may have higher resolution than desired and there may be duplicate content (pictures or fonts) embedded. Or for a template document, the designer used Indesign or Adobe Illustrator and those include extra information used for editing. All those things can be reduced and so the DynaPDF.Optimize function may produce a much smaller PDF document. You can define how to scale down images and compress them as JPEG. We usually only take high res pictures and lower them to maximum 150 dpi for PDF documents sent via email.

See Optimize PDF.fmp12

Create PDF documents in PDF/A format

If you have a DynaPDF Lite license, you can create blank new PDF documents in PDF/A format and use DynaPDF.CheckConformance function. If you like to convert any PDF to PDF/A, please buy a Pro license and the PDF/A converter add-on to DynaPDF from us. The PDF document you loaded can then be converted and fixed to be a valid document for the PDF/A version you need.

See Create Text as PDFA.fmp12 and Convert to PDFA.fmp12

Create invoices with Factur-X and ZUGFeRD

There exists several standards for digital invoices with PDF for print and an embedded XML file for automatic processing. DynaPDF supports ZUGFeRD in various versions from 1.0 to 2.1 currently as well as Factur-X. You can apply our sample script to create such an invoice and use your own PDF template and build the XML for the invoice to include it with DynaPDF functions.

See ZUGFeRD examples.

Work with form fields

You can create form fields on a page. Then you can set the values for the form fields. You could also load a government issued PDF and fill the values and send it back to the government. Or send a PDF with form fields to your clients, have them fill it and when you get back use DynaPDF to read the form values and put them into your database.

We can also work with newer XFA forms using XML definitions. But we still prefer traditional PDF forms.

See Form.fmp12, Create Form.fmp12, Create PDF with sum form field.fmp12, Fill Form Fields.fmp12, Show PDF Fields.fmp12, List XFA Streams.fmp12 and List XFA Fields.fmp12

Crypographically sign a PDF

When you create PDF documents, you can digital sign them with your digital certificate, e.g. a PKCS#12 file. Your PDF is then sealed and the receiver of the PDF can verify that you signed it and the PDF was not altered.

And for the validation of the signature, you can place your own badge on the PDF where the Adobe Reader will show a checkmark in green if signature is valid or a red cross if not. You can customize this appearance.



You may also do form fields to take signatures in Adobe Reader. See DynaPDF.CreateSigField function.

See Signature Appearance.fmp12

Print PDF

You can use DynaPDF.Print function on Windows to send a PDF to a printer directly. For macOS and iOS, check our PDFKit functions.

To customize the printing, you can only import the pages you like to print into the current PDF. And you may use print dialogs optionally or load settings you saved before. This is great to print on a Windows server with a local printer in your network. Think about having created an invoice in FileMaker Go. Then you run a PSoS script on the server to make a PDF of the record and pass it to DynaPDF to send to the printer.

See Print PDF.fmp12 and Print PDF with options.fmp12

Place PDF pages

The DynaPDF.PlaceTemplate function in DynaPDF Pro is very powerful. You can take an existing PDF and place it on a new PDF. This way you can do things like placing two or four pages next to each other on a new page. You can also place one page (with transparent background) on top of another page as in our letter paper example.

You can rotate the coordinate system to rotate the page. That is what our DynaPDF.RotateTemplate function conveniently for you.

When you output the new template on a page, you can choose the size and position. This way you can place different templates on a big page. For example you can create your own imposition software to place lots of pages on a printing page.

See Convert to 2 Pages.fmp12, Apply Letter Paper to PDF.fmp12, Shrink PDF pages.fmp12 and DynaPDF PlaceTemplate.fmp12

Barcodes

DynaPDF can draw barcodes on a PDF page as vector graphics. This has advantages over placing an image with a barcode as it is always sharp at any resolution. And you can CMYK black to draw the barcode and have it print perfectly in black and white.

We have an example for QR-Codes used in Switzerland for payments. And one of our blog posts shows how to make an EPC, the European Payment Code. If you place those codes on the invoices, you can make sure your users can use them and get payments done correctly. Like you specify the destination bank account and the subject line, so you can better match payments to invoices. See Generate EPC-QR-Code in FileMaker.

See DynaPDF Barcodes.fmp12 and Swiss QRCode.fmp12

More

There is even much more like highlighting text on a page, comparing two pages visually, replacing text, extracting attachments, cropping PDF pages and much more.
Try our examples or look through the function names. You may test without a license key or with a MBS trial license.

Please don't hesitate to contact us with your questions.
02 07 21 - 14:56