Print Page | Close Window

Flatten Annotations

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=2441
Printed Date: 01 Jul 24 at 5:14AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Flatten Annotations
Posted By: CrazyTIm
Subject: Flatten Annotations
Date Posted: 01 Nov 12 at 3:46AM
Hi,

QuickPDF API has a function FlattenFormField... what about annotations (lines, text, etc) or will these be flattened as well when I use FlattenFormField?

My problem is that I need to flatten annotations because they cannot be seen using the native PDF viewer on the iPad.

Regards, Jason.



Replies:
Posted By: CrazyTIm
Date Posted: 01 Nov 12 at 4:29AM
Note: the RenderDocumentToFile function does not render annotations either!

As part of our workflow we add markup to PDFs (annotations). We then need to see our marked-up PDFs on the iPad. Any ideas fellas?


Posted By: CrazyTIm
Date Posted: 02 Nov 12 at 3:04AM
I have found a solution, but you must have Adobe Acrobat Professional installed. I am using VB.NET to reference the the Adobe Acrobat 10.0 Type Library to interface with Acrobat.

Here's my code:

Private G_PDF_App As Acrobat.CAcroApp
        ''' <summary> Flatten anotations and objects in the PDF. Warning: unreversible changes! This makes annotations viewable nativly on the iPad. </summary>
        Public Sub PDF_Flatten(ByVal Path As String)

            Try
                If G_PDF_App Is Nothing Then
                    G_PDF_App = CType(CreateObject("AcroExch.App"), Acrobat.CAcroApp)
                End If

                Dim AVDoc As Acrobat.CAcroAVDoc
                Dim PDDoc As Acrobat.CAcroPDDoc
                Dim jso As Object

                PDDoc = CType(CreateObject("AcroExch.PDDoc"), Acrobat.CAcroPDDoc)

                If PDDoc.Open(Path) Then

                    ' Create AV doc from PDDoc object 
                    AVDoc = PDDoc.OpenAVDoc("TempPDF")

                    ' Hide Acrobat application so everything is done in silent mode 
                    G_PDF_App.Hide()

                    ' Create Javascript bridge object 
                    jso = PDDoc.GetJSObject

                    Dim tg = jso.flattenPages()

                    If Not PDDoc.Save(1, Path) Then
                        Log.WriteLine("could not flatten file")
                    End If

                    AVDoc.Close(0)
                    PDDoc.Close()
                End If

                jso = Nothing
                PDDoc = Nothing

                G_PDF_App.Exit()
                G_PDF_App = Nothing

            Catch ex As Exception
                Log.WriteLine("Error: PDF_Flatten")
            End Try

        End Sub

Hope it helps!


Posted By: AndrewC
Date Posted: 02 Nov 12 at 9:02AM
We will look into adding QP.FlattenAnnotation into a future version of Quick PDF Library.

Andrew.


Posted By: CrazyTIm
Date Posted: 04 Nov 12 at 9:45PM
Thanks Andrew.


Posted By: CrazyTIm
Date Posted: 10 Jun 15 at 6:56AM
Hi Andrew, does the feature QP.FlattenAnnotation exist yet?


Posted By: jpbro
Date Posted: 15 Jun 15 at 12:05AM
Yes, it was introduced in QPDF 9.14 according to the document (the function is called FlattenAnnot though, not FlattenAnnotation). See:

http://www.debenu.com/docs/pdf_library_reference/FlattenAnnot.php" rel="nofollow - http://www.debenu.com/docs/pdf_library_reference/FlattenAnnot.php


Posted By: CrazyTIm
Date Posted: 18 Jun 15 at 2:56AM
OK, I'll check it out.



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