I'm dynamically creating some PDF files through my application, using iText, and I need to use several components (TextField, CheckBox, RadioButtons etc), and then submit the values to server. But, one of the requirements says that the user needs to be able to select and send files along with the other values. I did not find a specific component to this, and so I'm asking for some help with this situation.
Is there a way to create some kind of Input File, File Chooser, etc, and attach it on the generated PDF file? And then send this selected file to server?
Thanks
This is explained in the official documentation, more specifically in the example FdfServlet of chapter 9 of my book. However, in this example, we add a file selection field to an existing PDF, so I've made you an example that explains how to create such a field when creating a document from scratch: FileSelectionExample
A file selection field is created just like any other text field, except that you have to set a flag using the setOptions() method. If you want a file chooser to appear, you also have to add a JavaScript action:
TextField file = new TextField(writer, new Rectangle(36, 788, 559, 806), "myfile");
file.setOptions(TextField.FILE_SELECTION);
PdfFormField upload = file.getTextField();
upload.setAdditionalActions(PdfName.U, PdfAction.javaScript(
"this.getField('myfile').browseForFileToSubmit();", writer));
writer.addAnnotation(upload);
In the full example, I also added a second field and after selecting the file with the browseForFileToSubmit() method, I set the focus to that other field. I'm doing this because the file name only becomes visible in the file selection field after that field loses focus.
Related
I need to create entity object programmatically and fill it with data. One field needs to be of a file type. So I managed to create entity without file, upload file in ADAM using this sample of code. However it seems that I didn't bind it as it is binded when file is uploaded manually.
When a file is uploaded to entity field manually, you can see content like file:421 .../asdf.docx. However when I repeat code sample from link above, field contains that file available to choose and already uploaded, but field value is null. IFile.Url seems to write correct data via App.Data.Update method, but no id is displayed in admin panel.
Dictionary<string, object> fileDict = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase) {
{ "File", file.Url }
}; // file is ToSic.Sxc.Adam.IFile, returned by SaveInAdam
App.Data.Update(entityObj.EntityId, fileDict); // entityObj is ToSic.Eav.Data.IEntity, returned by App.Data.Create
I wonder if that's going to have some bad conscequences if it has no binding like manual upload and how to do that correctly?
To add files, you actually add them to a field (so that the UI can then offer them as if they were added by a normal user). Check out https://docs.2sxc.org/api/dot-net/ToSic.Sxc.Dnn.Web.IDynamicWebApi.html#ToSic_Sxc_Dnn_Web_IDynamicWebApi_SaveInAdam_System_String_System_IO_Stream_System_String_System_String_System_Nullable_System_Guid__System_String_System_String_
BTW: Best check out MobiusForms to see how it's done.
And I forgot to mention: here the docs https://docs.2sxc.org/web-api/custom-web-api-dotnet-saveinadam.html
To further explain:
SaveInAdam will place the file in the ADAM folder of the item. Since it could be that many files are added, it's just assuming that the field will be the library type - which doesn't store anything in the entity, it just automatically finds the folder that belongs to the field.
If you wish to not use the library feature but actually just the single-field with link, then you must also save the term like "file:74" into the value of the field.
I am in a Salesforce environment and trying to send out a docusign document using Docusign and Conga. I am using a 30 day trial.
1.Using Conga and Docusign works very well together and the formatting is correct except that I need to have 2 radio buttons on the form. Is there a way to add anchor tags to my Word document and hide them(white text) like I do for the Docusign signature and date tags?
I tried following the documentation for creating the radio buttons in Docusign and tie them to a picklist field in Salesforce but I have yet been able to write back to Salesforce.
How do you control the text length for a Docusign template? I have fields that make up the address but the spacing is not dynamic so depending on the field value the text may run into each other. Is there a way to have the fields adjust based on field value length?
How do I show multiple related records? I have a case with multiple activities associated to it and I need to display them. In Conga I use a table and all of the records show. But if I create a docusign template it is only showing the first record.
If at all possible I would prefer to add the anchor tags to the existing document since the formatting is cleaner.
Michael
There is. You'll want to avoid applying anchor tags directly to a DocuSign template when working in the web console. The reason for this is that when you're sending from Salesforce with or without Salesforce anchor strings you're going to receive an error message indicating that there's no text associated with an anchor string.
You can accomplish this through Custom Fields inside of Salesforce.
Basically, you place your text in white where you want the tag to attach to your document. You'll want to set the anchor string in the format of \variable{r}\ on the tag, then in the underlying document you would replace {r} with the recipient number in the signing order.
IE: \variable_{r}\ becomes \variable_1\, when Salesforce picks this up it will tag the document automatically. For more information, see here: https://support.docusign.com/guides/dfs-user-guide-use-automatic-anchor-text-with-custom-tags-user.
In terms of writing back the value of a Radio Button, as I'm sure you've noticed this can be tricky. The values for the picklist in Salesforce need to match up exactly, then be written back by adding a new line in your Connect object. A step by step guide is available on the support site: https://support.docusign.com/articles/DocuSign-for-Salesforce-How-to-update-a-Salesforce-Field-with-a-DocuSign-Radio-Button-Value.
The Width of a text field is determined in one of a few ways:
1) You can supply a fixed size in the API call being used to generate them.
2) You can save the custom field inside of DocuSign as a Custom Field after setting the width to it.
3) Set the Fixed Size flag to false, then the text field should fill itself out when text is applied to it.
Would you mind being more specific in regards to the status record?
I need to convert some datawindow text columns (PB 11.5.1 - SQL Server 2008R2 - datatype Text) to RTF.
I have 2 issues:
New data are displayed fine but the existing data do not display at
all
The RTF format popup has very limited height so the icons are half
displayed
For the first issue I did find a work around but it is far from elegant!
I append this:
{\rtf1\ansi\ansicpg1253\uc1\deff0{\fonttbl {\f0\fswiss\fcharset161\fprq2 Arial;} {\f1\fswiss\fcharset0\fprq2 Tahoma;} {\f2\froman\fcharset2\fprq2 Symbol;}} {\colortbl;\red0\green0\blue0;\red255\green255\blue255;} {\stylesheet{\s0\itap0\nowidctlpar\f0\fs24 [Normal];}{\*\cs10\additive Default Paragraph Font;}} {\*\generator TX_RTF32 13.0.501.502;} \deftab1134\paperw3240\paperh16838\margl0\margt0\margr0\margb0\widowctrl {\*\background{\shp{\*\shpinst\shpleft0\shptop0\shpright0\shpbottom0\shpfhdr0\shpbxmargin\shpbxignore\shpbymargin\shpbyignore\shpwr0\shpwrk0\shpfblwtxt1\shplid1025{\sp{\sn shapeType}{\sv 1}}{\sp{\sn fFlipH}{\sv 0}}{\sp{\sn fFlipV}{\sv 0}}{\sp{\sn fillColor}{\sv 12506623}}{\sp{\sn fFilled}{\sv 1}}{\sp{\sn lineWidth}{\sv 0}}{\sp{\sn fLine}{\sv 0}}{\sp{\sn fBackground}{\sv 1}}{\sp{\sn fLayoutInCell}{\sv 1}}}}}\pard\itap0\nowidctlpar\plain\f1\fs20
before the text and add a } in the end.
I hope there is another way that does not include changing the actual data!
Any help appreciated
It might be a little cleaner to use the PasteRTF PowerBuilder function for existing data. Technically this doesn't solve your concern about changing data as the function probably adds the RTF tags much like you are doing manually.
As another method that might work is to try using a separate RichTextEdit control and the DataSource function. The DataSource function allows a RichTextEdit control to share data with a DataWindow and display the data in its input fields. If there are input fields in the RichTextEdit control that match the names of columns in the DataWindow, the data in the DataWindow is assigned to those input fields. I'd look at the InputFieldNamesVisible property also because it affects what is displayed.
This example from the Help File establishes the DataWindow control dw_1 as the data source for the RichTextEdit rte_1. Using a template document might be a way around your challenge of displaying data, but not actually changing it- not sure I have not used this myself.
rte_1.DataSource(dw_1)
This example inserts a document called LETTER.RTF into the RichTextEdit rte_letter (the names of the document's input fields match the columns in a DataWindow object d_emp), creates a DataStore, associates it with d_emp, and retrieves data. Then it inserts the document in rte_letter and sets up the DataStore as the data source for rte_1:
DataStore ds_empinfo
ds_empinfo = CREATE DataStore
ds_empinfo.DataObject = "d_emp"
ds_empinfo.SetTransObject(SQLCA)
ds_empinfo.Retrieve()
rte_letter.InsertDocument("LETTER.RTF", TRUE)
rte_letter.DataSource(ds_empinfo)
As far as the icon question - I am not aware of a solution for that.
Using node reference is too heavy and I don't want to use taxonomy. What I want is to to use text field. But I don't want user to type the text but choose from a list of options instead.
So this text field can get from somewhere its own data source like some tags, then user select the tag, then the text field will be filled with the tag text.
The data source would preferably be configured as a variable.
I couldn't find any module to accomplish this yet.
I want to build the database which gets the url from user in one cell and returns some texts to the other cells. The Url is from www.imdb.com. I saw it was possible on Google Spreadsheet. I am wondering if it's possible for MS Excel.
Like when I input a movie Url, it gets ratings,title, casts from IMDB page.
You can get pretty close using a IQY file to define the web query and the parameters a user should input. The only difference is that, rather than defining the movie id in a cell, your user will be prompted when they create or refresh a query.
To do this, you need to:
create a plain text iqy file. Call it "imdb-movie.iqy" or something.
Put this text in it:
WEB
1
http://www.imdb.com/title/["Movie ID"]/
Selection=3
Formatting=None
PreFormattedTextToColumns=True
ConsecutiveDelimitersAsOne=True
SingleBlockTextImport=False
DisableDateRecognition=False
DisableRedirections=False
In the "Get External Data pane of the Excel Data ribbon click "Existing Connections" and find your IQY file. It will ask you where to put the data and prompt you for the movie id. By right clicking, you can see lots of settings about formatting and such.
The "selection=3" entry in the IQY file determines what table to pull the data in from. It sounds like you may want a number of them.
To make your own IQY file, you can choose the "get external data/from web" and select which table to use. Then choose "save" from the dialog and you have the file. You can paramaterize it with the ["parameter name","prompt"] syntax.