How to create a text field within a DDX file? - pdf

I'm trying to create an adobe form that consists in a text field inside a DDX file that contains properties such as watermarks and other options.
Adobe DDX reference indicates that it supports XDP declarations but I've not been able to make it work.
What I'm trying to accomplish is that every time a user opens a PDF a text field should populate with the current Date and time. I already created a javascript that will be attached in the PDF from the DDX but it's failing in the instruction this.getField("NAME_HERE") because it doesn't exists.
My last attempt was to define a XDP field but it's not recognized since XDP is not bound.
<PDF result="onlyPrinted" return="false">
<XDP>
<!--<XDP:field name="onOpenJS"/>-->
</XDP>
<JavaScript name="getDate" source="File:///PATH"/>
<PDF source="mainWatermark">
</PDF>
</PDF>
Have you ever created a form in a DDX file?

Related

How can I Map from XML HREF+Text to Word Document Hyperlink?

I Have a simple XML file e.g.:
<root>
<some_link_href>http://www.microsoft.com/</some_link_href>
<some_link_text>goto microsoft site</some_link_text>
</root>
I have setup XmlMapping, but I can't seem to get a Hyperlink.
I tried using richTextControl and and providing RTF text
(e.g. '{\rtf1\pc some \b BOLD \b0 text}') but it just shown the raw RTF.
Note: even though I'd like to have a Text with HREF, I can settle for clickable URI
Is there any other control? other good methods to use?
also posted # https://learn.microsoft.com/en-us/answers/questions/720964/place-link-on-winword-from-xmlmapping.html

How to set file name displayed in "Save As..." dialog for dynamic PDF displayed in iframe

I am generating a pdf dynamically in ColdFusion, so that there are no actual PDF's on our server. Every time the user hits 'download' it dynamically creates a PDF by opening another browser window, using an <iframe> within the window where the pdf is created.
However, I'm not sure how to change the actual filename displayed when the user clicks "Save As..". Currently, the file name displayed is the name as the .cfm file used to generate the pdf, e.g. my_pdf_generated.pdf. Ideally I'd like the file to have a date in the name, e.g. my_pdf_generated_040918.pdf, but I can't seem to find how to do that.
This is the code that runs in the separate browser window when the user clicks 'Download pdf'.
<div class="title">
Loading your pdf. Your document may take a few moments to
load. Once it's loaded, you can save it to your device.</div>
<cfflush>
<iframe src="property_valuation.cfm?valco=<cfoutput>#URL.ValCo#</cfoutput>"
width="100%" height="100%" >
</iframe>
</div>
property_valuation.cfm:
... other code ...
<cfdocument format="pdf" margintop="1.0" marginbottom=".75" >
<html>
<head></head>
<body>
... generate pdf content here ...
</body>
</html>
</cfdocument>
Here's the answer:
I was missing a CFHEADER statement that allows the filename parameter which will be used when the user does right-click, "Save as...". You can also set a variable to the date and time and include that variable as part of the filename to make it unique.
property_valuation.cfm:
<cfheader name="content-disposition" value="inline; filename=mypdf.pdf"/>

OfficeJS Word Addin - Modify content control in the whole document ( including header/footer )

Due to the office API limitation ( API is only restricted to rich text content controls). We had to insert content controls as an OOXML object. It inserted the content control correctly but office API doesn’t recognize that as a content control. For example, using office API, if you call a method to get all the content controls, above content control will not be returned.
If you run following code, it will not return those content controls that were inserted like that.
// Run a batch operation against the Word object model.
Word.run(function (context) {
// Create a proxy object for the content controls collection.
var contentControls = context.document.contentControls;
}
Here is the OOXML:
<pkg:package xmlns:pkg="http://schemas.microsoft.com/office/2006/xmlPackage">
<pkg:part pkg:name="/_rels/.rels" pkg:contentType="application/vnd.openxmlformats-package.relationships+xml" pkg:padding="512">
<pkg:xmlData>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml" />
</Relationships>
</pkg:xmlData>
</pkg:part>
<pkg:part pkg:name="/word/document.xml" pkg:contentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml">
<pkg:xmlData>
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml">
<w:body>
<w:sdt>
<w:sdtPr>
<w:alias w:val="[REPLACE_THIS]" />
<w:id w:val="1382295294" />
<w:placeholder>
<w:docPart w:val="4D926923E99F45DBAF2203E4FEA73047" />
</w:placeholder>
<w:dataBinding w:xpath="[REPLACE_THIS]" w:storeItemID="{AFE97E21-6B3F-435F-8566-BD38F346ABE4}" />
<w:showingPlcHdr />
</w:sdtPr>
<w:sdtContent>
<w:p>
<w:r>
<w:t>[REPLACE_THIS]</w:t>
</w:r>
</w:p>
</w:sdtContent>
</w:sdt>
</w:body>
</w:document>
</pkg:xmlData>
</pkg:part>
</pkg:package>
As Office API doesn't have any built-in methods to get these content controls and modify them. I have to read each section of the document, Get the OOXML , modify it and insert it back. Is there any other way to do this ? As this is really cumbersome and error-prone process.
I am assuming that you are using OOXML to insert other types of content controls (i.e. plain text, combo, date, etc.) and if that's the case, yes, in the content control collection we do not support, as of now, other types of content controls other than rich text. This is mostly because of a limitation in Word Online who only supports rich text as of today, and we ship APIs that can guarantee a multiplatform behavior. The plan is that when it eventually supports other types they will be included as part of the collection (hence the type property).
so, yes for now your only way out is to get the OOXML and handle the other types of control via XML. You can probably target the OOXML you get if you wrap them with a rich text content control and only getting the OOXML of the wrapper content controls.

Adding image to HTML/PDF report

I'm trying to add an image in an HTML report template. The image is stored in sys$FileDescriptor. I found some instructions for docx templates, but no luck so far with html templates.
I also tried using FileDescriptor.name as src field, but the file specified doesn't exist
In the end I managed to insert an image in an html template for pdf generation with this code:
<img src="../work/app-core/filestorage/${headerRow.fields.logoYear}/${headerRow.fields.logoMonth}/${headerRow.fields.logoDay}/${headerRow.fields.logoId}.${headerRow.fields.logoExt}" width="220" height="220"/>
The needed fields are obtained in sql from sys_file.update_ts with "to_char" Postgres function to allow for the correct format of the fields (YYYY, MM, DD)
At the moment YARG and CUBA Reporting do not provide means to insert images into HTML-reports similarly to DOCX/XLSX.
But pictures could be inserted/embedded with the img-tag.
src could be a link to picture:
<img src="http://localhost:8080/images/SomePicture.jpg" height="68" width="199" border="0" align="right"/>
Or you can embed a bitmap (your appproach with variables is also useable):
<img alt='SomePicture.png' src='data:image/png;base64,iVBORw0K ..... AcEP9PwxD0hNKK1FCAAAAAElFTkSuQmCC' style='max-width: 100%;'/>
Thank you for your question. The platform documentation is going to be updated soon.

XPages - modify display of Dojo Time Text box

I'm using a Dojo Time Text Box on my XPage. When I save a time in this field, the displayed time has a "T" prefix. Is there any way of removing this "T"? Here is my code:
<xp:inputText id="EventEndTime" value="#{document1.EventEndTime}" style="width:160px;"
role="button" title="used to pick a meeting time" required="true"
dojoType="dijit.form.TimeTextBox"
disableClientSideValidation="true">
<xp:this.dojoAttributes>
<xp:dojoAttribute name="required" value="false">
</xp:dojoAttribute>
</xp:this.dojoAttributes>
</xp:inputText>
You can add a custom converter to your inputText control which deletes the "T" before saving and adds "T" during rendering page:
<xp:this.converter>
<xp:customConverter>
<xp:this.getAsObject><![CDATA[#{javascript:value.substring(1)}]]></xp:this.getAsObject>
<xp:this.getAsString><![CDATA[#{javascript:"T" + value}]]></xp:this.getAsString>
</xp:customConverter>
</xp:this.converter>
This way time gets saved as string like "hh:mm:ss" instead of "Thh:mm:ss".
You could use a custom converter to save value as a Notes time value also.
Domino doesn't actually store "Time only", so you would want to use a viewScope variable to bind to your TimeTextBox first and use the load and save events to write to / read from that. I would use the SimpleDateFormat class for conversion which is way more comfortable that manual string operations. Actually a small Java helper class works wonders here.
Alternatively you could use a filter to clean this up.