|
1 | | -==================== |
2 | | -Dynamic text in PDFs |
3 | | -==================== |
| 1 | +.. _Adobe: https://helpx.adobe.com/acrobat/desktop/work-with-pdf-forms/create-forms/convert-to-forms.html |
| 2 | + |
| 3 | +================================ |
| 4 | +Configuring dynamic text in PDFs |
| 5 | +================================ |
4 | 6 |
|
5 | 7 | While creating custom PDFs for quotes, use *dynamic text* for Odoo to auto-fill the PDF content with |
6 | 8 | information related to the quote from the Odoo database, like names, prices, etc. |
7 | 9 |
|
8 | 10 | Dynamic text values are form components (text inputs) that can be added in a PDF file, and Odoo |
9 | 11 | automatically fills those values in with information related to the quote. |
10 | 12 |
|
11 | | -Dynamic text values |
12 | | -=================== |
| 13 | +Design tips |
| 14 | +=========== |
| 15 | + |
| 16 | +When designing the base PDF template for a quote’s header or footer, keep the dynamic text placement |
| 17 | +in mind. Use the following tips to avoid overlapping text and poor design: |
| 18 | + |
| 19 | +* **Leave Whitespace**: Ensure there is enough room for dynamic data to expand without overlapping |
| 20 | + logos or borders. |
| 21 | +* Place dynamic fields, like Customer Name, on their own lines. Alternatively, put them at the end |
| 22 | + of phrases to avoid text breaking. Long names can push static text out of alignment. |
| 23 | +* **Set a default font**: Configuring a universally available default font maintains a consistent |
| 24 | + text appearance when adding or editing content. |
| 25 | + |
| 26 | +Edit PDF forms with Adobe software. Form fields in header and footer templates are required to |
| 27 | +retrieve dynamic values in Odoo. |
| 28 | + |
| 29 | +.. tip:: |
| 30 | + If the PDF is too large for email, try using "System Fonts" (Arial, Helvetica, Times New Roman) |
| 31 | + instead of custom Google fonts to avoid large embedded file sizes. |
| 32 | + |
| 33 | +Prepare the dynamic text fields |
| 34 | +=============================== |
| 35 | + |
| 36 | +To add dynamic text fields to a PDF, open the preferred PDF editor, like Adobe Acrobat Pro or |
| 37 | +Scribus. |
| 38 | + |
| 39 | +Adobe Acrobat Pro |
| 40 | +----------------- |
| 41 | + |
| 42 | +First, `convert the PDF into a PDF form <Adobe_>`_. Then add a text field at the location where the |
| 43 | +Odoo information needs to be displayed. Link the Odoo variables to the text fields by |
| 44 | +double-clicking on the field to open :guilabel:`Properties`. |
| 45 | + |
| 46 | +In the :guilabel:`General tab`, enter the Odoo field variable for the :guilabel:`Name`. Set the |
| 47 | +:guilabel:`Common Properties` to :guilabel:`Visible` unless the field needs to be hidden until data |
| 48 | +is populated. |
| 49 | + |
| 50 | +Next, click the :guilabel:`Appearance` tab` and select the :guilabel:`Font Size`, :guilabel:`Font |
| 51 | +Choice`, and :guilabel:`Text Color` to match the template's existing text or branding. Click the |
| 52 | +:guilabel:`Options` tab and set the text alignment to match the template’s design. |
| 53 | + |
| 54 | +.. tip:: |
| 55 | + Refer to the Common dynamic text values section for usual Odoo field variables. Users can also |
| 56 | + enable :ref:`developer-mode` in Odoo and hover over the desired field. |
| 57 | + |
| 58 | +General PDF editor instructions |
| 59 | +------------------------------- |
| 60 | + |
| 61 | +Open the desired PDF in the chosen PDF editor app. Then add a text field at the location where the |
| 62 | +Odoo information needs to be displayed. Link the Odoo variables to the text fields by opening the |
| 63 | +field’s :guilabel:`Properties` window. Then, in the :guilabel:`Name` for that field, enter the Odoo |
| 64 | +variable. |
| 65 | + |
| 66 | +If possible, configure the :guilabel:`Font Size`, :guilabel:`Font Choice`, and :guilabel:`Text |
| 67 | +Color` to match the template's existing text or branding. Click the :guilabel:`Options` tab and set |
| 68 | +the text alignment to match the template’s design. |
| 69 | + |
| 70 | +Common dynamic text values |
| 71 | +========================== |
13 | 72 |
|
14 | 73 | Below are common dynamic text values used in custom PDFs that are already mapped to the correct |
15 | 74 | fields, and what they represent. |
@@ -38,6 +97,9 @@ For product PDF: |
38 | 97 | - :guilabel:`tax_excl_price`: Tax Excluded Price |
39 | 98 | - :guilabel:`tax_incl_price`: Tax Included Price |
40 | 99 |
|
| 100 | +Link the uploaded PDF to Odoo |
| 101 | +============================= |
| 102 | + |
41 | 103 | After uploading a PDF, you can then :guilabel:`Configure dynamic fields`. This will allow you to map |
42 | 104 | any field name found in your PDF to the field you want to show by writing down any existing path. |
43 | 105 | Headers and footers starts from the current :guilabel:`sale_order` model, whereas product document |
|
0 commit comments