Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
DynaPDF.Print
Prints the PDF file that is currently in memory.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
DynaPDF | 5.4 | ❌ No | ✅ Yes | ❌ No | ✅ Yes, on Windows | ❌ No |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
The PDF reference returned from DynaPDF.New. | |||
PrinterName | Printer name. Ignored if dialog is shown. See Printer.PrinterNames functiomn for printer names. If empty, we take it from printer settings. |
"myPrinter" | Optional |
TempPath | The path to temporary folder. Can be empty for default folder. |
"" | Optional |
DocName | The name of the print job. | "My PDF Print" | Optional |
PrintFlags | The flags for printing. Can be a combination of Default, 1bit, Color, AutoRotateAndCenter, PrintAsImage or ShrinkToPrintArea. Can be just the text name of an option or the sum of the numbers. |
"Color" | Optional |
MarginLeft | The margin for the left for the page. Pass zero if you don't need an extra margin. |
Optional | |
MarginTop | The margin for the top for the page. | Optional | |
MarginRight | The margin for the right for the page. | Optional | |
MarginBottom | The margin for the bottom for the page. | Optional | |
ShowDialog | Available in MBS FileMaker Plugin 6.5 or newer. Whether to show dialog. Default is 0 as we want no dialog. Pass 1 to show a dialog here. |
0 | Optional |
MaxRes | The maximum resolution to use. If value is zero or empty, we use default print resolution. |
300 | Optional |
Result
Returns OK or error.
Description
Prints the PDF file that is currently in memory.At time of publication the function is implemented on Windows only and pages are printed as image.
The parameter DocName is optional but should be set if possible. The document name is set to "out" if no name is provided.
Output color format
It is possible to determine which color formats a printer supports as input, but it is not possible to determine whether a printer outputs black & white, gray shades, or color. The default should be set to gray or 1 bit but the user should be able to configure the color format.
Maximum output resolution
The maximum output resolution is 600 DPI to restrict the memory usage and to reduce the amount of data that must be send to the printer.
Name | Value | Description |
Default | 0 | Gray printing |
1Bit | 1 | B/W printing. Recommended for b&w printers |
Color | 2 | Color printing |
AutoRotateAndCenter | 4 | Rotate and center pages if necessary |
PrintAsImage | 8 | Default on Windows |
ShrinkToPrintArea | 16 | Useful if a page contains no margins |
PrintPageAsIs | 256 | Print page as is, ignoring paper size. |
Please use PDFKit.Print for macOS.
If you only want to print a selection of pages, please only import those pages via DynaPDF.ImportPDFPage function. Or use DynaPDF.DeletePage to remove the pages you don't want to print.
Requires DynaPDF Pro license.
For all image operation, it is recommended to initialize color management with DynaPDF.InitColorManagement function.
See also Print function in DynaPDF manual.
Examples
Prints a PDF to printer
MBS( "DynaPDF.Print"; $PDF; "MyPrinter")
Import PDF and print:
#Initialize DynaPDF if needed
If [MBS("DynaPDF.IsInitialized") ≠ 1]
Perform Script [“InitDynaPDF”]
End If
#Clear current PDF document
Set Variable [$pdf; Value:MBS("DynaPDF.New")]
#Load PDF from container
Set Variable [$r; Value:MBS("DynaPDF.OpenPDFFromContainer"; $pdf; Print PDFs::InputPDF)]
Set Variable [$r; Value:MBS("DynaPDF.ImportPDFFile"; $pdf; $destpage)]
#Print
Set Variable [$r; Value:MBS("DynaPDF.Print"; $pdf; Print PDFs::Printer Name; 2+4+16)]
#Cleanup
Set Variable [$r; Value:MBS("DynaPDF.Release"; $pdf)]
Print with dialog:
MBS("DynaPDF.Print";
$pdf;
""; // printer name
""; // temp path
""; // job name
"Default"; // options
""; // margins
"";
"";
"";
1) // show dialog
Print with portrait:
Set Variable [ $Flags ; Value: 16 ]
Set Variable [ $ShowDialog ; Value: 0 ]
Set Variable [ $r ; Value: MBS( "DynaPDF.Print.SetSetting"; "PaperSize"; 9) // A4 210 x 297 mm ]
Set Variable [ $r ; Value: MBS( "DynaPDF.Print.SetSetting"; "Orientation"; 1) // Portrait ]
Set Variable [ $r ; Value: MBS( "DynaPDF.Print.SetSetting"; "PrinterName"; "Microsoft Print to PDF") ]
Set Variable [ $r ; Value: MBS("DynaPDF.Print"; $pdf; ""; ""; ""; $Flags; ""; ""; ""; ""; $ShowDialog) ]
See also
- DynaPDF.List
- DynaPDF.Print.FormNames
- DynaPDF.Print.GetDevMode
- DynaPDF.Print.GetDevNames
- DynaPDF.Print.GetSetting
- DynaPDF.Print.SetDevMode
- DynaPDF.Print.SetDevNames
- DynaPDF.Print.SetSetting
- PDFKit.Print
- Printer.PrinterNames
Release notes
- Version 11.5
- Added DynaPDF.Print.FormNames function to get list of form names for printer on Windows.
- Improved DynaPDF.Print.SetSetting to make it work better.
- Version 11.4
- Added DynaPDF.Print.GetSetting and DynaPDF.Print.SetSetting functions.
- Improved threading for DynaPDF.Print functions to store settings per thread to avoid potential threading issues.
- Version 10.5
- Changed DynaPDF.Print to tell printer dialog that we are okay with collate and copies, so that option may get enabled on supporting printer drivers.
- Version 9.1
- Added MaxRes Parameter for DynaPDF.Print function.
- Version 8.4
- Changed DynaPDF.Print to get default printer, if you pass empty printer name.
- Improved DynaPDF.Print to use the device mode set with DynaPDF.Print.SetDevMode even if no dialog is used.
- Version 8.2
- Added checks to DynaPDF.Optimize, DynaPDF.Print and DynaPDF.Save to complain if no pages are in document.
- Version 8.0
- Fixed bugs with DynaPDF.Print and scaling pages for some printers.
- Version 7.0
Example Databases
Blog Entries
- MBS @ FMTraining.TV - Printing in FileMaker with the MonkeyBread Plug-in
- Top 10 from the MBS Plugin in 2022
- MBS FileMaker Plugin 12.3
- New error log functions for FileMaker
- Things you can do with DynaPDF
- New in MBS FileMaker Plugin 10.5
- MBS FileMaker Plugin 10.5 - More than 6400 Functions In One Plugin
- Print PDF dialog with copies and collate options
- Combine MBS functions to automate processes in FileMaker
- MBS FileMaker Plugin 5.4 for OS X/Windows
FileMaker Magazin
This function is free to use.
Created 21st October 2015, last changed 3th April 2024