luigi scarso wrote:
On 4/10/06, Hans Hagen wrote:
luigi scarso wrote:
I have downloaded
http://partners.adobe.com/public/developer/en/xml/formcalc_2.0.pdf
If I have understand it FormCalc seem to be a simple script language
Seem that Acrobat 7.0 can do this, but I'm not sure;
asap I try to make an example.
i played with xfa stuff some time ago; it boils down to sending an xml file to acrobat with a ref to a pdf file and additional form data; so maybe the form calc code stays outside the pdf file in a parallel file
I have put a simple example under
http://www.logosrl.it/context/test/tex.pdf
It was done with Designer; it is
var Quantity=100
(I wasn't able to make uncompress vers. for pdf 1.6, so I downgraded to 1.5)
It seem that xml data are embedded into pdf.
as far as i can see it boils down to embedding a bunch of xml snippets (none of which is valid xml in itself) and add an /XFA entry to the Acroform dictionary in the Catalog; no big deal; the plugin reassembles the embedded files to something valid xml and then does something with it, probably depending on the javascript;
(looks like a real mess of mixing javascript and another language; i wonder why they didn't use javascript for everything; maybe the xml hype stroke 'm)
So, here's something rather preliminary to play with ... (use / in filenames)
\unprotect
\def\startembed
{\bgroup
\catcode`\%=\other
\dodoubleargument\dostartembed}
\long\def\dostartembed[#1][#2]#3% let's gobble the next space, else
{\dodostartembed[#1][#2]#3} % we get a space before <?xml
\long\def\dodostartembed[#1][#2]#3\stopembed
{\immediate\pdfobj stream attr {/Type /EmbeddedFile} {#3}%
\edef\temp{\executeifdefined{embedded:#1}{ }}%
\setxvalue{embedded:#1}{\temp (#2) \the\pdflastobj\space0 R }%
\egroup}
\def\embeddednames#1%
{\executeifdefined{embedded:#1}{}}
\def\flushFDFnames
{\ifbuildFDFdictionary
\ifx\FDFcollection\empty\else
\ifbuildFDFencodingvector
\doPDFdictionaryobject class FDF name local:encodingvector data
\FDFencodingvector
\fi
\defineFDFfonts
\doPDFarrayobject class FDF name local:fields data \FDFcollection
\doPDFarrayobject class FDF name local:xfa data {\embeddednames{xfa}}%
\doPDFgetobjectreference{FDF}{local:fields}\PDFobjectreferenceA
\doPDFgetobjectreference{FDF}{local:xfa}\PDFobjectreferenceB
% The /NeedAppearances is pretty important because
% otherwise Acrobat 5 blows up on cloned radio widgets
\doPDFdictionaryobject class FDF name local:acroform data
{/Fields \PDFobjectreferenceA\space
/XFA \PDFobjectreferenceB\space
/NeedAppearances true
\doFDFiffieldset\PDFcalculationset{/CO [\doFDFgetfieldset\PDFcalculationset]}
/DR << /Font << \FDFfonts >> >>
/DA (/Helv 10 Tf 0 g)}%
\doPDFgetobjectreference{FDF}{local:acroform}\PDFobjectreference
\doPDFaddtocatalog
{/AcroForm \PDFobjectreference}%
\global\let\FDFcollection\empty
\global\let\flushFDFnames\relax
\fi
\fi}
\protect
\startembed[xfa][preamble]
<?xml version="1.0" encoding="UTF-8"?>
http://ns.adobe.com/xdp/">
\stopembed
\startembed[xfa][config]
<config xmlns="http://www.xfa.org/schema/xci/1.0/" xmlns:xfa="http://www.xfa.org/schema/xci/1.0/"><trace><area level="1" name="font"></area></trace><agent name="designer"><!-- [0..n] --><destination>pdf</destination><pdf><!-- [0..n] --><fontInfo></fontInfo></pdf></agent><present><!-- [0..n] --><pdf><!-- [0..n] --><fontInfo><embed>1</embed></fontInfo><version>1.5</version><creator>Adobe Designer 7.0</creator><producer>Adobe Designer 7.0</producer><scriptModel>XFA</scriptModel><interactive>1</interactive><tagged>1</tagged><compression><level>6</level><compressLogicalStructure>1</compressLogicalStructure></compression></pdf><xdp><packets>*</packets></xdp><common><log><to>memory</to><mode>overwrite</mode></log><template><base>C:/Documents and Settings/luigi/Desktop/</base></template></common><destination>pdf</destination><output><to>uri</to><uri>C:/Documents and Settings/luigi/Desktop/test6.pdf</uri></output></present><agent name="acrobat"><common><locale></locale><data><incrementalLoad></incrementalLoad><adjustData></adjustData><xsl><uri></uri></xsl><outputXSL><uri></uri></outputXSL></data><template><base>C:/Documents and Settings/luigi/Desktop/</base><relevant></relevant><uri></uri></template></common></agent></config>
\stopembed
\startembed[xfa][template]
<template xmlns="http://www.xfa.org/schema/xfa-template/2.1/"><subform layout="tb" locale="it_IT" name="modulo1"><pageSet><pageArea id="Page1" name="Pagina1"><contentArea h="197.3mm" w="135.3mm" x="0.25in" y="0.25in"></contentArea><medium long="210mm" short="148mm" stock="a5"></medium></pageArea></pageSet><subform h="197.3mm" w="135.3mm"><field xmlns="http://www.xfa.org/schema/xfa-template/2.2/" h="38.1001mm" name="Campoditesto1" w="104.775mm" x="12.7mm" y="25.4mm"><ui><textEdit><border><?templateDesigner StyleID aped3?><edge stroke="lowered"></edge></border><margin></margin></textEdit></ui><font typeface="Arial"></font><margin bottomInset="1mm" leftInset="1mm" rightInset="1mm" topInset="1mm"></margin><para vAlign="middle"></para><caption reserve="28mm"><font typeface="Arial"></font><para vAlign="middle"></para><value><text>example</text></value></caption><event activity="initialize"><script>var Quantity=100</script></event></field></subform><proto></proto></subform><?templateDesigner DefaultLanguage FormCalc?><?templateDesigner DefaultRunAt client?><?templateDesigner Grid show:1, snap:1, units:0, color:ff8080, origin:(0,0), interval:(125000,125000)?><?templateDesigner Rulers horizontal:1, vertical:1, guidelines:1, crosshairs:0?><?templateDesigner Zoom 50?></template>
\stopembed
\startembed[xfa][datasets]
http://www.xfa.org/schema/xfa-data/1.0/">xfa:data<modulo1><Campoditesto1></Campoditesto1></modulo1>
\stopembed
\startembed[xfa][localsSet]
<localeSet xmlns="http://www.xfa.org/schema/xfa-locale-set/2.1/"><locale desc="Italiano (Italia)" name="it_IT"><calendarSymbols name="gregorian"><monthNames><month>gennaio</month><month>febbraio</month><month>marzo</month><month>aprile</month><month>maggio</month><month>giugno</month><month>luglio</month><month>agosto</month><month>settembre</month><month>ottobre</month><month>novembre</month><month>dicembre</month></monthNames><monthNames abbr="1"><month>gen</month><month>feb</month><month>mar</month><month>apr</month><month>mag</month><month>giu</month><month>lug</month><month>ago</month><month>set</month><month>ott</month><month>nov</month><month>dic</month></monthNames><dayNames><day>domenica</day><day>lunedì</day><day>martedì</day><day>mercoledì</day><day>giovedì</day><day>venerdì</day><day>sabato</day></dayNames><dayNames abbr="1"><day>dom</day><day>lun</day><day>mar</day><day>mer</day><day>gio</day><day>ven</day><day>sab</day></dayNames><meridiemNames><meridiem>AM</meridiem><meridiem>PM</meridiem></meridiemNames><eraNames><era>aC</era><era>dC</era></eraNames></calendarSymbols><datePatterns><datePattern name="full">EEEE D MMMM YYYY</datePattern><datePattern name="long">DD MMMM YYYY</datePattern><datePattern name="med">D-MMM-YYYY</datePattern><datePattern name="short">DD/MM/YY</datePattern></datePatterns><timePatterns><timePattern name="full">HH:MM:SS Z</timePattern><timePattern name="long">HH:MM:SS Z</timePattern><timePattern name="med">HH:MM:SS</timePattern><timePattern name="short">HH:MM</timePattern></timePatterns><dateTimeSymbols>GyMdkHmsSEDFwWahKzZ</dateTimeSymbols><numberPatterns><numberPattern name="numeric">z,zz9.zzz</numberPattern><numberPattern name="currency">$ z,zz9.99</numberPattern><numberPattern name="percent">z,zz9%</numberPattern></numberPatterns><numberSymbols><numberSymbol name="decimal">,</numberSymbol><numberSymbol name="grouping">.</numberSymbol><numberSymbol name="percent">%</numberSymbol><numberSymbol name="minus">-</numberSymbol><numberSymbol name="zero">0</numberSymbol></numberSymbols><currencySymbols><currencySymbol name="symbol">€</currencySymbol><currencySymbol name="isoname">EUR</currencySymbol><currencySymbol name="decimal">,</currencySymbol></currencySymbols></locale></localeSet>
\stopembed
\startembed[xfa][postamble]
\stopembed
\setupinteraction[state=start]
\starttext
\definefield[whatever][text]
\input tufte
\field[whatever]
\stoptext
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------