Text to be placed into a Acrofield

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v5)  /  Re: Text to be placed into a Acrofield

DynamicPDF CoreSuite for .NET (v5) Forum

 Feb 25 2010 9:22 AM
I have a PDF template with a Acrofield. This acrofield is quite large. Part of the Text that needs to be placed inside this acrofield is in BOLD and the other part uses the regular font. How can this be achieved
Posted by a ceTe Software moderator
Hello,

It is not possible to set the formatting to the text when filling an existing form field. You can use a workaround for this by adding a FormattextTextArea in place of the form field. You will have to make the field read only to make it inactive.

You can refer to the supported HTML tags on our help documentation.

Thanks,
ceTe Software Support Team.
I am trying to run the following code using Dynamic Merger.

                        float x = pdf.Form.Fields[fieldName].GetX(page);
                        float y = pdf.Form.Fields[fieldName].GetY(page);

                        dataValue = "<i>Dynamic</i><b>PDF</b>&tm; Generator v5.1 for .NET has over 50 built-in page " +
                                    "elements. Custom page elements can be built by creating a class that inherits from " +
                                    "<b>ceTe.DynamicPDF.PageElement</b>.";

                       
                        FontFamily fontFamily = new FontFamily("PartFieldFont",setting.FontName);

                        // Create an formatted style
                        FormattedTextAreaStyle style = new FormattedTextAreaStyle(fontFamily, setting.FontSize, false);

                        FormattedTextArea formattedTextArea = new FormattedTextArea(dataValue, x, y, pdf.Form.Fields[fieldName].Width, pdf.Form.Fields[fieldName].Height, style);
                        page.Elements.Add(formattedTextArea);

The Text that is being output has no formatting for BOLD or ITALICS.

What can I do to make this work ?
Posted by a ceTe Software moderator
Hello,

We have not seen any issues in using bold and italic tags in FormattedTextArea. They should work fine. Can you please send over the input PDF document and the code you are using to our Support Team so that they can look into it further?

Thanks,
ceTe Software Support Team.
We are using the Following fonts :-

1) Palatino Linotype
2) Palatino Linotype Bold
3) Palatino Linotype Bold Italic
4) Palatino Linotype Italic

These Fonts are installed on C:\Windows\Fonts directory.

The Code I am using is as follows :-

float x = pdf.Form.Fields[fieldName].GetX(page);
float y = pdf.Form.Fields[fieldName].GetY(page);


dataValue = "<b>Group life benefit:</b> a lump sum benefit payabale on death";

FontFamily fontFamily = new FontFamily(setting.FontName.Name, setting.FontName);

// Create an formatted style
FormattedTextAreaStyle style = new FormattedTextAreaStyle(fontFamily , setting.FontSize, false);

FormattedTextArea formattedTextArea = new FormattedTextArea(dataValue, x, y, pdf.Form.Fields[fieldName].Width, pdf.Form.Fields[fieldName].Height, style);
page.Elements.Add(formattedTextArea);

In this code the Font being used is "Palatino Linotype" and the
setting.FontName.Name = ""PalatinoLinotype-Roman"

When I change this code to the use FontFamily.Times then it works as expected:

FormattedTextAreaStyle style = new FormattedTextAreaStyle(FontFamily.Times , setting.FontSize, false);

Am I doing something wrong when using the "Palatino Linotype" font due to which the formatting does not work as expected.
Posted by a ceTe Software moderator
Hello,

You will have to create OpenTypeFont objects using the font files you are using and then create the FontFamily object using the OpenTypeFont objects. Then you will have to create FormattedTextAreaStyle using the font family object. Please refer to the Font Families topic on our help documentation.

Thank,
ceTe Software Support Team.
In My code above I am creating a OpenTypeFont. When I go in he Immediate Window and type the following

?setting.FontName.ToString()
"ceTe.DynamicPDF.Text.OpenTypeFont"

This clearly shows that I am using a OpenTypeFont. If you look at the FontFamily Constructor it is

public FontFamily(string name, Font font)

Now currently I am using the following code

                       FontFamily fontFamily = new FontFamily(setting.FontName.Name, setting.FontName);

                        // Create an formatted style
                        FormattedTextAreaStyle style = new FormattedTextAreaStyle(fontFamily, setting.FontSize, false);

In the above example the "setting.FontName" holds the OpenTypeFont object for PalatinoLinoType font and the setting.FontName.Name holds the Name of the Font "PalatinoLinotype-Roman".

I am not sure what is wrong in this piece of code ? I have tried to hardcode the value of first paremeter "string name" in FontFamily constructor to "Palatino" and "PalatinoLineType" but even that does not work
Posted by a ceTe Software moderator
Hello,

Can you please try using the FontFamily constructor which takes bold, italic etc fonts also?

   FontFamily MyFontFamily = new FontFamily( "VerdanaName", verdana, verdanaBold, verdanaItalic, verdanaBoldItalic )

You will have to create OpenTypeFont objects for all the four types of font using their font files and create the FontFamily using these objects. If you are still having problem then please send over the full code you are using to our Support Team so that they can look into it further.

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 3:47 PM.