We are currently looking for a solution that allows us to convert a PDF Template into PDF documents. During the transformation process we want to replace the following template-elements:
Replacing single words or sentences (strings)
Replacing a complete paragraph
Adding paragraphs
Removing paragraphs
Replacing cell contents in a table (containing only strings)
Adding additional rows to a table
Removing rows from a table
Replacing images (complex charts as well as simple icons).
Would it be possible to do that with the Aspose.PDF for .NET? And how much effort would you estimate to write an appropriate conversion module using Aspose.PDF for .NET?
Currently our API does not support the feature to manipulate complete paragraph and does not support the feature to return paragraph in which searched text is present. However for the sake of correction, its been logged in our issue tracking system as PDFNEWNET-33730 .
In order to remove complete paragraph, first we need to identify the paragraph in which searched text/string is present. However as shared above, its currently not supported.
I am afraid currently this feature is not supported. However for the sake of correction, we already have logged it as PDFNEWNET-30842 in our issue tracking system.
Thanks for your response. Would it be easier to do all this using Aspose.Words (e.g. using its mail merge capabilities) and convert the final Word document into PDFß
Thanks for the acknowledgement. The above shared details are for Aspose.Pdf for .NET and I have also intimated my fellow from Aspose.Words team and they will reply accordingly.
Replacing images (complex charts as well as simple icons).
You can find old Shape nodes and then insert a new Shape node at the same location by using CompositeNode.InsertAfter Method or by using DocumentBuilder.MoveTo Method followed by DocumentBuilder.InsertImage Method.
We are pleased to inform you that the functionality has been added and available in latest version Aspose.PDF for .NET 18.3. We have implemented new functions for searching sections and paragraphs in the text of PDF document pages. Please consider using following code snippet in order to use the new feature:
string textToRemove = "United";
Document doc = new Document(myDir + "amblatt2013-10-05.pdf");
Page page = doc.Pages[2];
ParagraphAbsorber absorber = new ParagraphAbsorber();
absorber.Visit(page);
PageMarkup markup = absorber.PageMarkups[0];
foreach (MarkupSection section in markup.Sections)
{
foreach (MarkupParagraph paragraph in section.Paragraphs)
{
bool isTextFound = false;
foreach (TextFragment fragment in paragraph.Fragments)
{
if (isTextFound || !fragment.Text.Contains(textToRemove))
continue;
isTextFound = true;
}
if (isTextFound)
{
foreach (TextFragment fragment in paragraph.Fragments)
{
fragment.Text = String.Empty;
}
}
}
}
doc.Save(myDir + "amblatt2013-10-05_paragraph_removing.pdf");
Concerning to the other logged issue PDFNET-30842, we will surely let you know once we make some significant progress towards its resolution. Please spare us little time.