annual_school_census_pdf_survey_user_manual
                Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| annual_school_census_pdf_survey_user_manual [2024/11/11 03:40] – created ghachey | annual_school_census_pdf_survey_user_manual [2024/11/11 04:05] (current) – [PDF Intricacies Notes and Primer] ghachey | ||
|---|---|---|---|
| Line 23: | Line 23: | ||
| </ | </ | ||
| + | ===== PDF Intricacies Notes and Primer ===== | ||
| + | |||
| + | <note tip>The following is a rather technical discussion that arose due to some visual issues we encountered in the legacy PDF survey templates when trying to correct a flaw in it. It is unlikely to be knowledge commonly used and needed in the future but is kept here for historical purposes and it may perhaps be useful.</ | ||
| + | |||
| + | These two objects are pair of OnStaff checkboxes: | ||
| + | |||
| + | < | ||
| + | 15772 0 obj | ||
| + | |||
| + | <</ | ||
| + | |||
| + | endobj | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | 15773 0 obj | ||
| + | |||
| + | <</ | ||
| + | |||
| + | endobj | ||
| + | </ | ||
| + | |||
| + | the Property /AP is the appearance dictionary: | ||
| + | |||
| + | < | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | It in turn has properties pointing to two subjects /D (down appearance) /N (normal appearance). Within those are the possible values for the checkbox: this one can be either Y or Off. The objects 18786 18794 18783 and 18781 are the actual drawing routines for these possibilities. | ||
| + | |||
| + | e.g. here’s 18781 which draws the green tick: | ||
| + | |||
| + | < | ||
| + | 18781 0 obj | ||
| + | <</ | ||
| + | 3 w | ||
| + | 0.50196 0.50196 0.50196 RG | ||
| + | 0.98828 0.95703 0.89844 rg | ||
| + | 0 0 20 20 re | ||
| + | B | ||
| + | BT | ||
| + | /F1 18 Tf | ||
| + | 0 0.50196 0 rg | ||
| + | 4 4 Td | ||
| + | (4)Tj | ||
| + | ET | ||
| + | endstream | ||
| + | endobj | ||
| + | </ | ||
| + | |||
| + | This AP dictionary is what is set for each Checkbox in the StandardiseCheckboxes code. | ||
| + | |||
| + | Now if you choose the Preference option, these /AP entries are effectively ignored, and Acrobat (or whatever reader you are using that offers similar functionality) attempts to draw the checkbox using your preferred backcolor, and border. | ||
| + | |||
| + | In MK you can put /BC – border color and /CA – caption or text. | ||
| + | |||
| + | Here’s /MK for the Tick checkbox: | ||
| + | |||
| + | < | ||
| + | MK<</ | ||
| + | </ | ||
| + | |||
| + | The caption 4 is the Dingbat character for the Tick. | ||
| + | |||
| + | One thing you can’t set in /MK is the Text Color, so we don’t actually get a green tick anymore if using this “dynamic” rendering based on the preferences. | ||
| + | |||
| + | But, I have modified Standardise Checkboxes to create all these /MK dictionaries with /CA pointing to the right character for the given checkbox, and /BC set to grey. | ||
| + | |||
| + | The pair of checkboxes now look like this: | ||
| + | |||
| + | < | ||
| + | 15772 0 obj | ||
| + | |||
| + | <</ | ||
| + | |||
| + | endobj | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | 15773 0 obj | ||
| + | |||
| + | <</ | ||
| + | |||
| + | endobj | ||
| + | </ | ||
| + | |||
| + | You can tell the N one from the Y by looking at: | ||
| + | |||
| + | * The keys in the /AP /N dictionary ( you see either /Y or/ N) | ||
| + | * The CA value in the /MK dictionary ( either 4 (tick) or 7 (cross) | ||
| + | |||
| + | This is a code change so you’ll need a code update to get this to work on your machine. | ||
| + | |||
| + | One other thing, itext allows you to save PDF with no compression so most of it (except images) is plain text. This make this level of debugging possible. | ||
| + | |||
| + | So the code you identified does set the Appearance Dictionary of each box, and these render correctly except when the Preferences force a “dynamic” render. | ||
| + | |||
| + | In that circumstance, | ||
| + | |||
| + | Prior to the changes last night, it would get the wrong icon for this, and you may be right – it takes the icon associated with the first of the two child widgets linked to the field. | ||
| + | |||
| + | This linkage fyi goes in both directions – via the parent element on the widget, which points to the field: | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | And via the Kids array of the field, which points to the widgets. | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | So with nothing better to go on, Acrobat was looking at the first Kid, and this was here it was making mistakes. | ||
| + | |||
| + | But now, when constructing the “dynamic” rendering, it can use the /MK Appearances Characteristics dictionary, to get the symbol, and border color: | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | With this information, | ||
| + | |||
| + | Small point, “dynamic rendering” is only used on the ‘Normal View’ of the widget, the Down view (ie mouse down) still uses the /D appearance in the /AP dictionary; this is why you get the darker grey background when the mouse is pressed. Also the Focus appearance uses the /N Normal appearance from the /AP dictionary even when “dynamic rendering” is on: this is why you’ll see a tick go green when you click, it, when it loses focus it turns black (ie swaps to the dynamic rendering. | ||
| + | |||
| + | In Acrobat the #0 #1 Is just a shorthand to enumerate the Kids array during editing. Its not recorded in the PDF. IT seems that it reflects the order in the Kids array: | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | In the pair 15816 15817 its 15816 that is N: | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | The parent 14808 of this OnStaff field is: | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | Ie that field is TL.04.OnStaff | ||
| + | |||
| + | But this ordering has no impact on the data collection as the expert values Y and N are correctly set on the left and right widgets. It can make a difference to the rendering, but the change I made last night to add /MK information is probably more robust. | ||
annual_school_census_pdf_survey_user_manual.1731296454.txt.gz · Last modified: 2024/11/11 03:40 by ghachey
                
                