We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Freetext annotation visibility

Our company is evaluating Aspose.PDF product, we are having an issue with Freetext annotation format. The example code which I am using, does create the annotation but its not visible in the PDF as default but when I click on that area then it appears. I am using the following code. Can you help if I am doing something wrong or its not supported in the product.
Thanks.

Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(dataDir + “test.pdf”);
// instantiate DefaultAppearance object
Aspose.Pdf.InteractiveFeatures.DefaultAppearance default_appearance = new DefaultAppearance(“Arial”, 12, System.Drawing.Color.Red);

//create annotation
Aspose.Pdf.Rectangle pageDimensions = pdfDocument.Pages[1].GetPageRect(true);


FreeTextAnnotation freetext = new FreeTextAnnotation(pdfDocument.Pages[1], new Aspose.Pdf.Rectangle(0, 20, 40, 0), default_appearance);
Aspose.Pdf.InteractiveFeatures.Annotations.Border border = new Aspose.Pdf.InteractiveFeatures.Annotations.Border(freetext);
border.Style = BorderStyle.Solid;
freetext.Opacity = 0.3f;

freetext.TextStyle.Color = System.Drawing.Color.Green;
freetext.Characteristics.Border = System.Drawing.Color.Red;
border.Width = 1;
freetext.Border = border;
freetext.Contents = “Free Text”;
freetext.Characteristics.Background = System.Drawing.Color.Honeydew;


pdfDocument.Pages[1].Annotations.Add(freetext);
pdfDocument.Pages[1].AddStamp(textStamp);

pdfDocument.Save(dataDir + “ann.pdf”);

Hi Waqas,


Thanks for contacting support.

I have tested the scenario using latest release of Aspose.Pdf for .NET 9.6.0 where I have used following code snippet and as per my observations, the FreeTextAnnotation properly appears in resultant file when viewing the file in Adobe Reader 11.0.3. For your reference, I have also attached the resultant PDF generated over my end.

In case the problem still appears, please share the input PDF file which you are using. We are sorry for this inconvenience.

[C#]

Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document();<o:p></o:p>

pdfDocument.Pages.Add();

// instantiate DefaultAppearance object

Aspose.Pdf.InteractiveFeatures.DefaultAppearance default_appearance = new Aspose.Pdf.InteractiveFeatures.DefaultAppearance("Arial", 12, System.Drawing.Color.Red);

//create annotation

Aspose.Pdf.Rectangle pageDimensions = pdfDocument.Pages[1].GetPageRect(true);

FreeTextAnnotation freetext = new FreeTextAnnotation(pdfDocument.Pages[1], new Aspose.Pdf.Rectangle(0, 20, 40, 0), default_appearance);

Aspose.Pdf.InteractiveFeatures.Annotations.Border border = new Aspose.Pdf.InteractiveFeatures.Annotations.Border(freetext);

border.Style = Aspose.Pdf.InteractiveFeatures.Annotations.BorderStyle.Solid;

freetext.Opacity = 0.3f;

freetext.TextStyle.Color = System.Drawing.Color.Green;

freetext.Characteristics.Border = System.Drawing.Color.Red;

border.Width = 1;

freetext.Border = border;

freetext.Contents = "Free Text";

freetext.Characteristics.Background = System.Drawing.Color.Honeydew;

pdfDocument.Pages[1].Annotations.Add(freetext);

// pdfDocument.Pages[1].AddStamp(textStamp);

pdfDocument.Save(<span style=“font-size:9.5pt;
line-height:115%;font-family:Consolas;mso-fareast-font-family:“Malgun Gothic”;
mso-fareast-theme-font:minor-fareast;color:#A31515;background:white;mso-highlight:
white;mso-ansi-language:EN-US;mso-fareast-language:KO;mso-bidi-language:AR-SA”>“c:/pdftest/FreeTextAnnotation_output.pdf”);

Hi Waqas,


Thanks for your inquiry. You may increase the rectangle size to display complete text of FreeTextaAnnotation. Please check sample code snippet in another post for the purpose. Please share some more details if there is difference in your requirement and my understanding.

Please feel free to contact us for any further assistance.

Best Regards,

Hi,

Thanks for reply, but I am still having the same issue. I copied you code, did not change anything except the paths. When I open the PDF (attached file), if I click I can see there is annotation but not visible as in your attached PDF.

I hope it has nothing to do with 'Trial version"?

Regards/Waqas

ws-onemarketing:

Hi,

Thanks for reply, but I am still having the same issue. I copied you code, did not change anything except the paths. When I open the PDF (attached file), if I click I can see there is annotation but not visible as in your attached PDF.

I hope it has nothing to do with 'Trial version"?

Hi Waqas,

Yes you are correct. When using the API in trial mode, the FreeTextAnnotation does not appear in resultant PDF file. you may consider requesting a 30 days temporary license to test the API without any limitations. For further information, please visit Get a temporary license

Thanks, I have requested now a temporary license.

Regards/Waqas

It works now, thanks for the help.

Regadrs/Waqas

Hi Waqas,


We are glad to hear that your problem is resolved when using a valid license. Please continue using our API and in case of any further query, please feel free to contact.