Format Fonts for Text Field Default Values

2

2

I am kind of new to Adobe Acrobat. I am using Adobe Acrobat Pro X. I am creating a fillable form, from scratch, basically. What I would like to do is be able to format a read only texbox so that it says something like this:

While this text is bold, this text will not be bold

The above is a sort of label before a check box or series of fill-in text boxes.

I can't seem to find a way to make only a portion of the text bold (or italic) the way that want. I realize I could build this word and then make the PDF, however, since the design of the form (and it's fillable) controls may change, and having to redesign the controls each time seems like a pain in the butt. I also realize I could add separate text boxes, choosing the -Bold or -Oblique font types, but that seems rather painful as well.

I am open to whatever solution works best. If there is an easy way to make design changes from Word, after the fillable fields are added. I am open to that, too.

Scott Holtzman

Posted 2013-01-13T14:57:12.850

Reputation: 366

Answers

2

Craft form and textbox in Adobe LiveCycle Designer - part Adobe Acrobat Pro X.

RichText tricks for TextField in Designer

Use Tab Order and Hierarchy windows in Adobe LiveCycle Designer (Shift+F11) for navigation.

Adobe Acrobat Pro X

Text Field Properties -> Options -> Custom calculation script >

Check! Allow Rich Text Formmating !!!

Text Field Properties -> Calculate-> Custom calculation script > Edit ...

var ObjectName = "Text1";
var JoinArrayStyle = new Array();

JoinArrayStyle[0] = new Object();
JoinArrayStyle[0].text = "While ";
JoinArrayStyle[0].textSize = 22;
JoinArrayStyle[0].textColor = color.red;

JoinArrayStyle[1] = new Object();
JoinArrayStyle[1].text = "this text is bold";
JoinArrayStyle[1].fontWeight = 900;
JoinArrayStyle[1].textSize = 24;
JoinArrayStyle[1].textColor = color.dkGray;

JoinArrayStyle[2] = new Object();
JoinArrayStyle[2].text = ", this text will not be bold.";
JoinArrayStyle[2].textSize = 22;
JoinArrayStyle[2].textColor = color.black;

this.getField(ObjectName).richValue = JoinArrayStyle;

Properties Text Field

Allow Rich Text Formmating !!!

Calculation sheet Adobe Acrobat Javascript

Javascript window

Result ...

Thx!

Plan B ... )))

Microsoft Word 2007 SP3 -> Acrobat X Pro Form

Create simple table

Select table Select table

Change color border to Adobe corp. default style)). enter image description here

Hold down the Ctrl key and the left mouse button, the pointer over the desired odd line, so select them. After any highlighted field by right click, go and choose "Border and shading ..." Erase few rows border

Align text right, press Ctrl+R, or press button in panel after select table column. Align text right

Erase left cell border Erase left cell border

Call Border and shading dialog Border and shading dialog

Set option in fill cell dialog. Fill cell dialog

Change text color tool Microsoft Word 2007.

Disabled color (vbGrayText) not set and not work in macros ... and I set dark grey)). Change text color tool Microsoft Word 2007

Save as Pdf Microsoft Word 2007. I not use Adobe add-on. Save as Pdf Microsoft Word 2007

Microsoft Word 2007 Pdf resolution quality. Microsoft Word 2007 Pdf resolution quality

Microsoft Word 2007 Pdf options font.

Pdf font save options

Auto open pdf after save as Microsoft Word 2007 dialog.

Auto open pdf after save as Microsoft Word 2007 dialog

Create or edit Form dialog part I

Create or Edit Form dialog part I

Create or edit Form dialog part II

Create or Edit Form dialog part II

View Adobe Acrobat Pro X Form. View Adobe Acrobat Pro X Form

Save Arcobat Pro X Form. Save Arcobat Pro X Form

In paragraf field 3 text fragment ... View Adobe file

Plan C ...

Apache FOP create pdf file from XML. Command line:

foo.cmd -xml xslfoRef.xml -xsl xml2pdf.xsl -pdf xslfoRef.pdf

Apache FOP create TrueType Font Metrics:

java -cp build/fop.jar;lib\xmlgraphics-commons-1.4.jar;lib\commons-io-1.3.1.jar;lib\commons-logging-1.0.4.jar;lib/serializer-2.7.0.jar org.apache.fop.fonts.apps.TTFReader -ttcname "Cambria" %windir%\Fonts\CAMBRIA.TTC Cambria2.xml

Apache FOP create pdf include font Cambria:

fop.bat -c Cambria2.xml  -xml xslfoRef.xml -xsl xml2pdf.xsl -pdf xslfoRef.pdf

Adobe LiveCycle Designer

New Form in Adobe LiveCycle Designer New Form in Adobe LiveCycle Designer

