Hi,
we are currently using Aspose.Words for Java and Aspose.Words for JasperReports to create dynamic reports in our web application.
I wanted to ask this: is there any way to insert in the jxml template we use to create the final report a field to be recognized as a valid signature field by Adobe Acrobat?
In this way, then, the PDF generated could be digitally signed directly without need to manually insert signature fields.
Hi Matteo,
Hi,
Hi Matteo,
Thanks for your inquiry. You can easily add a signature field to an existing PDF document using Aspose.Pdf Kit for java. Please check following documentation link for the details/code snippet. Hopefully it will serve the purpose.
Please feel free to contact us for any further assistance.
Best Regards,
Hi,
thanks for your prompt answer.
I’ve checked the docs, and it would seem that Aspose.Pdf.Kit is what we need. As far as I can tell from the example, it requires the exact coordinates of where to place the fields, wouldn’t it be possibile to use some kind of placeholder text like “SIGNATURE” to be the replaced by the signature field?
Thanks again for your help.
Hi Matteo,
Hi,
Hi Matteo,
mtassinari:Hi,
thanks for your prompt answer.
I've checked the docs, and it would seem that Aspose.Pdf.Kit is what we need. As far as I can tell from the example, it requires the exact coordinates of where to place the fields, wouldn't it be possibile to use some kind of placeholder text like "__SIGNATURE__" to be the replaced by the signature field?
Thanks again for your help.
mtassinari:
I’ve checked the docs, and it would seem that Aspose.Pdf.Kit is what we need. As far as I can tell from the example, it requires the exact coordinates of where to place the fields, wouldn’t it be possibile to use some kind of placeholder text like “SIGNATURE” to be the replaced by the signature field?
Hi Matteo,
Thanks for your patience.
I am pleased to share that new autoported Aspose.Pdf for Java supports the feature to search particular text string and get its coordinates. Then you can place Signature field on that particular location and replace the placeholder text with blank characters. For further information, please visit
- Search and Get Text from the Pages of PDF Document
- Replace Text in pages of a PDF Document
- Add Form Field in a PDF Document
So I recommend you to please try using the latest release of Aspose.Pdf for Java 4.0.0 to accomplish your requirements. In the event of any further query, please feel free to contact.
It seems exactly what we are looking for, thanks!
Hi Matteo,
textFragment.Page.Number);
codewarior:Hi Matteo,When searching particular string through all pages of PDF document, you can get the page number information on which the particular string occurs using textFragment.Page.Number property. Something similar toConsole.WriteLine("Page : {0} ", textFragment.Page.Number);
mtassinari:It would seem that the class TextFragment in Aspose.Pdf for Java does not have any property like that, nor can I find any getter which would return the current page in which the text fragment itself is located.
codewarior:I shared the code snippet related to Aspose.Pdf for .NET and I am afraid the current release of Aspose.Pdf for Java does not include a method which can return the page number on which a particular text string exists. However as a workaround, you may consider iterating through each page of PDF file and search the text string. When traversing through individual page, you will have the track of page number on which the TextFragment exists.
Hi Matteo,
Hi Matteo,
//open document<o:p></o:p>
com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document("input.pdf");
//create TextAbsorber object to find all instances of the input search phrase
com.aspose.pdf.TextFragmentAbsorber textFragmentAbsorber = new com.aspose.pdf.TextFragmentAbsorber("sample");
//accept the absorber for first page of document
pdfDocument.getPages().accept(textFragmentAbsorber);
//get the extracted text fragments into collection
com.aspose.pdf.TextFragmentCollection textFragmentCollection = textFragmentAbsorber.getTextFragments();
//loop through the Text fragments
for(com.aspose.pdf.TextFragment textFragment : (Iterable)textFragmentCollection)
{
// iterate through text segments
System.out.println(textFragment.getPage().getNumber());
for(com.aspose.pdf.TextSegment textSegment : (Iterable)textFragment.getSegments())
{
System.out.println("Text :- " + textSegment.getText());
}
}
Please feel free to contact us for any further assistance.
Best Regards,
Hi Tilal,
Hi Navnath,
//open document<o:p></o:p>
Document pdfDocument = new Document("Input.pdf");
//create TextAbsorber object to find all instances of the input search phrase
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber("Aspose");
//accept the absorber for all the pages
pdfDocument.Pages.Accept(textFragmentAbsorber);
//get the extracted text fragments
TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;
//loop through the fragments
foreach (TextFragment textFragment in textFragmentCollection)
{
Console.WriteLine("Text : {0} ", textFragment.Page.Number);
}