|
Rank: Member Groups: Member
Joined: 4/22/2011 Posts: 17
|
Hi, I want to insert images into various parts of the PDF document I am trying to create. Is there a way to load any sized image and to have it reduce to a particular "container". I am writing an application for customers to insert photos into a form and I am then trying to print them out into a PDF. I do not want to have the customer to have to resize every picture - I would like to do this within PDF creator.
Thanks
Adrian
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, To insert image you would use AcmImage object: http://doc.essentialobjects.com/library/4/acm/advanced%20formatting/image.aspxTo place it inside another "container" you would simply place the AcmImage object inside another AcmXXX object. For example, if you want to place it inside a table cell, you would place it inside an AcmTableCell object:
Code: C#
//Initialize the image
AcmImage image = new AcmImage(....);
//Place the image inside a table cell
cell.Children.Add(image);
To resize it the image, you would set the image's Width and Height:
Code: C#
//Set the image to 3 inch by inch
image.Style.Width = 3;
image.Style.Height = 3;
Hope this helps. Thanks
|
|
Rank: Member Groups: Member
Joined: 4/22/2011 Posts: 17
|
Thanks - works perfectly!!
Adrian
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Great. Hope you are convinced that our product can do anything you wanted to do now. : )
|
|
Rank: Member Groups: Member
Joined: 4/22/2011 Posts: 17
|
Absolutely, I shall be purchasing tomorrow morning. Thanks for all your help.
Adrian
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Glad to hear that. Please feel free to let us know if you need anything else.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 4/22/2011 Posts: 17
|
Hi Guys,
Have recently bought your create pdf software - great product. What I am trying to do is create a box which is one inch from top to bottom but make the text flow from the top (vertically aligned). I have tried this by means of a block and a table and both of them still have the text centrally aligned. The code I am using is as follows (visual basic):
Dim Table8 As New AcmTable(3.0) Dim row8 As New AcmTableRow() Dim cell8 As New AcmTableCell(New AcmText("Not Specified"))
cell8.Style.VerticalAlign = AcmVerticalAlign.Top Table8.Style.FontName = "arial narrow" Table8.Style.FontSize = 12.0F Table8.Style.LineHeight = 1.0F
'Set the grid line type Table8.GridLineType = AcmGridLineType.All 'Set the grid line style, color and width Table8.GridLineInfo = New AcmLineInfo(AcmLineStyle.Solid, System.Drawing.Color.LightGray, 0.01F)
row8.Cells.Add(cell8) Table8.Rows.Add(row8)
render.Render(Table8)
Please can you tell me where I'm going wrong. I also used the verticalalignment method at the table level but it made no difference.
Just to be clear, the resultant code should display a box with "Not Specified" on the top line and then several lines of white space and then the bottom border. By the way, I haven't found a simple way of entering a blank line in a table. If I insert a "" then it gets ignored. I have had to print a character and change the forecolor to white to make it invisible. I assume there must be an easier way!!
Thanks
Adrian
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Thank you very much for your business. Cell contains text blocks, text block contain lines, line contains the actual text. cell.Style.VerticalAlign specifies the vertical alignment of cell contents in a cell, that is text blocks against the table cell in your case.
In your case, both your table cell and text block are 1 inch in height (because you set your line height to 1 and only have a single line of text). So setting vertical alignment is meaningless in your case. To have a vertical alignment, your table cell must be taller than the cell contents. That can occur if:
1. You explicitly set table cell's height, or 2. There are other cells in the same raw that are taller;
The actual text always aligns to the middle of a text line. That's why it appears to be center aligned for you.
To enter a line break, use AcmParagrah or AcmLineBreak, To enter a blank line, use AcmText(" ") but set the AcmText's AutoTrim to false (the default value is true).
Hope this helps.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 4/22/2011 Posts: 17
|
Thanks for your quick reponse. I sort of understand what you are saying!! How do I explicitly set the size of the cell? I've tried:
cell8.Style.VerticalAlign = AcmVerticalAlign.Top cell8.Style.LineHeight = 5.0F
but I've obviously misunderstood something.
Thanks
Adrian
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
I really don't understand why you keep using LineHeight but ignores Height. ;)
LineHeight is the height of a text line. It's not the height of the object.
BTW: Please start a new thread for a new topic in the future. Text alignment is unrelated to the original topic about image.
Thanks
|
|
Rank: Member Groups: Member
Joined: 4/22/2011 Posts: 17
|
OK thanks
|
|