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!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - FlattenAnnot
  FAQ FAQ  Forum Search   Register Register  Login Login

FlattenAnnot

 Post Reply Post Reply
Author
Message
CrazyTIm View Drop Down
Team Player
Team Player
Avatar

Joined: 21 Aug 11
Location: Australia
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote CrazyTIm Quote  Post ReplyReply Direct Link To This Post Topic: FlattenAnnot
    Posted: 28 Aug 15 at 6:34AM
Hi guys, we found some issues with FlattenAnnot... (v11.15)

Here is the pdf:


When we loop over each annotation, only 4 out of 8 annotations are actually flattened (returns 1), the other 4 are not (returns 0), and as you can see, after flattening one of the annotations has jumbled text:

After: http://tinyurl.com/p9r23hu (note: looks fine when rendered in Chrome, but in Adobe Reader you can see the jumbled text)

The jumbled text is really causing a problem, need to prevent this.

Code (VB.NET):

Q.LoadFromFile(PathToPDF, "")
Dim pc As Integer = Q.PageCount

' loop over pages
For i = 1 To pc

Dim ac As Integer = Q.AnnotationCount

' flatten each annotation on this page
For a = 1 To ac
Dim f = Q.FlattenAnnot(a, 0)
Dim g = ""
Next

Next

' save
Q.SaveToFile(PathToPDF)


Edited by CrazyTIm - 15 Sep 15 at 5:04AM
Back to Top
jpbro View Drop Down
Senior Member
Senior Member


Joined: 29 Mar 11
Status: Offline
Points: 77
Post Options Post Options   Thanks (1) Thanks(1)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 28 Aug 15 at 11:13PM
Try looping backwards, or with your current loop call Q.FlattenAnnot(1, 0) instead of (a, 0). I think when you flatten an annotation the count changes, so you are only going to flatten half the annotations using your current approach.
Back to Top
CrazyTIm View Drop Down
Team Player
Team Player
Avatar

Joined: 21 Aug 11
Location: Australia
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote CrazyTIm Quote  Post ReplyReply Direct Link To This Post Posted: 31 Aug 15 at 1:21AM
Ok that solves the problem of only half of them flattening! Thanks mate.

We still have the issue where the text is reversed (mirrored), any thoughts about this? Its not readable as the characters sometimes overlap each other and this is a real issue.

Jason.
Back to Top
CrazyTIm View Drop Down
Team Player
Team Player
Avatar

Joined: 21 Aug 11
Location: Australia
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote CrazyTIm Quote  Post ReplyReply Direct Link To This Post Posted: 31 Aug 15 at 2:29AM
Ok folks, so there is this useful function called NormalizePage(), not sure if anyone has heard about it :P

Turns out calling this before flattening annotations will prevent the text from being mirrored. I don't know if it works in all cases, but for now this seems to be working for a few different pdfs I've tested with.

Cheers, Jason.
Back to Top
CrazyTIm View Drop Down
Team Player
Team Player
Avatar

Joined: 21 Aug 11
Location: Australia
Status: Offline
Points: 29
Post Options Post Options   Thanks (0) Thanks(0)   Quote CrazyTIm Quote  Post ReplyReply Direct Link To This Post Posted: 15 Sep 15 at 4:19AM
Hi all,

I have found a different pdf where calling NormalizePage() before flattening annotations results in no annotations at all. This is frustrating, because the solution to the first issue raised a second issue :)

Can someone help me understand why calling NormalizePage() and then flatten doesn't work on this pdf. How I can solve this new problem?

pdf #2 before flattening: http://tinyurl.com/nu6gw42

pdf #2 after flattening (no annotations!): http://tinyurl.com/qhwd2g7

Thanks, Jason



Edited by CrazyTIm - 15 Sep 15 at 5:29AM
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store