Use balnk form Use balnk form

set orientation set orientation

add view XML add view XML

add subform, text and form field add subform, text and form field

Text not edit in Acrobar X Pro! text not edit in Acrobar X Pro

Edit form field in Adobe X Edit field in Adobe X

Text template | XSLT.1 | HTML template XML | XSLT.2 | WordML template | WSH/powershell script | Adobe Pdf

TBD: XSLT_1, XSLT_2 - style text

Text template -

textempl.txt:

Full Name:
Company:
Job Title:
e-mail:
Phone:
Descriptions:\While \this text is bold\, this text will not be bold

getxtxml.xml:

<!DOCTYPE properties [<!ENTITY textempltxt SYSTEM "textempl.txt">]>
<body> &textempltxt;</body>

XML HTML template -

HTeMpLate.xml:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="xstyle.xss"?>
<body>
<table>
 <tr>
   <td class="field-style">Full Name: </td>
   <td class="adobe-style"></td>
 </tr>
 <tr>
   <td class="field-style">Company: </td>
   <td class="adobe-style"></td>
 </tr>
 <tr>
   <td class="field-style">Job Title: </td>
   <td class="adobe-style"></td>
 </tr>
 <tr>
   <td class="field-style">e-mail: </td>
   <td class="adobe-style"></td>
 </tr>
 <tr>
   <td class="field-style">Phone: </td>
   <td class="adobe-style"></td>
 </tr>
 <tr>
   <td class="field-style"><i>Descriptions: </i></td>
   <td class="description">
       <font class="Red"    color="FF0000">While </font>
       <font class="dkGray" color="595959">this text is bold</font>
       <font class="None"   color="000000">, this text will not be bold</font>
   </td>
 </tr>                                               
</table>
</body>

XML CSS file,

xstyle.xss:

@charset "UTF-8"; /* for Chrome Old ver */
/* test @: FireFox 18.0.1, Safari 5.1.7,Opera 12.12, Chrome 23.- 24., Internet Explorer 8  */
/* Style Sheets with XML */
body { display: block; width: 800px; align=left; border-width:0px; float:top; margin: 0; padding: 0; 
border: 0; outline: 0; vertical-align: baseline; background: transparent;}

table { display: table; width: 800px; align=right; float:top; 
border-spacing:10px;  /* FF18,Sf5,Op12,Ch24 eq IE8 margin-bottom: 10px; */
}

