Change font size

The PDF Creator enables you to create secure PDF documents and to view, print and process existing PDF documents.
If you have any questions about the installation and usage of the PDF Creator please post them here.
Post Reply
ryanfure
Posts: 8
Joined: Thu Jan 06 2005
Location: Wisconsin

Change font size

Post by ryanfure »

Hello,

I am using the PDF Creator in a custom application written in C++. I am creating a report in the application and am trying to use 2 different font sizes within a page. I am using the following code to change the sizes but the sizes stay the same.

Here is the font for the header:
pdfX->ObjectAttributeStr(wsObject, (WideString)"TextFont", (WideString)"Courier-Bold,10,0,0,0");

And the font for the body of the report:
pdfX->ObjectAttributeStr(wsObject, (WideString)"TextFont", (WideString)"Courier,8,0,0,0");

where wsObject is the name of a Text Object I am trying to modify.


The type face change between the two calls but the font sizes do not change (I think they always print in font size 12). I have tried multiple sizes but the results are the same, always size 12. Is there a different way to change to font size other then using the Text Object attributes?
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

Which version of the PDF Creator are you using?
ryanfure
Posts: 8
Joined: Thu Jan 06 2005
Location: Wisconsin

Post by ryanfure »

I am using PDF Creator version 2.0.
Jose
Amyuni Team
Posts: 553
Joined: Tue Oct 01 2002
Contact:

Post by Jose »

Hello,

Have you tried different type faces? I tried a code snippet similar to yours and I was able to change the font size.

Hope this helps?
ryanfure
Posts: 8
Joined: Thu Jan 06 2005
Location: Wisconsin

Post by ryanfure »

Thanks for the response Jose.

Yes, I have tried multiple type faces including Times New Roman and Arial, but none have worked for changing font sizes. Is there a specific font that you used that worked that I could try?
Jose
Amyuni Team
Posts: 553
Joined: Tue Oct 01 2002
Contact:

Post by Jose »

Hello,

Can you send a sample of the PDF document you are using and the name of the object you are trying to modify to support@amyuni.com?

I'll let you know what I find.

Thanks
A.Hammers.
Posts: 4
Joined: Mon Jan 03 2005

Same problem

Post by A.Hammers. »

Hello!

I have the same problem here with version 2.0 (downloaded 2005-05-03)
I already tried a few different PDFs, fonts, weights and sizes, but I always get 10pt(?) font.

Here is my code:
pdf.CreateObject ot, s
pdf.ObjectAttribute(s, "LEFT") = xPos - pMarkerSize * 100
pdf.ObjectAttribute(s, "TOP") = yPos - pMarkerSize * 100
pdf.ObjectAttribute(s, "RIGHT") = xPos + pMarkerSize * 100
pdf.ObjectAttribute(s, "BOTTOM") = yPos + pMarkerSize * 100
pdf.ObjectAttribute(s, "STROKEWIDTH") = pMarkerBorder
pdf.ObjectAttribute(s, "TextFont") = "Courier,14,1000,0,0"
pdf.ObjectAttribute(s, "Text") = Trim(Str(pNextElementNumber))
A.Hammers.
Posts: 4
Joined: Mon Jan 03 2005

Post by A.Hammers. »

I forgot:

The font face (Courier) IS used correctly.

Maybe there is a problem with , and . on german language systems when converting the font size string to a float value?
A.Hammers.
Posts: 4
Joined: Mon Jan 03 2005

finally

Post by A.Hammers. »

Finally: problem solved, but should be fixed within the control!

This does not change font size:
pdf.CreateObject ot, s
pdf.ObjectAttribute(s, "LEFT") = xPos - pMarkerSize * 100
pdf.ObjectAttribute(s, "TOP") = yPos - pMarkerSize * 100
pdf.ObjectAttribute(s, "RIGHT") = xPos + pMarkerSize * 100
pdf.ObjectAttribute(s, "BOTTOM") = yPos + pMarkerSize * 100
pdf.ObjectAttribute(s, "STROKEWIDTH") = pMarkerBorder
pdf.ObjectAttribute(s, "TextFont") = "Courier,48,1000,0,0"
pdf.ObjectAttribute(s, "Text") = Trim(Str(pNextElementNumber))
pdf.RedrawObject s

But this does:
pdf.CreateObject ot, s
pdf.ObjectAttribute(s, "LEFT") = xPos - pMarkerSize * 100
pdf.ObjectAttribute(s, "TOP") = yPos - pMarkerSize * 100
pdf.ObjectAttribute(s, "RIGHT") = xPos + pMarkerSize * 100
pdf.ObjectAttribute(s, "BOTTOM") = yPos + pMarkerSize * 100
pdf.ObjectAttribute(s, "STROKEWIDTH") = pMarkerBorder
pdf.ObjectAttribute(s, "Text") = Trim(Str(pNextElementNumber))
pdf.RedrawObject s
pdf.ObjectAttribute(s, "TextFont") = "Courier,48,1000,0,0"

You just have to set the font size after redrawing the object. Not very pretty, but working. Please fix this!
ryanfure
Posts: 8
Joined: Thu Jan 06 2005
Location: Wisconsin

Post by ryanfure »

I received a fix from the support team. You will need to set the text in the object before the the font is set. So in you example:

This does not change font size:

pdf.CreateObject ot, s
pdf.ObjectAttribute(s, "LEFT") = xPos - pMarkerSize * 100
pdf.ObjectAttribute(s, "TOP") = yPos - pMarkerSize * 100
pdf.ObjectAttribute(s, "RIGHT") = xPos + pMarkerSize * 100
pdf.ObjectAttribute(s, "BOTTOM") = yPos + pMarkerSize * 100
pdf.ObjectAttribute(s, "STROKEWIDTH") = pMarkerBorder
pdf.ObjectAttribute(s, "TextFont") = "Courier,48,1000,0,0"
pdf.ObjectAttribute(s, "Text") = Trim(Str(pNextElementNumber))
pdf.RedrawObject s

But this should:

pdf.CreateObject ot, s
pdf.ObjectAttribute(s, "Text") = Trim(Str(pNextElementNumber))
pdf.ObjectAttribute(s, "TextFont") = "Courier,48,1000,0,0"

pdf.ObjectAttribute(s, "LEFT") = xPos - pMarkerSize * 100
pdf.ObjectAttribute(s, "TOP") = yPos - pMarkerSize * 100
pdf.ObjectAttribute(s, "RIGHT") = xPos + pMarkerSize * 100
pdf.ObjectAttribute(s, "BOTTOM") = yPos + pMarkerSize * 100
pdf.ObjectAttribute(s, "STROKEWIDTH") = pMarkerBorder


Give this a try, it worked for my code and should make yours a little cleaner.
Post Reply