Flatten Comments  SOLVED

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
jeffp
User
Posts: 914
Joined: Wed Sep 30, 2009 6:53 pm

Flatten Comments

Post by jeffp »

Is there a way to flatten comments/annotations using IPXC_Document?

Here's what I have so far.

Code: Select all

procedure TMyPDF.FlattenComments;
var
  i, j, APageCount, AAnnotCount: Cardinal;
  APage: IPXC_Page;
  A: IPXC_Annotation;
begin
  if Assigned(FDoc) then
  begin
    APageCount := GetPageCount;
    for i := 0 to APageCount - 1 do
    begin
      FDoc.Pages.Get_Item(i, APage);
      APage.GetAnnotsCount(AAnnotCount);
      for j := 0 to AAnnotCount - 1 do
      begin
        APage.GetAnnot(j, A);
        //How to do I flatten?
      end;
    end;
  end;
end;
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Flatten Comments

Post by Sasha - Tracker Dev Team »

Hello Jeff,

The IPXC_Document::FlattenAnnotations method will be available from the next build. Meanwhile you can try the latest dev. build - this method will be included in it.
https://forum.pdf-xchange.com/ ... 66&t=25943

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
jeffp
User
Posts: 914
Joined: Wed Sep 30, 2009 6:53 pm

Re: Flatten Comments

Post by jeffp »

Perfect. Thanks.

Any update on when the next official build will be released?
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Flatten Comments

Post by Sasha - Tracker Dev Team »

Hello Jeff,

Sadly no - it should be out soon but no specific date is available yet.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
jeffp
User
Posts: 914
Joined: Wed Sep 30, 2009 6:53 pm

Re: Flatten Comments

Post by jeffp »

Any word on the new release?
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: Flatten Comments

Post by Vasyl-Tracker Dev Team »

Also in current release you may use Editor's operation:

https://sdkhelp.pdf-xchange.com/vie ... ts_flatten
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
jeffp
User
Posts: 914
Joined: Wed Sep 30, 2009 6:53 pm

Re: Flatten Comments

Post by jeffp »

Thanks. That works.

But still waiting on next build for a few other items so curious to know if there is any work on the release date.
User avatar
Paul - Tracker Supp
Site Admin
Posts: 6837
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Re: Flatten Comments

Post by Paul - Tracker Supp »

HI Jeff,

there is a great deal to do regards XFA still on 318 and at present we are looking at late August. As usual we reserve the right to change that as things develop.

I hope that helps.
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
jeffp
User
Posts: 914
Joined: Wed Sep 30, 2009 6:53 pm

Re: Flatten Comments

Post by jeffp »

Ok. I see you've added IPXC_Document.FlattenAnnotations.

But I still can't figure out how to make it work. How do I fill the IPXC_AnnotsList?

See my code below.

Code: Select all

procedure TMyPDF.FlattenComments;
var
  i, APageCount: Cardinal;
  APage: IPXC_Page;
  AL: IPXC_AnnotsList;
begin
  if Assigned(FDoc) then
  begin
    APageCount := GetPageCount;
    for i := 0 to APageCount - 1 do
    begin
      FDoc.Pages.Get_Item(i, APage);

      //How to I Fill the IPXC_AnnotsList???
      FDoc.FlattenAnnotations(i, AL);
    end;
  end;
end;

User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: Flatten Comments

Post by Vasyl-Tracker Dev Team »

Hi Jeff.
How to I Fill the IPXC_AnnotsList???
I'm afraid but it is impossible currently to obtain IPXC_AnnotsList-object. We'll add such feature in our regular technical build, and in next official build too.

In next few days we will fix/improve couple moments related to FlattenAnnotations:

1. FlattenAnnotations(pageIndex, null) - all annotations on the <pageIndex> will be flattened
2. FlattenAnnotations(pageIndex, annotList) - all annotations specified in <annotList> will be flattened, you are able to put into <annotList> annots from different pages. the <pageIndex> argument will be ignored in this case.
3. FlattenAnnotations(-1, nullptr) - all existing annotations in document will be flattened

Additionally the new features will be added too:

1. IPXC_Page::GetAnnotsList(IPXC_AnnotsList**) - will return list of annotations on the page
2. IPXC_Inst::CreateAnnotsList(IPXC_AnnotsList**) - will return empty list. It might be used for building custom annot-list and the flatten all of them as well.

Please wait for upcoming technical/official build..

HTH
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
jeffp
User
Posts: 914
Joined: Wed Sep 30, 2009 6:53 pm

Re: Flatten Comments

Post by jeffp »

Ok. I can wait. Will it be build

318.2?

And when will it be out roughly?
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: Flatten Comments

Post by Vasyl-Tracker Dev Team »

It will be 319, approximately at the end of November.

Tomorrow, in the morning, you will be able to try our technical build with such new stuffs..
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
jeffp
User
Posts: 914
Joined: Wed Sep 30, 2009 6:53 pm

Re: Flatten Comments

Post by jeffp »

Will

FlattenAnnotations(pageIndex, null)

work now. That is really what I need. I will always want to flatten all comments on a page.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Flatten Comments

Post by Sasha - Tracker Dev Team »

Hello Jeff,

If it was a question - please try our Dev. Build available from here and check whether the problem was resolved:
https://www.pdf-xchange.com/forum3 ... 66&t=25943

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: Flatten Comments

Post by Vasyl-Tracker Dev Team »

FlattenAnnotations(pageIndex, null)
It is not working in current official build. Currently it working only in technical build.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
jeffp
User
Posts: 914
Joined: Wed Sep 30, 2009 6:53 pm

Re: Flatten Comments  SOLVED

Post by jeffp »

Finally, got the dev build and can confirm this issue is now fixed.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17824
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Flatten Comments

Post by Tracker Supp-Stefan »

:)
RMan
User
Posts: 221
Joined: Tue Jul 02, 2013 10:06 pm

Re: Flatten Comments

Post by RMan »

In trying this the comments were flattened but they were still listed in the Comments Pane in the Editor. Is there an event that needs to be fired to refresh the Comments Pane list?

I was able to flatten them all using this sample and that removed the listing in the comments pane also but it's not as clean of code.
https://sdkhelp.pdf-xchange.com/vie ... ts_flatten
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Flatten Comments

Post by Sasha - Tracker Dev Team »

Hello RMan,

It is better to use operations for the Editor SDK usage - they fire all of the events needed, fill the Undo\Redo data and do other things that you can be unaware of that are needed for proper Editor functionality. The operations take more code but they are safe for usage whilst the IPXC-level methods do not control the UI level and other events\methods should be fired\executed for the proper work.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
RMan
User
Posts: 221
Joined: Tue Jul 02, 2013 10:06 pm

Re: Flatten Comments

Post by RMan »

The undo/redo reason makes sense and never even thought about that case. Thanks again.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Flatten Comments

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply