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,
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,
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,