We're sorry AsposeCloud doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.cloud

Draw horizontal line at the end of a line to page margin in PHP using Aspose Cloud APIs

Hi there,

I’m developing a php-based web application which should (1) generate docx, pdf and pdf/a files from a docx-template from which some text variables should be replaced and other text blocks should be discarded.

In these generated pdf and pdf/a documents, (2) straight solid horizontal lines should programmatically be drawn from the end of every text line to the right page margin. (or maybe it would be possible to do this within a docx document which could be converted to a pdf or pdf/a document)

Could the above requirements be met when using Aspose.PDF Cloud PHP SDK and Aspose.Words Cloud PHP SDK? Maybe by detecting the coordinates of the end of each line or maybe by detecting each line break?

https://docs.aspose.com/pdf/net/determine-line-break/ seems like a possible solution but it’s the .NET solution… :frowning:

If so, where can I find the documentation to do so (especially when it comes to drawing these lines) and if not, is it possible to extract all of the text from an existing pdf document line by line?

If that also couldn’t be done, what other solution could Aspose provide for the above requirements?

I was also wondering whether the PHP SDK for Words and PDF provide the same functionality as (for example) the similar Java or .NET solutions…


We are investigating your requirement. Meanwhile, please share your input document and expected output document. It will help us to address your requirement exactly.

Check out this example in docx. Take notice: the bold text would be a variable. In the second example the variable breaks the text line. Nevertheless, the horizontal line should be drawn… as far as I know this is not possible in docx, because single text lines are not defined in ooxml. So, that’s why I guess the lines should be drawn in pdf…

Happy the learn about your solution :slight_smile:

1 Like


1. replace some variables with new values
You may use Mail Merge feature to replace the variables with new values in a single API call

2. discard(delete text)
You can use replace text/delete range/delete paragraph, what you want, we have many methods to do it.

3. add a horizontal line (straight solid horizontal lines should programmatically be drawn from the end of every text line to the right page margin).
We have logged a ticket(WORDSCLOUD-1573) to investigate the requirement and suggest a solution.

Thank you, Tilal! I’m looking forward to your response.

In addition to above: would it also be possible - when generating an output docx- or pdf(/a) document from a template docx - to add table rows depending on the number of the records I’d input?


Yes, Aspose.Words Cloud API supports working with the feature. You can create a table in a Word document or add new rows to a table. Please check the following documentation article for more details.

Working with Tables

Hi Tilal,

You’ve logged ticket WORDSCLOUD-1573 to investigate my requirement and to suggest a solution. That’s great! How much time do you expect it will take to investigate?


I am afraid we cannot share any ETA at the moment. As we have recently logged the issue and it is pending for investigation in a queue. We will update you as soon as its investigation is planned and completes.

Hi there Tilal,

Is there any news already?


We have completed the analysis of your requirement. Now we will plan the feature implementation. But I am afraid we cannot share any ETA at the moment. However, we will update you as soon as any further update gets available.

To be sure: you are talking about the line drawing?

Will this be available in your Java solution when implemented?


Yes, we are talking about the WORDSCLOUD-1573, drawing horizontal lines in a Word document.

Yes, once we implement the feature in Aspose.Words REST API then it will be included in Aspose.Wods Cloud SDKs include Java SDK.


In reference to the above feature request, please note, MS Word document is a flow document and does not contain any information about its layout into lines and pages. Our Rendering Engine layouts documents into lines. But unfortunately, there is no API, which allows determining where a line starts or ends. Also, there is no such feature in MS Word.

So we regret to share with you that we have postponed your requested feature implementation till later data and we cannot share any ETA with you.

Hi there @tilal.ahmad,

Thanks for your response.

Meanwhile, I’ve decided to let my software be developed in Java, so I guess I would need your Java solutions. Now, in above feature request we talked about the possibility to programmatically draw horizontal lines from each text line to the right page margin. You’re telling me this is not possible for a docx-document.

Since pdf-documents are drawed in the first place, could you meet this requirement for pdf-documents?

Happy to hear back from you!


Thanks for your feedback. We have logged a ticket PDFCLOUD-2171 in our issue tracking system for your requirement. We will keep you updated about the ticket resolution progress in this thread.

The issues you have found earlier (filed as WORDSCLOUD-1573) have been fixed in this update. This message was posted using Bugs notification tool by Ivanov_John