Free Support Forum -

Printing formatted text to existing PDF

I have searched all over and not been able to find a solution to my problem.
My problem is this:
I am dynamically generating a pdf that does not take up a fixed portion of the page (the page length could change), and I would like to append formatted text (indentions, bold, numbering, bullets, etc.) to where the dynamic portion stopped. The resulting pdf would have the page breaks in the correct place.
The end result would look like a seamless pdf document.
(I can insert full pages into another document, but this is not what i want since there could possibly be a lot of whitespace)

I have found the code on the aspose site here
This seems like a great start. But I couldn’t find any information on how to output the the TextSegment to an existing (or blank) pdf. I feel like the aspose.pdf.kit api is very sparse and incomplete.


Hi Brannan,

Thank you very much for considering Aspose.

Could you please share the sample input PDF file(s) and a sample of your required output PDF file, so we could better understand your requirement and guide you accordingly?


The file base.pdf is the base file
And the file add.pdf is the file I want to add to the base file.
I want the beginning of add.pdf to start the line after the word “Document.” in base.pdf.
I have to preserve the exact formatting of add.pdf

The resulting file should look like result.pdf

Hi Brannan,

Thank you very much for sharing the sample PDF files. I’m sorry to share with you that this requirement can’t be fulfilled at the moment. However, I have logged a new feature request as PDFKITJAVA-31085 in our issue tracking system. Our team will investigate it and you’ll be updated via this forum thread once it is supported in future. Nevertheless, I’m afraid, this might not be available in short time.

We’re sorry for the inconvenience.