Printing/Creating a PDF

Although the ability to print from a desktop computer, with a printer attached wirelessly or via a cable, is accepted and expected, it is not the same with mobile devices. There are options to print from mobile devices to wirelessly connected printers but many of these require a document to be created, saved and then printed.
To accommodate all the various scenarios, Evoke 'prints' to a PDF document, either stored on the local device, a central server or simply opened in the device/desktop PDF viewer. This gives the user the option of printing the document using the PDF print facility on the device, if a printer is available and connected, or saving the printouts/reports (locally or centrally) for printing when a printer is available.

Evoke provides the ability to PDF and print data and other information to PDF documents, as multi-page/Mutli records reports, sinngle page reports, documents or images, via Click Actions and for these PDF documents to be opened immediately, for printing from a mobile device or desktop computer, or may be saved to the device the app is running on/central server for batch printing later. These Click Actions can be used in the page menu, segment header menu, special Widgets or against any navigation option.
There are two seperate options to Print/PDF a document within Evoke. PDFfromSegment, to create a simple, single record document and PDFfromPage, a comprehensive report generator for singe or multi record data, that provides a "print preview" style option to the app developer:



PDFfromSegment - Printing one or multiple Data or Image Segments
To print/PDF one or more Segments of data/images/widgets from within the app, create either a header menu option or a navigation menu option in Pages.

The menu item should be associated with an Evoke click action and the 'ActionID' then be associated with the click action, PDF from Segment, to configure the creation of a PDF that contains selected segments on this and/or other Pages within the current Page Series.

When configuring the click action you can select the following PDF Save types:
  • Open only (open immediately within App)

  • SaveToServer (Save the generated PDF file to a server location)

  • SaveToServerAndOpen (Save the Generated PDF file to a server location and then open the PDF file)

  • SaveToLocal (Save the generated PDF file to a location on the client device)

  • SaveToLocalAndOpen (Save the generated PDF file to a location on the client device and then open the PDF file)

  • SaveToServerAndLocalAndOpen (Save the generated PDF file to a Server location and a location on the client device and then open the PDF file).

And also the Page Segment Widget ID(s) for the segments that you want to print.
When you select the Page Segment Widgets you must use the "build" button which will open a new configuration screen (see right).
On the Configuration screen you can select (in the green section of 'Page Segments with Widget IDs') any page segment, that has a Segment/Widget ID, to be included in this print action. If you want to include Page Segments from different Pages within this Page Series then select the relevant page from the drop down list of Pages.
If you do not see the segment that you want to include in the print action in the list you will need to add a "Segment/Widget ID" to the segment in the Pages/General tab area.
When you have selected the segment you want to include you can now use the 'Page Segment Printing Override Values' to reconfigure the sizing, styles and colours of the data being formatted on the PDF document. In addition to providing the 'style' that you want, these settings can be very useful if you have a lot of data to print, a datagrid with a lot of columns or a lot of segments to print.
When configuring the PDF/Print style/size settings you can select the following for each segment that you will include in the PDF:
General
  • Print visible only. If checked then any columns hidden by adaptation or access control will not be included in the PDF i.e. only what is displayed on the screen in a segment will appear in the PDF

Segment Sizing
  • Sizing - Sizing Method. This is the sizing type of the segment in the PDF e.g. All, Remainder, Auto or Fixed and will override the sizing method of the actual segment

  • Sizing - Size Value. This is the size of the segment in the PDF (in the context of the sizing method)

  • Child Segment Arrangement. Either Columns or Rows - defines how the segments in the PDF are to appear i.e. one abive the other or side by side.

  • Pixel Conversion Ratio. Used when resizing the text in the PDF using a conversion ratio for the text in a segment.

Font
  • Size (all content). This is the sizing type of the segment

  • Bold prompts. In the PDF include all prompts in bold.

  • Bold data. In the PDF include all data in bold.

  • Italic Prompts. In the PDF include all prompts in italic.

  • Italic data. In the PDF include all data in italic.

Margins (pixels)
  • Margin Top. The margin gap for the top of the selected segment in the PDF

  • Margin Bottom. The margin gap for the bottom of the selected segment in the PDF

  • Margin Left. The margin gap for the left of the selected segment in the PDF

  • Margin Right. The margin gap for the right of the selected segment in the PDF

Colors
  • Overall background. Pick a color from the app design's color pallettes to use for the overall background in of this segment in the PDF.

  • Header background. Pick a color from the app design's color pallettes to use for the header background in of this segment in the PDF.

  • Header Text. Pick a color from the app design's color pallettes to use for the header text in of this segment in the PDF.

  • Body Background. Pick a color from the app design's color pallettes to use for the body background in of this segment in the PDF.

  • Body Text. Pick a color from the app design's color pallettes to use for the body text in of this segment in the PDF.




PDFfromPage - Printing/PDFing any data or a whole datasource
If you wish to print/PDF more than one or two segments, wish to print/PDF a multi record report, add headers/footers to your report or see a "print preview" style view of the document/Print you are creating then the click action PDFfromPage provides the best option.
A PDF (or print) or a document such as a timesheet (see image right) can be prepared by creating a new page, in your Evoke App design, that will be the "Template" for your document but is unseen as a page by your app users.
Your template page can have as many segments as you wish and is built up by you as a unique PDF template in just the same way as you would build a user screen within your app. The main thing to consider is that the datasources on the "template" page need to be populated with the data that you wish to display. Many Evoke app designers find that the Segment clone/Segment set clone options in the Adjust menu can be very useful to copy/paste segments and their associated datasources from other pages.
You can then use a call to the the click action "PDFfromPage" (see image below left) to create the PDF document, setting the options shown:
Use portrait orientation allows you to set if the PDF your user is creating is either landscape of portrait orientation.
Content source page is the template page you have created. You can pick this from the dropdownlist picker.
Datasource list allows you to pass in a pre-populated datasource containing multiple records (that match the template) that will be PDF'd / printed one after the other.
Font size reduction provides an option to reduce the standard font size/spacing on the PDF from that you would see on a screen. Sometimes you need a very detailed report/document that would not fit on a normal size sheet of paper/PDF document. Defaulting to 0% (no reduction), the dropdown list allows you to pick options tha reduces the font size on the PDF by up to 25%.
Header/Footer Segment - with PDFfromPage, if you want to have a header and a footer that repeat on each page of a multi-page document then you can define segements here for the header/footer. The dropdown list will offer the names (segment ids) of the available segments in this page series.
Save Type - When configuring the click action you can select the following PDF Save types:
  • Open only (open immediately within App)

  • SaveToServer (Save the generated PDF file to a server location)

  • SaveToServerAndOpen (Save the Generated PDF file to a server location and then open the PDF file)

  • SaveToLocal (Save the generated PDF file to a location on the client device)

  • SaveToLocalAndOpen (Save the generated PDF file to a location on the client device and then open the PDF file)

  • SaveToServerAndLocalAndOpen (Save the generated PDF file to a Server location and a location on the client device and then open the PDF file).

When defining the click action, to trigger a PDFfromPage, the 'ActionID' can then be associated with the click action, PDF from Page to create a PDF formatted via the template page (image right).


Page Numbers - you can add Page Numbers in your PDFs by including a template in your Footer that has a property that includes {PageIndex} and {PageTotal}. For example an Entity property of AlphaNumeric with a value of "Page {PageIndex} of {PageTotal}" will, when included in a footer, generate "Page n of 6" etc. on each page of your PDF (where n is the actual page number).