Print Page | Close Window

the end of text

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=2689
Printed Date: 19 May 24 at 9:33PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: the end of text
Posted By: liveny
Subject: the end of text
Date Posted: 19 Jul 13 at 5:19AM

Hi, guys!

I need to add  a signature to the end of text. But  I don't know the length of the text  in advance. Is it possible to determine the end programmatically?




Replies:
Posted By: Ingo
Date Posted: 19 Jul 13 at 8:13PM
Hi Liveny!

Why not try this one:
http://www.quickpdflibrary.com/faq/how-do-i-apply-a-digital-signature-to-a-pdf-using-quick-pdf-library.php" rel="nofollow - http://www.quickpdflibrary.com/faq/how-do-i-apply-a-digital-signature-to-a-pdf-using-quick-pdf-library.php
You can add a signature to a file and it doesn't matter where your textcontent is.

The length of your text you can determine while using the textextraction counting the characters.

Cheers and welcome here,
Ingo



Posted By: liveny
Date Posted: 21 Jul 13 at 11:47PM
Hi! thx for your answer. May be I didn't make myself clear. The point is I don't need  a DIGITAL signature. I want to add facsimile. =) 


Posted By: liveny
Date Posted: 22 Jul 13 at 5:42AM
In short,  I want to add text to the end of the document.  


Posted By: Ingo
Date Posted: 24 Jul 13 at 11:23AM
So do it ... ;-)
Automatically it will be added to the end.



Posted By: liveny
Date Posted: 25 Jul 13 at 5:11AM
 ;-) Thx, but in my case, text added in the end of PAGE no matter what I used. Eventually I solved this problem by using GetPageText(3) - I just calculate the y-coordinate of the last  line.  If there is another way to do it, so, would you please..  ^.^ 


Posted By: AndrewC
Date Posted: 30 Jul 13 at 11:52AM
liveny,

The method you have used is the only real method.  A PDF file doesn't contain paragraphs and word positions in the way that MS Word would.  A PDF is made up of jigsaw pieces and each piece has a location of where it goes on the page.  GetPageText finds all the pieces and tries to group them together into words and lines but it is not always perfect as it is not an exact science.  For a simple letter it is more than adequate and the only real method to use.

Your code might be a little simpler if you use the Text Blocks functions.  He is some simple sample code.

            QP.LoadFromFile("aaa.pdf", "");
            for (int i = 1;i<=QP.PageCount();i++)
            {
                QP.SelectPage(i);
                int id = QP.ExtractPageTextBlocks(3);
                for (int w=1;w<=QP.GetTextBlockCount(id);w++)
                {
                    double size = QP.GetTextBlockFontSize(id, w);

                     MessageBox.Show("Page :" + i.ToString() + " Word:" + w.ToString() + "'" + QP.GetTextBlockText(id, w) + "'");
                }
                QP.ReleaseTextBlocks(id);
            }




Andrew.



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