diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/qrcstamps/examples |
Initial commit
Diffstat (limited to 'macros/latex/contrib/qrcstamps/examples')
-rw-r--r-- | macros/latex/contrib/qrcstamps/examples/qrc-demo1.pdf | bin | 0 -> 44221 bytes | |||
-rw-r--r-- | macros/latex/contrib/qrcstamps/examples/qrc-demo1.tex | 63 | ||||
-rw-r--r-- | macros/latex/contrib/qrcstamps/examples/qrc-demo2.tex | 54 | ||||
-rw-r--r-- | macros/latex/contrib/qrcstamps/examples/qrc-demo3.tex | 142 |
4 files changed, 259 insertions, 0 deletions
diff --git a/macros/latex/contrib/qrcstamps/examples/qrc-demo1.pdf b/macros/latex/contrib/qrcstamps/examples/qrc-demo1.pdf Binary files differnew file mode 100644 index 0000000000..a131dcbe91 --- /dev/null +++ b/macros/latex/contrib/qrcstamps/examples/qrc-demo1.pdf diff --git a/macros/latex/contrib/qrcstamps/examples/qrc-demo1.tex b/macros/latex/contrib/qrcstamps/examples/qrc-demo1.tex new file mode 100644 index 0000000000..91eaa5e3ce --- /dev/null +++ b/macros/latex/contrib/qrcstamps/examples/qrc-demo1.tex @@ -0,0 +1,63 @@ +\documentclass{article} +\usepackage[forcolorpaper]{web} +\usepackage[scandoc]{qrcstamps} + +\title{Create QR Code Symbols using Stamps} +\author{D. P. Story} +\email{dpstory@acrotex.net} +\subject{Creating QR Code symbols using Acrobat annotation stamps and LaTeX} +\keywords{stamp annotations, QR Code, LaTeX, PDF, AcroTeX} + +\useFullWidthForPaper +\previewOff + +\def\cs#1{\texttt{\char`\\#1}} + +\parindent0pt\parskip6pt + +\begin{document} + +\makeinlinetitle + +\textbf{Small} + +\defineAPath{\UADPStory}{http://www.math.uakron.edu/~dpstory} +\qrCode{http://www.acrotex.net} \url{http://www.acrotex.net}\qquad +\qrCode{mailto:dpstory@acrotex.net} \url{mailto:dpstory@acrotex.net} + +\qrCode{Home of AcroTeX.Net Blog\n +http://www.acrotex.net/blog} \parbox{2in}{Home of Acro\negthinspace\TeX.Net Blog\\ +\url{http://www.acrotex.net/blog}}\hfill\parbox{3.25in}{You can format the +line of a text message, as is done in the QR symbol to the left, by using +\cs{n} (new line) within the required argument of \cs{qrCode}.} + + +\textbf{Medium} + +%https://theqrplace.wordpress.com/2011/05/02/qr-code-tech-info-mecard-format/ +\qrCode[size=medium]{MECARD:N:Story,Don;NICKNAME:Dr. D. P. Story; +ADR:1475 AcroTeX Drive, Niceville, FL 32578;TEL:9999999999;EMAIL:dpstory@acrotex.net; +MEMO:Founder of AcroTeX.Net; +URL:http://www.acrotex.net;;} (MECARD) + +\textbf{Large} + +\def\TEXT{% +Now is the time for all good men to come to the aid of their country. +Now is the time for all good men to come to the aid of their country. +Now is the time for all good men to come to the aid of their country. +Now is the time for all good men to come to the aid of their country. +Now is the time for all good men to come to the aid of their country. +Now is the time for all good men to come to the aid of their country. +%Now is the time for all good men to come to the aid of their country. +Now is the time for all good men to come to the aid of their country.} + +\qrCode[size=large,widthTo=2in,allowresize]{\TEXT} (Now is the time\dots)\hfill +\parbox{3in}{This is an example of a QR symbol containing text. This paragraph +is near the limit of 500 characters. If you recompile after un-commenting the +one line that is commented out, you'll be over the 500 character limit. See +what happens when you compile. This example as well as others were used in +the development of the package to check whether there truly is a 500 +character limit.} + +\end{document} diff --git a/macros/latex/contrib/qrcstamps/examples/qrc-demo2.tex b/macros/latex/contrib/qrcstamps/examples/qrc-demo2.tex new file mode 100644 index 0000000000..072339ab40 --- /dev/null +++ b/macros/latex/contrib/qrcstamps/examples/qrc-demo2.tex @@ -0,0 +1,54 @@ +\documentclass{article} +\usepackage{amsmath} +\usepackage[forcolorpaper]{web} +\usepackage{eforms} +\usepackage[scandoc]{qrcstamps} + + +\title{Creating a QR Code Symbol Stamp Interactively} +\author{D. P. Story} +\subject{Creating QR Code symbols using Acrobat annotation stamps and LaTeX interactively} +\email{dpstory@acrotex.net} +\keywords{stamp, QRCode, stamps} + +\useFullWidthForPaper + +\parindent0pt\parskip6pt + +\begin{document} + +\makeinlinetitle + +This file demonstrates that it is possible to create QR Code symbols +interactively. Enter some text into the field below then click on the white +space outside the field (or press the \texttt{TAB} key) to commit the data. +The QR Code symbol stamp will be updated appropriately. + +\qrCode[size=medium]{http://www.acrotex.net}\space\textField[ + \TU{Maximum of 250 characters allowed, enter a URL, a mailto, or simply text.} + \MaxLen{250}\Ff{\FfMultiline}\AA{\AAKeystroke{% +if (event.willCommit) {\r\t + if (!/^\\s*$/.test(event.value)) {\r + var annot=this.getAnnot({nPage:this.pageNum,cName:"\currentAnnotName"});\r\t + var props=annot.getProps();\r\t + props.author="QRC";\r\t + props.subject=event.value;\r\t + annot.setProps(props);\r\t + delete props.APCosObj;\r\t + annot.setProps(props);\r + }\r +}}}]{txtFld}{3in}{11bp*6} + +Ignore the JavaScript code, it is somewhat obscure, but it works. + +\paragraph*{Requirements for this file} For this QR Code symbol stamp to +update as designed, the user must (1) be viewing this document in +\textsf{Acrobat} and (2) the stamp file \texttt{qrc-stamps.pdf}, which comes +with this distribution, must be installed in the user \texttt{Stamps} folder +of \textsf{Acrobat}. This file and these techniques work only for you, my dear +AeB Pro users. + +By the way, if you also have Acrobat Reader, try this file in that +application to see what happens. + +\end{document} diff --git a/macros/latex/contrib/qrcstamps/examples/qrc-demo3.tex b/macros/latex/contrib/qrcstamps/examples/qrc-demo3.tex new file mode 100644 index 0000000000..2af0324b48 --- /dev/null +++ b/macros/latex/contrib/qrcstamps/examples/qrc-demo3.tex @@ -0,0 +1,142 @@ +\documentclass{article} +\usepackage[web=forcolorpaper,eforms]{aeb_pro} +\usepackage[scandoc]{qrcstamps} +%\usepackage{lucidbry} + +\previewOff + +\title{\texorpdfstring{Modify a QR symbol stamp and (optionally) save it to an Image file} + {Modify a QR Symbol and save as Image}} +\author{D. P. Story} +\email{dpstory@acrotex.net} +\subject{Methodology and problems with creating dynamic QR barcode stamps} +\keywords{stamp, QRCode, stamps} +\setWindowOptions{showtitle} + +\def\cs#1{\texttt{\char`\\#1}} + +\useFullWidthForPaper + +\parindent0pt\parskip6pt + +\chngDocObjectTo{\oDoc}{oDoc} +% +% Methodology: When user presses 'Make Image', the page of the doc that contains the stamp +% is extracted and saved as \jobname_tmp.pdf. It is then attached to the current doc, with +% annotation name (NM key) of "_qrcpage". The attachment is opened (hidden from user), the page is cropped +% around the annotation and saved in the desired file format under the specified name. The +% attachment is then closed and removed. +% +\begin{insDLJS}{myqrcjs}{Document JS to support QRC} +var _oDoc,oDoc; +function saveQrcAsImage(annotname) { + if ( arguments.length > 1) { + var f=this.getField(arguments[1]); + var i=f.currentValueIndices + var faceV=f.getItemAt(i,false) // face + var fileExt="."+faceV.toLowerCase(); + var expV=(faceV=="PDF")?"":f.getItemAt(i,true); // export value + } else { + var faceV="PNG"; + var fileExt=".png"; + expV="com.adobe.acrobat.png"; + } + var annot=this.getAnnot({nPage:this.pageNum,cName:annotname}); + var props=annot.getProps(); + var Rect=props.rect; + var Page=this.pageNum; + var pos=this.path.lastIndexOf("/"); + var _path=this.path.substring(0,pos); +% Extract the page the targeted qrc is on, and save it to a tmp file + \extractPages({nStart:Page, cPath:"\jobname_tmp.pdf"}); +% Now, attach it to the current document + \importDataObject({cName:"_qrcpage", cDIPath:"\jobname_tmp.pdf"}); +% Open the attachment, oDoc is the doc object of this doc + oDoc=this.openDataObject("_qrcpage"); + var basename=app.response({cQuestion:"Enter the name of the file to be saved as a "+faceV+" image", + cDefault: "qrcode", cLabel: "Save as "+faceV+":"}); + if (basename.toLowerCase()=="\jobname".toLowerCase()) { + basename=null; + app.alert("Selecting \"\jobname\" is not permitted, try another name for the saved image."); + } + if (basename!=null) { +% +% We extracted a single page, the annot lies on page 0 +% + oDoc.setPageBoxes({cBox:"Crop",nStart:0,rBox:Rect}); +% +% From experience, we learn that the page must be flattened before we save to EPS +% In the case of PDF, unless we flatten, the resultant PDF file will be a stamp +% + if (faceV=="EPS"||faceV=="PDF") oDoc.flattenPages(); + \docSaveAs\oDoc({cPath:_path+"/"+basename+fileExt,cConvID:expV}); + oDoc.closeDoc(true); + this.removeDataObject("_qrcpage"); + this.dirty=false; + } +} +function qrcKeyboard(annotname) { + if (event.willCommit) { + if (!/^\\s*$/.test(event.value)) { + var annot=this.getAnnot({nPage:this.pageNum,cName:annotname}); + var props=annot.getProps(); + props.author="QRC"; + props.subject=event.value; + annot.setProps(props); + delete props.APCosObj; + annot.setProps(props); + } + } +} +\end{insDLJS} + + + +\begin{document} + +\makeinlinetitle + +We initially create a QR symbol for the url \url{http://www.acrotex.net}. This QR symbol can be modified +by entering text in the input box (the field allows a maximum of 75 characters). After you've committed your data, the +QR symbol will update. The new wrinkle is the ability to save this symbol to an image file (PNG). Do this +by pressing the \textsf{Make Image} button and entering a file name (or just take the default name). If things +go as planned, the PNG image of the QR symbol is saved to the folder this PDF was opened from. + +\qrCode{http://www.acrotex.net}\space +\textField[\MaxLen{75}\AA{\AAKeystroke{qrcKeyboard("\currentAnnotName");}}]{txtFld1}{2in}{11bp}\olBdry +\pushButton[\CA{Make Image}\A{\JS{saveQrcAsImage("\currentAnnotName");}}]{btn1}{}{11bp} + +But why stop at PNG files? In the demonstration below, use the dropdown menu to select a graphics format. +Pressing the \textsf{Make Image} button then saves the QR Code symbol to a graphics file. + +\qrCode[allowresize]{http://www.acrotex.net}\space +\textField[\MaxLen{75}\AA{\AAKeystroke{qrcKeyboard("\currentAnnotName");}}]{txtFld2}{2in}{11bp}\olBdry +\comboBox[\DV{pdf}\V{pdf}]{cb2}{.6in}{11bp}{% +[(pdf)(PDF)][(com.adobe.acrobat.jpeg)(JPEG)] +[(com.adobe.acrobat.png)(PNG)] +[(com.adobe.acrobat.tiff)(TIFF)] +[(com.adobe.acrobat.eps)(EPS)]}\olBdry +\pushButton[\CA{Make Image}\A{\JS{saveQrcAsImage("\currentAnnotName","cb2");}}]{btn2}{}{11bp} + +\paragraph*{Requirements for this file} Even more amazing than \texttt{qrc-demo2.pdf}! For this QR Code symbol stamp +to update and image saved, the user must (1) be viewing this document in +\textsf{Acrobat} and (2) the stamp file \texttt{qrc-stamps.pdf}, which comes +with this distribution, must be installed in the user \texttt{Stamps} folder +of \textsf{Acrobat}. This file and these techniques work only for you, my dear +AeB Pro users; and as an AeB Pro user, you have installed in the correct +location on your computer the files \texttt{aeb.js} and \texttt{aeb\_pro.js}; +these are silently used. + +\paragraph*{Auxiliary file generated} The method (the action of the \textsf{Make Image} button) creates the PDF +file \cs{jobname\_tmp.pdf} in the source folder. The file can be later +deleted. + +\paragraph*{Applications} What can you do with the save images? Anything you want. Some suggestions: +(1) import them into another {\LaTeX} source file using \cs{includegraphics} +(should you be adverse to using stamps in your document), perhaps you are +creating a business card;\footnote{I don't need on, I'm retired.} (2) put +them on your web page, the QR symbol might contain a web address, email, or +other contact info; and (3) other stuff too numerous to mention. + +\end{document} + |