Print Page | Close Window

Problems adding text to a existing PDF file

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=1699
Printed Date: 26 Nov 24 at 4:08AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Problems adding text to a existing PDF file
Posted By: Tharos
Subject: Problems adding text to a existing PDF file
Date Posted: 05 Jan 11 at 9:06AM
Hii everyone:

I have other problem with my pdfs. I´m adding a Watermark in PDF like this:

 for (int i = 1; i <= paginas; i++)
 {
      try
    {
                  QP.SelectPage(i);

                   int capa1=QP.NewLayer();
                    QP.SetTextSize(20);
                    QP.SetTextColor(255, 0, 0);
                    QP.SetTransparency(50);
                    QP.DrawRotatedText(80,250,45,"Distribución Limitada");
                     int OC1 = QP.NewOptionalContentGroup("Conf");
                     QP.SetLayerOptional(OC1);
                     QP.MoveLayer(descriptor, 1);
                     QP.SetOptionalContentGroupVisible(OC1, 0);
                      QP.SetOptionalContentGroupPrintable(OC1, 1);
    }

After this treatment, I have my pdfs with watermark but, in some pdf file the text is correct and in ohters files the text is flipped, as a mirror of the original text.

For Example:


Image with the text CORRECT:




Image with the text INCORRECT:




I dont now why the instruction "DrawRotatedText" modifiy this text in some pdf files. I Have done proofs changing position text, angle of rotation.. and nothing!! the image is not correct!!.

Somebody knows a solution?

Thanks!!!!





Replies:
Posted By: Ingo
Date Posted: 05 Jan 11 at 9:11AM
Hi!

So the pdf-documents are already rotated before...
At the beginning/before drawing anything anywhere
you should determine where you want to start:
Try SetOrigin
You should read here:
http://www.quickpdflibrary.com/help/quickpdf/MeasurementAndCoordinateUnits.php

Cheers, Ingo



Posted By: Tharos
Date Posted: 05 Jan 11 at 9:42AM
thanks for the fast reply. I put the instruction before DrawingText, but only change the position of the text but, it still appear wrong...


Posted By: Ingo
Date Posted: 05 Jan 11 at 3:18PM
You have to check directly into the pdf-content (best to read it into a stream or string once) if there's a string "rotate". If it's so then you have to change your watermark.

Cheers, Ingo


Posted By: Tharos
Date Posted: 05 Jan 11 at 3:46PM
in my pdf-content?? there are only words and searching in that document, the string or the word "rotate" doesnt exist.

You say that i have to read all the pdf using a stream (for example in VIsual Studio) and find the string rotate?? If searching in that document, I dont found the word it is not necessary to read the document arround a stream, does not?

I dont understand....


Posted By: Ingo
Date Posted: 05 Jan 11 at 5:39PM
Hi!

The REAL content!
Open the pdf with notepad and you'll know what i mean.



Posted By: Tharos
Date Posted: 07 Jan 11 at 7:13AM
the word "Rotated" or "Rotate" or any possible similar word does not exist in the document.... whats happened now??

Thanks!


Posted By: Ingo
Date Posted: 07 Jan 11 at 7:27AM
Hi!

So you should upload the prob-pdf and a detailed error-description
on the official support forum at www.quickpdflibrary.com

Cheers, Ingo


Posted By: Tharos
Date Posted: 07 Jan 11 at 8:25AM
where? I dont find these forum..

Cheers!

PD: here is the pdf that causes problem using the code write in this post.

http://www.host-files.com/i/download.php?file=848Watermark.pdf - http://www.host-files.com/i/download.php?file=848Watermark.pdf


Posted By: Ingo
Date Posted: 07 Jan 11 at 11:54AM
Tharos!
Where?

Here:
www.quickpdflibrary.com
...
then "support"
...
then ...

Cheers, Ingo



Posted By: Tharos
Date Posted: 07 Jan 11 at 12:00PM
OK i know but if I go to support and then forum, the page that appear is the index of this forum... what link is??


Posted By: Ingo
Date Posted: 07 Jan 11 at 12:05PM
Ok...
I've looked again for you:
http://www.quickpdflibrary.com/support/support-query.php



Posted By: Tharos
Date Posted: 07 Jan 11 at 12:19PM
thanks thats works!! I send the problem and now waiting for an answer...

cheers!!!


Posted By: Dimitry
Date Posted: 15 Jan 11 at 10:20PM
Please try to use 
  QP.CombineLayers();
for each page, before adding new text.


-------------
Regards,
Dmitry


Posted By: Jhon
Date Posted: 02 Feb 11 at 1:20PM
Hi:
i have same problems, even you use SetOrigin, the Origin is not same in some pdf files.
if you SetOrigin(0), the Origin is top left in some pdf files, but is bottom left in other pdf files.

i try to use CombineLayers(); but the problem is same.

every one can help me?



Posted By: Ingo
Date Posted: 02 Feb 11 at 2:00PM
Hi!

The keyword could be "rotated" ...
Please read the thread from beginning ;-)
...or upload some samples.

Cheers, Ingo



Posted By: Dimitry
Date Posted: 02 Feb 11 at 3:03PM
Before making changes inside page we should define co-ordinate system using http://www.quickpdflibrary.com/help/quickpdf/SetOrigin.php - SetOrigin() .
Also page can be rotated using http://www.quickpdflibrary.com/help/quickpdf/RotatePage.php - RotatePage() .
And before applying changes to existing PDF we should obviously check existing rotation for each page using http://www.quickpdflibrary.com/help/quickpdf/PageRotation.php - PageRotation() .


-------------
Regards,
Dmitry


Posted By: AndrewC
Date Posted: 13 Jul 14 at 4:47AM
We have added a function called NormalizePage() that should fix all of these types of issues.

If you want to add text or other content to a PDF then you should add a call to QP.NormalizePage(0); after calling QP.SelectPage().


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