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

Free Support Forum - aspose.com

Evaluation : Freetext Annotation Issues

We are currently evaluating Aspose.Words and .PDF component to integrate with our CRM solution for our customers. I have run different use cases on Aspose.Words and its working fine but I have issues with Aspose.PDF.

Our customers use PDFs to communicate with customers and when PDFs are sent to Print house, files have to be tagged with annotations.

We use freetext annotation, when I tried the example code it does place a annotation but first it does not show automatically in the PDF, then you click at that specific place and the annotation appears. I also need to set the border and border color but that is also not working. I have to present the solution asap and we have to decide on products, it will be really helpful if you can guide me following is the code I am using.I tried many different things but nothing seems to work, also tried opacity but still when I open the PDF it does not show.

  1. Show the freetext annotation when open PDF
  2. Border color
  3. Solid border.

Thanks

// Saves the document to disk.
string pdfFile1 = dataDir + “Merge_OrderLines Result Out” + i.ToString() + “.pdf”;
docCover.Save(pdfFile1);

Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(pdfFile1);
// 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;
border.EffectIntensity = 2;
freetext.Opacity = 10f;
freetext.Characteristics.Border = Color.Red;

freetext.Border = border;
freetext.Contents = “Free Text”;

/*freetext.Characteristics.Background = Color.Yellow;
freetext.Characteristics.Border = Color.Red;
freetext.TextStyle.Color = Color.Red;
//freetext.Opacity = 1f;
// specify the contents of annotation
freetext.Contents = “Free Text”;
*/
// add anootation to annotations collection of page
pdfDocument.Pages[1].Annotations.Add(freetext);

pdfDocument.Save(pdfFile1);

Hi there,


Thanks for your interest in Aspose.

While testing the scenario using your sample code with Aspose.Pdf for .NET 9.6.0, I am unable to notice the issue. When I open the output PDF file, FreeText is appearing properly, border color is as per code and its style is solid. Can you please share your current output and sample desired PDF documents for understanding the issue?

Aspose.Pdf.Document
pdfDocument = new Aspose.Pdf.Document(myDir + “output.pdf”);<o:p></o:p>

// 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(100, 650, 294, 700), default_appearance);

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

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

border.Width = 2;

//border.Style = Aspose.Pdf.InteractiveFeatures.Annotations.BorderStyle.Dashed;

border.EffectIntensity = 2;

freetext.Opacity = 10f;

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

freetext.Border = border;

freetext.Contents = "Free Text";

/*freetext.Characteristics.Background = Color.Yellow;

freetext.Characteristics.Border = Color.Red;

freetext.TextStyle.Color = Color.Red;

//freetext.Opacity = 1f;

// specify the contents of annotation

freetext.Contents = "Free Text";

*/

// add anootation to annotations collection of page

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

pdfDocument.Save(myDir+"freetext_output.pdf");

We are sorry for the inconvenience caused.


Best Regards,