Print Page | Close Window

FlattenAnnot

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3169
Printed Date: 03 May 24 at 3:46PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: FlattenAnnot
Posted By: CrazyTIm
Subject: FlattenAnnot
Date Posted: 28 Aug 15 at 6:34AM
Hi guys, we found some issues with FlattenAnnot... (v11.15)

Here is the pdf:

Before:  http://tinyurl.com/ok8j2rd" rel="nofollow - http://tinyurl.com/og3hffn

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" rel="nofollow - 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)



Replies:
Posted By: jpbro
Date 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.


Posted By: CrazyTIm
Date 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.


Posted By: CrazyTIm
Date 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.


Posted By: CrazyTIm
Date 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" rel="nofollow - http://tinyurl.com/nu6gw42

pdf #2 after flattening (no annotations!):  http://tinyurl.com/qhwd2g7" rel="nofollow - http://tinyurl.com/qhwd2g7

Thanks, Jason




Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk