Hi all,
Does the pdf document automatically add page to accomodate the text if I add new long text longer than a page,
How do I get the position x, y, page number for the next line after some text added to the document?
Any direction would be much appreciated.
I have not use Apose.pdf before.
Thanks a lot,
Tom
Hi Tom,
Hi,
I have read some programmers guides but you could help give me some advice to get started.
what object I should use Apose.Pdf or Apose.Pdf.generator for creating a pdf letter?
The pdf letter has:
- a logo (image) ,
- multiline textbox ( user will open the letter using pdf editor to add data)
- content text (only know at runtime).
- how to break a string into lines to use Addline method,
- how to know when run out of space and to call Pages.Add
- signature image, and other images
Thanks a lot,
Tomlx
Tomlx:
Does the pdf document automatically add page to accomodate the text if I add new long text longer than a page,
Tomlx:
How do I get the position x, y, page number for the next line after some text added to the document?
Tomlx:
I have read some programmers guides but you could help give me some advice to get started.what object I should use Apose.Pdf or Apose.Pdf.generator for creating a pdf letter?
Tomlx:
The pdf letter has:
- a logo (image) ,
- multiline textbox ( user will open the letter using pdf editor to add data)
- content text (only know at runtime).
- how to break a string into lines to use Addline method,
- how to know when run out of space and to call Pages.Add
- signature image, and other images
Hi Nayyer,
Thanks for you advice.
I have a specific need to write text at a fixed position. I have tried many method but they do not work for me.
For example I need to write some text to a page (like a template) which I do not know the length but do know it about from 1 to 5 lines. Then I need to write the next text say at half way down the page. I try to set the textinfor top margin for the second text but the top margin but it is margin from the last line of the first paragraph.It just the gap between the paragraphs.
I am thinking of using the table but need to know the height of the table ..so I can work out write the row for the second text.
Looking forward to your advice.
Best regards,
Tomlx
Hi Tom,
Sorry for replying you late.
Frankly speaking, I am not entirely certain about your requirement. Either you need to place text while creating PDF document from scratch or you need to place the text inside an existing PDF document ?
If you need to place text at a specific location while creating a new PDF document, then you may consider using FloatingBox. The default layout of PDF is flow layout Top-Left to Bottom-Right where as FloatingBox is placed on absolute positioning inside the PDF document. Please visit the following link for further details on Working with Floating Box (Generator)
In case you need to place text inside existing PDF document, you may consider using PdfFileMend class of Aspose.Pdf.Facades namespace, as it provides the option to specify the rectangular region where the text will be placed. Please visit the following link for further details on Add Text in an Existing PDF File (Facades) as
I am thinking of using the table but need to know the height of the table …so I can work out write the row for the second text.
In case of using tables, you may consider using FixedRowHeight property of Row class to get a float value representing row height and when placing rows inside table object, you would be sure about the number of rows placed inside the PDF, so it will be quite easy to calculate the total height of table object.
In case I have not properly understood your requirement or you have any further query, please feel free to contact. We are sorry for your inconvenience.
Hi Nayyer,
I have tried the floating box but I can not set it to the position I want. For example I want to put the box 3 inches from Top and 2 inches from left of the page but I always have the box at position 1 inch from top and 1inch from left of the page.
I modify the example from help, see the codes below.
'Instantiate Pdf instance by calling its empty constructor
Dim pdf1 As Aspose.Pdf.Generator.Pdf = New Aspose.Pdf.Generator.Pdf()
'Create section object and add it to sections collection of PDF
Dim sec1 As Aspose.Pdf.Generator.Section = pdf1.Sections.Add()
'Create FloatingBox with 108 as width and 80 as height
Dim box1 As Aspose.Pdf.Generator.FloatingBox = New Aspose.Pdf.Generator.FloatingBox(108, 80)
'add FloatingBox to paragraphs collection of section object
sec1.Paragraphs.Add(box1)
box1.BoxHorizontalPositioning = 216
box1.BoxVerticalPositioning = 142
’add sample text string to paragraphs collection of FloatingBox object
box1.Paragraphs.Add(New Aspose.Pdf.Generator.Text(“Hello.”))
'save the resultant PDF
pdf1.Save(“d:/test/test.pdf”)
Could you tell me where I go wrong.
Thanks,
Tom
Hi Tom,
Thanks for sharing the code snippet and sorry for the delay in response.
Please note that in order to specify the location for FloatingBox
, please try using the Box.Margin.Left
property to set the left margin of FloatingBox
and in order to specify the top position, please try using the Box.Margin.Top
property. Please try using the following code lines to accomplish your requirement.
[VB.NET]
' specify the left margin for FloatingBox instance
box1.Margin.Left =2
' specify the top margin for FloatingBox instance
box1.Margin.Top = 3
Also please update your code snippet as specified below.
_box1.BoxHorizontalPositioning _= BoxHorizontalPositioningType.Margin box1.BoxVerticalPositioning = BoxVerticalPositioningType.Margin
In case the problem still persists, please feel free to contact. We are sorry for this inconvenience.