Print Page | Close Window

Problem with adding text to a existing PDF

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=1057
Printed Date: 25 Jun 25 at 5:49PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Problem with adding text to a existing PDF
Posted By: sharath77
Subject: Problem with adding text to a existing PDF
Date Posted: 07 Apr 09 at 1:36PM
Hello,
 
I am trying to add some text to a existing PDF using a C# (.NET 1.1 framework)  application. Below is my code snippet. But the generated PDF does not contain the text written, but contains the contents of the source PDF as well as a blank new page.
 
string strSource = @"D:\Test\1231_001.pdf";   
string strDest = @"D:\Test\outputsample.pdf";
pdf = new QuickPDFClass();   
if (pdf.Unlocked() == 0)
{
 nResult = pdf.UnlockKey("My key");
}
DA_HANDLE = -1;//op_add
DA_HANDLE = pdf.DAOpenFile(strSource, "");
if (DA_HANDLE <= 0)
{
 MessageBox.Show("Error occured while opening");
 return;
}

nResult =pdf.DANewPage(DA_HANDLE);
nResult =pdf.SelectPage(pdf.PageCount());
pdf.SetTextColor(1,0,0);
pdf.DrawText(10,10,"Email Subject");
nResult= pdf.DASaveAsFile(DA_HANDLE,strDest);
if (nResult==1)
{
 MessageBox.Show("Saved");
}
pdf.DACloseFile(DA_HANDLE);
DA_HANDLE = 0;
 
Any help with this regard is greatly appreciated.
 
Thanks in advance.



Replies:
Posted By: Ingo
Date Posted: 11 Apr 09 at 5:45PM
Hi!

You're mixing DA-functions and "not-DA-functions".
If you're opening the file with DAOpenFile then you should select your page with DAFindPage. My advice for you is: Don't use the DA-functions first. Earlier versions of QuickPDF had sometimes few memory problems. With the DA-functions these behaviors should be avoided but with the current version this shouldn't be necessary anymore. So please no mixing!

Cheers, Ingo


Posted By: sharath77
Date Posted: 27 Apr 09 at 11:11AM
Thanks for the reply, but the version we are using is 4.42.1.1, is this version safe enough to use with non DA functions, or would there be memory problems.


Posted By: Ingo
Date Posted: 27 Apr 09 at 11:35AM
Hi!

You'll have a lot of probs in the future! More and more...
All new pdf-specs aren't supported in your very old version.
You should update as quick as possible.
In your version there are a lot of memory probs.

Cheers, Ingo



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