Free Support Forum - aspose.com

StrikeOut annotations disappear after flattening


#1

Using Aspose.PDF version 18.9

I have a need to flatten PDF documents that include strikeout annotations. No matter what I try, after I call flatten the strikeout annotations disappear from the document.

To be sure it wasn’t an issue with the source document, I generated a simple PDF using Word. When I add the strikeout annotation and save, I see the annotation in the resulting file. But after I flatten, I no longer see the annotation.

Here’s the code I’m using to test:

`    static void Main(string[] args)
{
  using (var licenseFile = File.Open(LicensePath, FileMode.Open))
  {
    var license = new License();
    license.SetLicense(licenseFile);
  }

  const string FilePath = @"..\..\docs\word-generated.pdf";
  string unflattenedFilePath = Path.Combine(Path.GetDirectoryName(Path.GetFullPath(FilePath)), "results", $"{Path.GetFileNameWithoutExtension(FilePath)}-unflattened.pdf");
  string flattenedFilePath = Path.Combine(Path.GetDirectoryName(Path.GetFullPath(FilePath)), "results", $"{Path.GetFileNameWithoutExtension(FilePath)}-flattened.pdf");

  var doc = new Document(FilePath);
  var page = doc.Pages[1];

  // create free text annotation
  var rectangle = new Aspose.Pdf.Rectangle(50, 50, 450, 350);
  var appearance = new DefaultAppearance("Helvetica", 20, System.Drawing.Color.Black);
  var textAnnotation = new FreeTextAnnotation(page, rectangle, appearance);
  textAnnotation.Contents = "ANNOTATE THIS!";
  page.Annotations.Add(textAnnotation);

  // create strike through annotation
  TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber("Lorem");
  page.Accept(textFragmentAbsorber);

  // Create a collection of Absorbed text
  TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;

  // Iterate on above collection
  for (int j = 1; j <= textFragmentCollection.Count(); j++)
  {
    TextFragment textFragment = textFragmentCollection[j];

    // Get rectangular dimensions of TextFragment object
    Aspose.Pdf.Rectangle rect = new Aspose.Pdf.Rectangle((float)textFragment.Position.XIndent, (float)textFragment.Position.YIndent, (float)textFragment.Position.XIndent + (float)textFragment.Rectangle.Width, (float)textFragment.Position.YIndent + (float)textFragment.Rectangle.Height);

    // Instantiate StrikeOut Annotation instance
    StrikeOutAnnotation strikeOut = new StrikeOutAnnotation(textFragment.Page, rect);
    // Set opacity for annotation
    strikeOut.Opacity = .80;
    // Set the border for annotation instance
    strikeOut.Border = new Border(strikeOut);
    // Set the color of annotation
    strikeOut.Color = Aspose.Pdf.Color.Red;
    // Add annotation to annotations collection of TextFragment
    textFragment.Page.Annotations.Add(strikeOut);
  }
  doc.Save(unflattenedFilePath);
  doc.Flatten();
  doc.Save(flattenedFilePath);

  Console.WriteLine("Done!");
}`

word-generated.pdf (26.8 KB)


#2

@sean7777

Thank you for contacting support.

We have worked with the data shared by you but we can not notice disappearance of annotation in flattened PDF document. We have attached generated files for your kind reference. Please try using Aspose.PDF for .NET 19.1 in your environment and then share your kind feedback with us.

flattened_19.1.pdf
unflattened_19.1.pdf


#3

I still see the strikeout annotation disappearing from the flattened version of the document that you uploaded. I’m viewing with Chrome’s PDF viewer and Adobe Acrobat DC.

I tested with 19.1 myself and had the same behavior.


#4

@sean7777

We are able to see the annotation in flattened_19.1.pdf file when viewed with Adobe Acrobat Reader DC, Adobe Acrobat Pro as well as with Chrome’s PDF Viewer. Would you please try it on some other machine and then share a screenshot with us if the issue persists.


#5

I and several coworkers opened your PDF’s, and none of us see the strikeout annotation in the flattened document in Adobe or any of the other viewers we tried.

I am using Windows 10 and Adobe Acrobat DC 2019.010.20069

Just to be clear, we are talking about the strikeout annotation over the word Lorem at the beginning of the text. The free text annotation that says “ANNOTATE THIS!” works fine.

Here are the screenshots of the annotation not appearing:
flattened-screenshot.PNG (109.7 KB)
unflattened-screenshot.PNG (105.7 KB)

This is causing a major issue with our software for one of our biggest clients. My company has an Aspose.Total license and we are working to track down the associated account to enter a paid support ticket.
In the meantime, we really need this resolved quickly or we will be forced to discontinue our business with you. Any assistance you can provide in the meantime would be greatly appreciated.


#6

@sean7777

Thank you for elaborating it further.

We have been able to notice the difference over the first word and a ticket with ID PDFNET-45880 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.


#7

Hello,
is there an estimated timeline for the issue to be fixed? While we understand that with the Paid Support model we would get visibility and easier communication for this issue, we would need a confirmation of the timeline before we renew our license and pay for support. Sales is not able to help and referred me to contact technical support.

Thank you,
Suvi


#8

@suvi_lampio_tylertech_com

We have recorded your request for ETA and will update you after initial investigations that how soon can we resolve it with Paid Support subscription. Please be patient and spare us little time.