tr { display: table-row; width: 800px; float:top; margin-bottom:10px; }
td { display: table-cell; width: 400px; padding-left : 10px; padding-right: 10px; border-color: 1px solid #0070C0; text-align: right; float:top; }

td.field-style { display: table-cell; width: 400px; padding-left: 10px; padding-right: 10px; text-align : right; }
td.description { display: table-cell; width: 400px; padding-left: 10px; padding-right: 10px; text-align : left ; background-color: #FFFFE5;}
td.adobe-style { display: table-cell; width: 400px; padding-left: 10px; padding-right: 10px; text-align :     left ; border: 1px solid #0070C0;}

font.Red    { color: #FF0000; }
font.dkGray { color: #595959; font-weight: bold;}
font.None   { color: #000000; }

/* CSS3 FF18,Sf5,Op12,Ch24 */

tr > td[class="field-style"] { display: table-cell; width: 400px; padding-left: 10px; padding-right: 10px; text-align: right; }
tr > td[class="adobe-style"] { display: table-cell; width: 400px; padding-left: 10px; padding-right: 10px; text-align:  left; border: 1px solid #0070C0;}
tr > td[class="description"] { display: table-cell; width: 400px; padding-left: 10px; padding-right: 10px; text-align:  left; background-color: #FFFFE5;}

td > font[class="Red"   ] { color: #FF0000; }
td > font[class="dkGray"] { color: #595959; font-weight: bold;}
td > font[class="None"  ] { color: #000000; }

Convert HTeMpLate.xml - HTML template to Word XML 2003/ WordML template.

xml2wordml.cmd:

@echo off
msxsl.exe HTeMpLate.xml xml2wordml.xslt  -o wordml2003.xml

xml2wordml.xslt:

<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xml:space="preserve">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="no"/>
<xsl:preserve-space elements="td"/>
<xsl:template match="/">
<xsl:processing-instruction name="mso-application"><xsl:text>progid="Word.Document"</xsl:text></xsl:processing-instruction>
<xsl:apply-templates />
</xsl:template>
<xsl:template match="body"><w:wordDocument xml:space="preserve" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml">
<w:styles>
 <w:style w:type="table" w:default="on" w:styleId="TableNormal">
  <w:name w:val="Normal Table"></w:name>
 </w:style>
</w:styles>
<w:body>
<xsl:apply-templates/>
<!--                         Page layout                 -->
<w:sectPr><w:pgSz w:w="16838" w:h="11906" w:orient="landscape"></w:pgSz></w:sectPr>
</w:body>
</w:wordDocument>
</xsl:template>
<!--                         Start Table                 -->
<xsl:template match="table">
<w:tbl>
<w:tblPr>
   <w:tblW w:w="9570" w:type="dxa"></w:tblW>
    <w:tblBorders>
     <w:top w:val="nil" />
     <w:left w:val="nil" />
     <w:bottom w:val="nil" />
     <w:right w:val="nil" />
    </w:tblBorders>
</w:tblPr>
<xsl:apply-templates select="*[name()]"/>
</w:tbl>
</xsl:template>
<xsl:template match="thead | tbody | tfoot">
<!--          WordProcessingML no equivalent                 -->
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="tr">
 <w:tr>
  <xsl:apply-templates />
 </w:tr>
<!--              Insert table row begin                     -->
<w:tr>
 <w:tc>
<w:tcPr><w:tcW w:w="4785" w:type="dxa"/></w:tcPr>
 <w:p></w:p>
 </w:tc>
 <w:tc>  
<w:tcPr><w:tcW w:w="4785" w:type="dxa"/></w:tcPr>
 <w:p></w:p>
 </w:tc>
</w:tr>
</xsl:template>
<!--              Table Header rule begin                    -->
    <xsl:template match="th">
<w:tc>
 <w:tcPr><w:tcW w:w="0" w:type="auto"/></w:tcPr>
  <w:p>
  <w:pPr><w:jc w:val="center"/></w:pPr>
  <w:r>
   <w:rPr><w:b/></w:rPr>
    <w:t><xsl:value-of select="."/></w:t>
    </w:r>
    </w:p>
    </w:tc>
        </xsl:template>
    <!--              Color Cell field-style begin              -->
    <xsl:template match="//tr/td[@class='field-style']">
     <w:tc>
      <w:tcPr><w:tcW w:w="0" w:type="auto"/>
      </w:tcPr>
  <w:p>
 <w:pPr><w:jc w:val="right" />
</w:pPr>
   <w:r>
<w:t><xsl:value-of select="."/></w:t>
   </w:r> 
  </w:p>
 </w:tc>
 </xsl:template>
<!--              Color Cell adobe-style begin              -->
<xsl:template match="//tr/td[@class='adobe-style']">
 <w:tc>
  <w:tcPr><w:tcW w:w="0" w:type="auto"/>
   <w:tcBorders>     
     <w:top     w:val="single" w:sz="2" w:color="0070C0"/>
     <w:left    w:val="single" w:sz="2" w:color="0070C0"/>
     <w:bottom  w:val="single" w:sz="2" w:color="0070C0"/>
     <w:right   w:val="single" w:sz="2" w:color="0070C0"/>
</w:tcBorders>
  </w:tcPr>
  <w:p>
 <w:pPr><w:jc w:val="left" />
</w:pPr>
   <w:r>
<w:t><xsl:value-of select="."/></w:t>
   </w:r> 
  </w:p>
 </w:tc>
 </xsl:template>
<!--              Color Cell description begin              -->
<xsl:template match="//tr/td[@class='description']">
<w:tc>
<w:tcPr><w:shd w:val="clear" w:color="auto" w:fill="FFFFE5" />
<w:tcW w:w="4279" w:type="dxa" /></w:tcPr>
  <w:p>
<xsl:for-each select="//tr/td[@class='description']/font">
<w:r>   
<w:rPr><w:color w:val="$getColor" /> </w:rPr>
<w:t><xsl:value-of select="."/></w:t> 
</w:r>
</xsl:for-each>
  </w:p>
 </w:tc>
</xsl:template>
<!--              Color Cell description end                -->
</xsl:stylesheet>     

Save documents open in 2007 Word SP3 as PDF, powershell script.

powershell .\word2pdf.ps1

word2pdf.ps1:

# word2pdf.ps1 STTR sttrus@mail.ru
[int]$wdFormatPDF = 17
$SaveAsFormat = [int]$wdFormatPDF
$SaveAsExt=".pdf"
$word = New-Object -ComObject word.application 
$word.visible = $false 
$SourceDir="C:\DocSourceDir"
$i =0
$Files = Get-ChildItem $SourceDir -recurse -include *.txt,*.doc,*.docx,*.rtf,*.xml
Foreach ($file in $Files) {
$doc = $word.documents.open($file.fullname) 
$saveFile=$file.DirectoryName + '\' + $file.BaseName + $SaveAsExt
$doc.saveas($saveFile, $SaveAsFormat)
$doc.close() 
$i++
                          }
$word.Quit() 
$word = $null 
[gc]::collect() 
[gc]::WaitForPendingFinalizers()
write-host "Count : $i"

Save documents open in 2007 Word SP3 as PDF, WSH script:

cscript //Nologo doc2pdf.vbs wordml2003.xml

doc2pdf.vbs:

If WScript.Arguments.Count <1 then 
   Wscript.Echo "Ex.1: cscript //Nologo doc2pdf.vbs filename.ext"
   Wscript.Echo "Ex.2: cscript //Nologo doc2pdf.vbs wordml2003.xml"
   Wscript.Quit
End If

Dim strFilePath:strFilePath = WScript.Arguments.Item(0) 

docx2pdf strFilePath

Sub docx2pdf(OpenFile)
Const wdFormatPDF = 17

Dim WordDocument, FileProperties, strOpenFileName, strSavePDF

Dim FSO:Set FSO = CreateObject("Scripting.FileSystemObject")

    If FSO.FileExists(OpenFile) Then

Dim WordApplication:Set WordApplication = CreateObject("Word.Application")

    WordApplication.Visible = False
        Set FileProperties = FSO.GetFile(OpenFile)
        strOpenFileName = FileProperties.Path

    Else
        WScript.Echo "File Open Error: file not exist!"
        Exit Sub
    End If

    strSavePDF = FSO.BuildPath(FileProperties.ParentFolder, FSO.GetBaseName(FileProperties) & ".pdf")
    WordApplication.Documents.Open strOpenFileName
    Set WordDocument = WordApplication.ActiveDocument
    WordDocument.SaveAs strSavePDF, wdFormatPDF
    WordDocument.Close
    WordApplication.Quit(False)
End Sub 

STTR

Posted 2013-01-13T14:57:12.850

Reputation: 6 180

right now I only have Acrobat Pro, but I will revisit this if I can. – Scott Holtzman – 2013-01-13T19:35:45.867

so, you are saying that I can create the text with javascript and format each word how I want it, essentially? – Scott Holtzman – 2013-01-14T14:33:56.850

Text Field Properties -> Calculate -> Custom calculation script Edit ... var ObjectName = "Text1"; var JoinArrayStyle = new Array(); JoinArrayStyle[0] = new Object(); JoinArrayStyle[0].text = "While "; JoinArrayStyle[1] = new Object(); JoinArrayStyle[1].text = "this text is bold"; JoinArrayStyle[1].fontWeight = 900; JoinArrayStyle[2] = new Object(); JoinArrayStyle[2].text = ", this text will not be bold."; this.getField(ObjectName).richValue = JoinArrayStyle; – STTR – 2013-01-16T11:42:31.110

-> this is in indeed an awesome looking answer, and I gave you +1. I will mark as the answer if it works in my testing sometime later. – Scott Holtzman – 2013-01-16T15:10:23.180

I glad. May use Adobe Illustrator CS6, or Adobe LiveCycle Designer ES2 to manipulation text, but Your not all edit it form and text in Adobe Acrobat Pro ... + Microsoft Word 2007 SP3 or last version create Your text and save as pdf. If Your need form may test Microsoft Office InfoPath 2007. – STTR – 2013-01-16T15:34:44.360

I marked this as the answer because it solved my question as asked. Unfortunately, this will not work for anything that can open a PDF outside of Acrobat, since the JS cannot run. For example, if I open it in preview I only get plain-text. However, I learned a tremendous amount from your efforts, so thanks for that! – Scott Holtzman – 2013-01-23T02:10:20.073

Ok, may be Plan B better? If need I write powershell or WSH vbscript to automate create Word 2007 table and save it as PDF. – STTR – 2013-01-23T19:36:31.817

Um, how can I give you plus 8! Your efforts have been very instrumental in helping me both solve my current issue and also learn a tremendous amount about how to creatively and elegantly (at least looking) make these forms! – Scott Holtzman – 2013-01-24T14:32:05.847

Do not worry about it - points not important. The most important thing is not to lose its color. Gandalf. (c) J. R. R. Tolkien – STTR – 2013-01-26T10:30:09.370

1

I don't know about acrobat, but most programs only allow textboxes to have one overall font.

Something you could do is draw it somewhere else (e.g. word), take a screenshot, and crop it in to look like a disabled textbox. Would that work for you?

Jakob Weisblat

Posted 2013-01-13T14:57:12.850

Reputation: 926

I will give you +1 for a creative solution that may be the least painful way to go. I'll have to play and see if indeed it is the least painful. – Scott Holtzman – 2013-01-13T19:13:49.370

Tried it. When I pasted it in, it was rather blurry... – Scott Holtzman – 2013-01-13T19:34:29.517

1did you use a .jpg or a lossless format like .png? You should use a .png so that it does not end up blurry. Hope that helps. – Jakob Weisblat – 2013-01-13T22:25:08.577