Free Support Forum -

Print data in to PDF using ASPOSE

We have the following requirement.

We have different designed forms with different customized controls. The customized controls include text boxes, multi line text boxes, option controls , drop down list etc…as shown in the picture (templateform)

The multi line text boxes would be given space for limited number of lines. If the user enters more data the multi line text boxes will have scroll bar in the forms as shown in the picture (templateform)

The user can enter data in to the different instances of the form as swhon in the figure (templateforminstance).

The data of every instance would be stored in the data base accordingly. This is being used to display the forms and as well do the printing of the forms.

It is internally storing the locations(top and left) of each and every data control.

Our requirement is to display the data in a pdf completly as shown in the template form as shown in the figure (ExpectedPrint).

As of now we are calculating the positions of all the data items and then adding to the pdf in the form of table elements. The forms would show only 3 lines for the multi line text boxes and thus the top locations are set based on that in the database.

But the print should show all the lines. So runtime calcuation is being done.

But the challenge is calculating the locations of each and every data item at runtime based on the data filled in each and every control. Since the multi line text boxes can have more number of lines than those that are displayed. Currently the data is being overlapped as shown in the figure (overlaptext)

Can you please let us know if we can use any of the features of aspose to solve our requirement with out any problems

Please let us know if we need to provide any more details.

Hi Deepika,

Thanks for contacting support.

The default layout of PDF file is flow layout and all elements/objects are added in Top-Left to Bottom-Right manner. So as per your requirement, if you create individual Text object for each text control, the text object will automatically be adjusted/re-sized to accommodate/display all text lines. By the way, you may try using FloatingBox objects to display the contents of text box control. FloatingBox control support Obsolete positioning and they can be placed on any location of the PDF file. You may check the following link for further details on Working with Floating Box (Generator)

In case the problem still persists, please share some code snippet/sample project which can help us in replicating this problem. We are sorry for this inconvenience.

We are currently using the aspose version and In order to resolve the problem posed above we tried to rewrite the entire code using the Aspose.Tables. <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

We are using Aspose.Cells (Table rows cells) in order to print the text data of every control. In order to have the exact screen shot as shown in the screen shot (ExpectedPrint.png ) we observe that we need to use the relative position type (Aspose.Pdf.PositioningType.PageRelative). Then only we are able to set the table margin and width.

If so we observed that all the controls start printing at zero position of the page and thus overlap. In order to go ahead we need to explicitly specify the top location of each and every text data to be printed which would result in problems already specified in the above post as shown in overlaptext.png .

Is there any to print the text data sequentially by having the position types set to PageRelative?

Your reply will be appreciated.

Hi Deepika,

Thanks for sharing the details.

As per my understanding, in your current scenario, you may consider simply adding Text paragraphs in PDF file and specify Top margin information for each paragraph. You can also specify the positioning type of each paragraph as ParagraphRelative using Text.PositioningType property. For further information, please visit
Set Paragraph Margins. Furthermore, when using table cells, you may skip the code line where you are specifying the PositioningType as PageRelative.

In case the problem still persists, please share the code snippet so that we can test the scenario at our end. We are sorry for this inconvenience.