Quantcast
Viewing all articles
Browse latest Browse all 3131

link to a file that is already attached (embedded) to a pdf

Using Aspose, I have already attached multiple PDFs to my main PDF.  What I am trying to do is to create a link in the main PDF to one of those attached PDFs.

Here's the pseudo-code:

string[] PDFarry; //already pre-populated with a list of file paths to attach
foreach (string PDF in PDFarry)
                {
Aspose.Pdf.Text.TextFragmentAbsorber textFragmentAbsorber = new Aspose.Pdf.Text.TextFragmentAbsorber(curFileName);
pdfDocument.Pages.Accept(textFragmentAbsorber);
Aspose.Pdf.Text.TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;
foreach (Aspose.Pdf.Text.TextFragment textFragment in textFragmentCollection)
                        {
                            foreach (Aspose.Pdf.Text.TextSegment textSegment in textFragment.Segments)
                            {
      int curPage = textFragment.Page.Number;
      Page curPageNum = pdfDocument.Pages[curPage];
      Aspose.Pdf.Rectangle recTangle = textFragment.Rectangle;
      string attPath = PDF;
      editor.CreateFileAttachment(recTangle.ToRect(), "", attPath, curPage, "Paperclip");
                              
                            }
                        }

This code runs through the array of paths, and for each path it searches for the "filename.pdf" part of the path within the main PDF (the filename is already in the main PDF) All of that works thus far.  But, instead of the paperclip, I am trying to make a rectangle around the text and basically make an "invisible button" to go over each of the filenames in the main PDF. 

So, I guess that's the bottom line. I want to draw a rectangle around some text and then turn that rectangle into a link that will open an attached PDF.



Viewing all articles
Browse latest Browse all 3131

Trending Articles