Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
![]() |
Flatten annotation in a PDF document |
Post Reply
|
| Author | |
kk aw
Team Player
Joined: 02 Feb 10 Location: Malaysia Status: Offline Points: 36 |
Post Options
Thanks(0)
Quote Reply
Topic: Flatten annotation in a PDF documentPosted: 04 Jan 14 at 11:39AM |
|
How do I flatten all the annotations (highlights) on a PDF document? There are so many different functions, and I am not sure about the sequence of using them. Any help would be appreciated. KK Aw
|
|
![]() |
|
kk aw
Team Player
Joined: 02 Feb 10 Location: Malaysia Status: Offline Points: 36 |
Post Options
Thanks(0)
Quote Reply
Posted: 05 Jan 14 at 2:57PM |
|
I use the following routine to flatten the annotations.
procedure TMainform.FlattenHighlights(Qp: TDebenuPDFLibrary0916); var iPagecount: Integer; iAnnotCount: Integer; i, j: Integer; s1: string; retval: Integer; begin iPageCount:= Qp.PageCount; With Qp do begin For i:= 1 to iPagecount do begin QP.SelectPage(i); iAnnotCount:= qp.AnnotationCount; for j:= 1 to iAnnotCount do begin s1:= qp.GetAnnotStrProperty(j, 101); If sm.equalIC(s1,'Highlight') then begin retval:= qp.FlattenAnnot(j, 0); if retval = 0 then ShowMessage(Format('Annotation No. %d cannot be flattened',[j])); end; end; end; end; end; I have 4 highlights on the first page and two on the second. The results of my test are as follows: a) Four annotation were found on the first page. The annotation type of 1 and 3 were blank. b) Annotation 2 and 4 were displayed correctly in my PDF previewer. c) On the second page, the first highlight covers the text. The second highlight was displayed correctly. What have I done wrong or are there bugs in GetAnnotStrProperty and FlattenAnnot? KK Aw |
|
![]() |
|
AndrewC
Moderator Group
Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
Quote Reply
Posted: 06 Jan 14 at 3:14AM |
|
KK Aw, When you flatten Annot 1 then Annot 4 becomes Annot 3, Annot 4 becomes Annot 2 and so on. You are calling FlattenAnnot(1); and then moving onto FlattenAnnot(2) not realising that the old Annot 2 is now Annot 1 and has been skipped. Try this instead for j:= iAnnotCount down 1 do Andrew
|
|
![]() |
|
kk aw
Team Player
Joined: 02 Feb 10 Location: Malaysia Status: Offline Points: 36 |
Post Options
Thanks(0)
Quote Reply
Posted: 06 Jan 14 at 3:52AM |
|
Thanks Andrew, I get the drift.
Now, my application recognizes all the highlights but on the first page, the highlights are not displayed. On the second page, both the highlights are now opaque. KK Aw |
|
![]() |
|
AndrewC
Moderator Group
Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
Quote Reply
Posted: 06 Jan 14 at 10:50PM |
|
KK Aw, Is your PDF previewer based on Debenu Quick PDF Library and RenderPageTo... type functions ? The current 10.11 version of Debenu Quick PDF Library doesn't fully support the rendering of transparency and this is most likely the cause of your problems. The soon to be released 10.12 version of the library will have much improved support for transparency rendering. If you would like to send us the PDF to support@debenu.com then we can do some further testing with the soon to be released 10.12 version. Andrew.
|
|
![]() |
|
kk aw
Team Player
Joined: 02 Feb 10 Location: Malaysia Status: Offline Points: 36 |
Post Options
Thanks(0)
Quote Reply
Posted: 07 Jan 14 at 2:25AM |
|
Hi Andrew,
Yes, my previewer is based on Debenu Quick PDF Library and I use the RenderPageTo.. functions. I am using version 9.16, as you can see from the codes. I will send you the sample PDF for your testing. KK Aw
|
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store