[latex3-commits] [git/LaTeX3-latex3-pdfresources] backendtest: more form fields (ba75e4f)
Ulrike Fischer
fischer at troubleshooting-tex.de
Sun Sep 8 19:12:13 CEST 2019
Repository : https://github.com/latex3/pdfresources
On branch : backendtest
Link : https://github.com/latex3/pdfresources/commit/ba75e4fa5e02f999d705b1f4b6ea21e5212f8c25
>---------------------------------------------------------------
commit ba75e4fa5e02f999d705b1f4b6ea21e5212f8c25
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Sun Sep 8 19:12:13 2019 +0200
more form fields
>---------------------------------------------------------------
ba75e4fa5e02f999d705b1f4b6ea21e5212f8c25
experiments/formpushfields.tex | 23 ++++++++
hgeneric-experimental.def | 116 ++++++++++++++++++++++++-----------------
2 files changed, 90 insertions(+), 49 deletions(-)
diff --git a/experiments/formpushfields.tex b/experiments/formpushfields.tex
new file mode 100644
index 0000000..0140b72
--- /dev/null
+++ b/experiments/formpushfields.tex
@@ -0,0 +1,23 @@
+% !Mode:: "TeX:DE:UTF-8:Main"
+\RequirePackage[enable-debug,check-declarations]{expl3}
+\RequirePackage[patches]{pdfresources}
+\DeclareDocumentMetaData{uncompress}
+\documentclass{article}
+\usepackage[customdriver=hgeneric-experimental]
+{hyperref}
+\begin{document}
+\begin{Form}%[NeedAppearances=false] %radio buttons don't like this ...
+[action=mailto:test at testnet.com,encoding=html, method=post]
+\TextField[charsize={10pt},multiline=true,height={5mm},width={5cm},name={text_info},bordercolor={0.2 0.2 0.7},default={}]{}
+
+\Submit{Submit}
+
+\TextField[charsize={10pt},multiline=true,height={5mm},width={5cm},name={text_info},bordercolor={0.2 0.2 0.7},default={}]{}
+\PushButton[onclick={this.exportAsText()}]{Submit}
+\end{Form}
+
+\end{document}
+\TextField[charsize={10pt},multiline=true,height={5mm},width={5cm},name={text_info},bordercolor={0.2 0.2 0.7},default={}]{}
+\PushButton[onclick={this.exportAsText()}]{Submit}
+\end{Form}
+\end{document}
diff --git a/hgeneric-experimental.def b/hgeneric-experimental.def
index 8219271..8811fd2 100644
--- a/hgeneric-experimental.def
+++ b/hgeneric-experimental.def
@@ -1250,15 +1250,20 @@
}
{
\HyField at FlagsPushButton
- \ifFld at hidden\def\Fld at width{1sp}\fi
+ \legacy_if:nT {Fld at hidden}
+ {
+ \def\Fld at width{1sp}
+ }
\LayoutPushButtonField
{
\mode_leave_vertical:
\HyAnn at AbsPageLabel
\Hy at escapeform\PDFForm at Push
- \pdf_link_user:nnn
- {widget} %perhaps we need more types
- {\PDFForm at Push}
+ \pdf_annotation:nnnn
+ {\Fld at width}
+ {\Fld at height}
+ {0pt} %is this correct?
+ {\PDFForm at Push}
{\MakeButtonField{#2}}
\HyField at AddToFields
}
@@ -1268,31 +1273,36 @@
\def\@Submit[#1]#2
{
- \def\Fld at width{\DefaultWidthofSubmit}
- \def\Fld at height{\DefaultHeightofSubmit}
- \group_begin:
- \exp_args:No\HyField at SetKeys
- {
- \DefaultOptionsofSubmit,#1
- }
- \HyField at FlagsPushButton
- \HyField at FlagsSubmit
- \ifFld at hidden\def\Fld at width{1sp}\fi
+ \def\Fld at width {\DefaultWidthofSubmit}
+ \def\Fld at height{\DefaultHeightofSubmit}
+ \group_begin:
+ \exp_args:No\HyField at SetKeys
+ {
+ \DefaultOptionsofSubmit,#1
+ }
+ \HyField at FlagsPushButton
+ \HyField at FlagsSubmit
+ \legacy_if:nT { Fld at hidden }
+ {
+ \def\Fld at width{1sp}
+ }
\mode_leave_vertical:
\HyAnn at AbsPageLabel
\Hy at escapeform\PDFForm at Submit
- \pdf_link_user:nnn
- {widget} %perhaps more types needed
+ \pdf_annotation:nnnn
+ {\Fld at width}
+ {\Fld at height}
+ {0pt} %is this correct?
{
\PDFForm at Submit
- /AP<<
+ /AP<<
/N~\pdf_xform_ref:n {__hyp_xform_Submit}~
/D~\pdf_xform_ref:n {__hyp_xform_SubmitP}
>>
}
{ \MakeButtonField{#2} }
- \HyField at AddToFields
- \group_end:
+ \HyField at AddToFields
+ \group_end:
}
\def\@Reset[#1]#2
@@ -1604,36 +1614,43 @@
\Fld at additionalactions
}
\ExplSyntaxOff
-\ifHy at pdfa
-\else
- \def\PDFForm at Push{%
- /Subtype/Widget%
- \Fld at annotflags
- \Fld at pageobjref
- \Fld at annotnames
- /FT/Btn%
- \Fld at flags
- /H/P%
- /BS<</W \Fld at borderwidth/S/\Fld at borderstyle>>%
- \ifcase0\ifnum\Fld at rotation=\z@ \else 1\fi
- \ifx\Fld at bordercolor\relax\else 1\fi
- \space
- \else
- /MK<<%
- \ifnum\Fld at rotation=\z@
- \else
- /R \Fld at rotation
- \fi
- \ifx\Fld at bordercolor\relax
- \else
- /BC[\Fld at bordercolor]%
- \fi
- >>%
- \fi
- /A<</S/JavaScript/JS(\Hy at escapestring{\Fld at onclick@code})>>%
- \Fld at additionalactions
- }%
-\fi
+\ExplSyntaxOn
+\legacy_if:nF { Hy at pdfa }
+ {
+ \def\PDFForm at Push
+ {
+ /Subtype/Widget
+ ~\Fld at annotflags
+ ~\Fld at pageobjref
+ ~\Fld at annotnames
+ /FT/Btn
+ ~\Fld at flags
+ /H/P
+ /BS<</W~\Fld at borderwidth/S/\Fld at borderstyle>>
+ \bool_if:nT
+ {
+ !\int_compare_p:nNn {\Fld at rotation} = {0}
+ ||
+ \tl_if_exist_p:N \Fld at bordercolor
+ }
+ {
+ /MK
+ <<
+ \int_compare:nNnF {\Fld at rotation} = {0}
+ {
+ /R~\Fld at rotation
+ }
+ \tl_if_exist:NT \Fld at bordercolor
+ {
+ /BC[\Fld at bordercolor]
+ }
+ >>
+ }
+ /A<</S/JavaScript/JS(\Hy at escapestring{\Fld at onclick@code})>>
+ \Fld at additionalactions
+ }
+ }
+\ExplSyntaxOff
\def\PDFForm at List{%
/Subtype/Widget%
\Fld at annotflags
@@ -1757,6 +1774,7 @@
}
}
\ExplSyntaxOff
+
\def\PDFForm at Submit{%
/Subtype/Widget%
\Fld at annotflags
More information about the latex3-commits
mailing list