SetTextSize()
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=987
Printed Date: 12 Jun 25 at 10:14AM Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com
Topic: SetTextSize()
Posted By: harvey
Subject: SetTextSize()
Date Posted: 28 Oct 08 at 1:53PM
In the following Visual FoxPro 9.x code snippet, I'm attempting to open an existing PDF document and add at the top of the page the text that reads "Text to Draw". I'm able to do this without any problems. The text appears but I am not able to control the text size.
All attempts to change the font size have failed. I have tried loading other fonts (both True-Type and ATM) nad both say they load although they don't show up. It is like the commands are being received bot the output is not rendering anything to do with font control.
oPDF=CreateObject("ised.quickpdf") oPDF.UnlockKey("myPrivateKey") oPDF.LoadFromFile("mydoc.pdf") oPDF.SetOrigin(1) && TopLeft nFont = oPDF.AddStandardFont(8) oPDF.SelectFont(nFont) oPDF.SetTextSize(6) oPDF.SelectPage(1)
oPDF.DrawText(10,10,"Text To Draw") oPDF.SaveToFile("c:\MyNewDoc.pdf")
Any help would be greatly appreciated...
--Harvey
|
Replies:
Posted By: Ingo
Date Posted: 29 Oct 08 at 3:11AM
Hi Harvey,
thanks for joining here. You're welcome! Perhaps you should change the sequence to get success... Here an example how i'm doing it: QP.NewPage; QP.SetPageSize('A4') QP.SetTextSize(10); QP.AddStandardFont(0); QP.DrawText(50,sh,s);
Best regards, Ingo
|
Posted By: harvey
Date Posted: 29 Oct 08 at 11:43AM
Here is what I just tested. It does not work! The font size is not changing. Do you think it might have to do with my running Acrobat 5 on my system? Otherwise, I have no clue...
The StandardFont is changing, the NewPage is being created and the file is being saved so a lot is working correctly.
I also tested making Barcodes and that seems to be working and I can adjust the size of them.
Setting the Origin works... very strange!!
And just to rule out scope, I declared a var lnFontSize public and set it to a value of 6. Then passed it to the SetTextSize(lnFontSize) and still no go - still does not work.
I'm working with Version 5.22
oPDF=CreateObject("ised.quickpdf") oPDF.UnlockKey("myKey") oPDF.NewPage() oPDF.SetPageSize('A4') oPDF.SetTextSize(6) oPDF.AddStandardFont(4) oPDF.DrawText(10,10,"Text To Draw") oPDF.SaveToFile("c:\MyNewDoc.pdf")
Thanks for your reply. Any other suggestions would be greatly appreciated.
--Harvey Venice
|
Posted By: Ingo
Date Posted: 30 Oct 08 at 2:32AM
Hi Harvey!
Okay... I've tried it now by myself... It works. With my testcode you'll create six lines with "Textsize xxx" beginning at the top left corner.
Cheers, Ingo
The code:
QP := TiSEDQuickPDF.Create; try QP.UnlockKey('MyRegKey...'); QP.SetOrigin(1); QP.SetPageSize('A4');
QP.AddStandardFont(1); QP.SelectFont(1); QP.SetTextSize(6); QP.DrawText(10,10,'Textsize 6'); QP.SetTextSize(8); QP.SelectFont(4); QP.DrawText(10,30,'Textsize 8'); QP.SetTextSize(10); QP.SelectFont(4); QP.DrawText(10,50,'Textsize 10');
QP.AddStandardFont(3); QP.SelectFont(3); QP.SetTextSize(6); QP.DrawText(10,70,'Textsize 6'); QP.SetTextSize(8); QP.SelectFont(4); QP.DrawText(10,90,'Textsize 8'); QP.SetTextSize(10); QP.SelectFont(4); QP.DrawText(10,110,'Textsize 10'); QP.SaveToFile('c:\temp\textsize.pdf'); finally QP.Free; end;
|
Posted By: harvey
Date Posted: 30 Oct 08 at 1:25PM
I tried your example. It does NOT work here.
I suspect this is an incompatibility with Visual Foxpro. I have heard of such issues before using other ActiveX products. It has something to do with the way the tool is exposed in memory so say some of the FoxPro message boards. I don't know more details.
But thank you very much for your efforts. At this point I'm going to try Amuni. They state they have a product that works and still support it in case I have further problems.
--Harvey
|
Posted By: harvey
Date Posted: 30 Oct 08 at 2:33PM
Let me retract my prior statement - IT WORKS!!
So as I started to read how to install the Amuin product, I touched across a statement that never crossed my mind... the need to register the control into the Visual FoxPro application as an OLEControl. I'm not sure if this is normally required for VFP or other platforms but after reading it I cane back to QuickPDF and under Tools > Options > Controls > ActiveX > Add and selecting the Ised.dll file and saving it back, your example worked.
However, and this is a bit strange... in the list of installed controls neither the QuickPDF nor the Ised control shows up in the list. But I now have a control listed that has NO NAME - it is blank where all the other controls all show a name.
Sorry for ever doubting you or the tool... Look forward to being able to contribute my results in the future.
Strange... Barcodes and text without having control worked before at all.... Just another programmers mastery.
Thanks again, --Harvey
|
Posted By: lcarrere
Date Posted: 31 Oct 08 at 12:19PM
Harvey I suggest to do like that in vfp:
PRIVATE oIsed as Object
oIsed = CREATEOBJECT("Ised.QuickPDF")
WITH oIsed as Ised.QuickPDF && Here just type . to get intellisense working ENDWITH
Best regards,
Loïc
|
Posted By: harvey
Date Posted: 31 Oct 08 at 9:39PM
Yea, thanks for your suggestion. Actually before re-registering the control within VFP, making IntelliSense work had no effect. After doing the CreateObject() in the command window, I was able to drill down into the methods, set properties and read back the revised values. After registering it everything works perfectly. Live and learn...
|
|