Our client currently has a manual process (using Acrobat) where every two weeks a system generates a ~100 page pdf file. They then take this and manually make two versions.
The first version has 50+ pdfs with drawings appended to the end of the generated pdf. They then manually link the relevant sections in the generated part of the pdf to the page with the correct drawing.
The second version has the relevant sections in the generated pdf linked to a web address (external urls).
We are looking at automating this process, by searching for the markers in the generated pdf and creating the 2 documents via code.
At the moment using Aspose.Pdf.Document I have code that can replace the markers with the correct text and append the drawing pdfs to the generated pdf.
Using Aspose.Pdf.Generator I can create a link to a local target id (although this would be better if I could like to a page), and I can create a hyperlink.
But I can’t find a way to load an existing pdf into the generator object.
Can your product do what I need?
If I need to use a coordinate system (like Acrobat does) how do I determine the coordinates of the text that was found?
Regards
Kurt
btw the 4 element limit in the evaluation version is really low and makes testing your controls hard.
Hi Kurt,
Thanks for your interest in our products.
As per my understanding, you need to add add drawing objects/images inside the PDF file and add links to the pages containing these drawings. You may also use our component to find a text inside PDF file and place an image on top of that place or some position relative to that location. You can also add links towards the pages inside the same document. For further details, please visit
Create Local Link in Existing PDF File (Facades)
Add Image Stamp on Particular Pages in a PDF File (Facades)
Add Image in an Existing PDF File (Facades)
You may also add links in PDF file towards web addresses. For more information, please visit Add Hyperlink in a PDF File
Aspose.Pdf.Generator namespace provides the feature to create PDF documents from scratch and I am afraid it does not support the feature to load existing PDF file and add links inside it. Please take a look over following section for information on Working with Links and Actions.
Please take a look over following link for required information on Search and Get Text Segments from All Pages of PDF Document
You may consider requesting a 30 days Temporary license to test our product without any limitations. Get a temporary license
In case I have not properly understood your requirement or you have any further query, please share some further details.
Nayyer,
I found the Fascade class after I posted (I was working my way through your documentation) and I have some code that mostly works, however I am getting very poor results with the TextFragmentAbsorber.
I was a PDF that was saved from word with a paragraph like so
“This is some RTF text created in word. This is some RTF text created in word. This is some RTF text created in word. This is some RTF text created in word. This is some RTF text created in word. This is some RTF text created in word.”
I’m using the TextFragmentAbsorber to look for “RTF text”, change the fragment colour to blue and create a link with a border (for testing purposes). The TextFragmentAbsorber does not pick up the second instance on the same line, it also does not pickup instances where “RTF” is on a different line to “text” (due to normal text wrapping). I’ve not tried where the words are split over a page break, but my guess is that it wont work either.
Document pdfDocument = new Document(“C:\2 - Testing\test1.pdf”);
Document pdfDocument2 = new Document(“C:\2 - Testing\test2.pdf”);
pdfDocument.Pages.Add(pdfDocument2.Pages);
for (int i = 1; i <= pdfDocument.Pages.Count; i++)
{
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber(“RTF text”);
Page page = pdfDocument.Pages[i];
Page page2 = pdfDocument.Pages[2];
TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;
pdfDocument.Pages[i].Accept(textFragmentAbsorber);
foreach (TextFragment textFragment in textFragmentCollection)
{
textFragment.TextState.ForegroundColor = System.Drawing.Color.Blue;
Aspose.Pdf.InteractiveFeatures.Annotations.LinkAnnotation link = new Aspose.Pdf.InteractiveFeatures.Annotations.LinkAnnotation(page, textFragment.Rectangle);
Aspose.Pdf.InteractiveFeatures.Annotations.Border border = new Aspose.Pdf.InteractiveFeatures.Annotations.Border(link);
border.Width = 1;
link.Border = border;
//link.Action = new Aspose.Pdf.InteractiveFeatures.GoToURIAction(“www.mwa.com.au”);
link.Action = new Aspose.Pdf.InteractiveFeatures.GoToAction(page2);
page.Annotations.Add(link);
}
}
sFileName = “Result-” + DateTime.Now.ToString(“HH-mm-ss”) + “.pdf”;
pdfDocument.Save(“C:\2 - Testing\” + sFileName);
Hi Kurt,
I’ve attached several PDF’s and a text file with some code. I’m getting the problem no matter the foreground colour, but the source of the PDF seems to matter (for some reason).
I’m using two products to generate the PDF’s I am using from RTFs. MS Word and TX Text. Word gives a slightly better result but will not be used in the end application.
If you read the code you will see that I am taking either SampleForAposeMSWord.pdf or SampleForAposeTXText.pdf appending Sample2ndFile.pdf (generated by TX Text) and then searching for “RTF text”, replacing with new text and colour and adding a link.
The MS Word generated PDF picks up the second instance but not the line wrapped instance.
The TX Text generated PDF does not pickup the second instance (you can debug to prove this) and for some reason when it replaces with a short string it repeats the string see double F Text on the first line.
I appreciate your prompt response.
Hi Kurt,
Thanks for providing additional information. I've managed to reproduce the issue at my end and logged it as PDFNEWNET-34894 in our bug tracking system for further investigation and resolution. You will be notified via this thread as soon as it is resolved.
Sorry for the inconvenience faced.
Best Regards,
Thanks for submitting the bug report.
Another question if I may.
I want to load two 2 A5 pdf files and import them into 1 A4 page. If I append these to the document using Pages.Add it just adds the A5 pages to the A4 document. How do I take the content from the 2 A5 pdfs and append it to the A4 page.
dragmor:
- Get All Annotations from the Page of a PDF document
- Extract Images from the PDF File
- Get All the Attachments from a PDF Document
- Get Bookmarks from the PDF Document
- Extract Text from all the Pages using Text Device
The issues you have found earlier (filed as PDFNEWNET-34894;PDFNEWNET-34894) have been fixed in Aspose.Pdf for .NET 9.9.0.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.