Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Add Link To Embedded File
  FAQ FAQ  Forum Search   Register Register  Login Login

Add Link To Embedded File

 Post Reply Post Reply
Author
Message Reverse Sort Order
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Topic: Add Link To Embedded File
    Posted: 29 Apr 10 at 2:50PM
Hi!

'cause of your box:
Perhaps it has to do with different value bases (pixels, mm, inches)?
...Perhaps with different orientations?
Perhaps for the box you can only use pixel and for the rest you've made settings for inches?
You should have a look in this direction.

If you read here:
http://www.quickpdflibrary.com/help/quickpdf/AddLinkToEmbeddedFile.php
You see that there's the standard icon (0) or the disk icon (1).
Perhaps you can try "2"? ...Try it.

Cheers, Ingo

Back to Top
syntax3k View Drop Down
Beginner
Beginner


Joined: 29 Apr 10
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote syntax3k Quote  Post ReplyReply Direct Link To This Post Posted: 29 Apr 10 at 1:33PM
I do have another question Ingo (if you don't mind):

I added the link box after adding a new layer, as I found out that, if I do not do that, the link does not go over the "Open xxx" text at all. But even though my box's wodth is set to be 300, it still does not cover the whole "Open xxx" text for some reason. Since the link creating code is the same as above, is that not the right way to do so?

And also (ok, second question), the link always have an icon. Is it possible to not have an icon, or at least have a custom one?

Thank you once again for all your help.
Back to Top
syntax3k View Drop Down
Beginner
Beginner


Joined: 29 Apr 10
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote syntax3k Quote  Post ReplyReply Direct Link To This Post Posted: 29 Apr 10 at 11:10AM
Hi Ingo,

Thank you so much. Worked like a charm.

For those, who would need this functionality, here is the revised code:

replace this code:

Quote fileId = qp.EmbedFile(title, file.Value, "application / pdf");      

with this:

Quote fileId = qp.AddEmbeddedFile(file.Value, "application / pdf");    

If QuickPDF guys are reading these forums, may I also suggest using the [Obsolete] tag on the EmbedFile function? I think it would help greatly.

Once again, thank you Ingo.
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 29 Apr 10 at 10:46AM
Hi Syntax ;-)

EmbedFile is an old (the wrong one) function if you want to get a file-id.
Try AddEmbeddedFile:
http://www.quickpdflibrary.com/help/quickpdf/AddEmbeddedFile.php

Cheers and welcome here,
Ingo


Back to Top
syntax3k View Drop Down
Beginner
Beginner


Joined: 29 Apr 10
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote syntax3k Quote  Post ReplyReply Direct Link To This Post Posted: 29 Apr 10 at 8:17AM
Hi,

I am new to Quick ODF and currently evaluating it. This is the last bit that I need to do, and it looks like I hit a roadblock.

Situation is this: the pdf is created. There is a certain text in the pdf, and also, there is a st of files. What I need to do is;

1. embed the files
2. find the certain text, create a hotspot to link to the embedded file

The embedding is smooth; however, the AddLinkToEmbeddedFile function always returns zero. I am not sure what I am doing wrong, I hope that someone can help me here, so I can finish this and go and purchase this library.

Here is the part of the code.

qp.LoadFromFile(destinationFile);
                    foreach (KeyValuePair<int, string> file in sourceFiles)
                    {
                        string textToSearch = "Open " + file.Key;
                        int pageCount = qp.PageCount();
                        int pageNumber = 1;
                        int matchesFound = 0;
                        bool fileLinked = false;
                        int fileId = 0;

                        while (pageNumber <= pageCount)
                        {
                            qp.SelectPage(pageNumber);
                            string pageText = qp.GetPageText(3);
                            string[] lines = pageText.Split('\n');
                            string[][] grid = new string[pageText.Length][];

                            for (int i = 0; i < lines.Length; i++)
                            {
                                grid = lines.Split(',');
                            }

                            foreach (string[] line in grid)
                            {
                                if (line == null || line.Length < 12) continue;
                                string findMatch = line[11];

                                if (findMatch.Contains(textToSearch))
                                {
                                    string title = file.Key.ToString() + ".pdf";
                                    if (!fileLinked)
                                    {
                                        fileId = qp.EmbedFile(title, file.Value, "application / pdf");                                                                     fileLinked = true;
                                    }

                                    qp.DrawBox(Convert.ToDouble(line[3]), Convert.ToDouble(line[8]), 100, 20, 0);
                                    int result = qp.AddLinkToEmbeddedFile(Convert.ToDouble(line[3]), Convert.ToDouble(line[8]), 100, 20, fileId, title, 1);
                                }
                            }
                            pageNumber++;
                        }
                    }
qp.SaveToFile(destinationFile);

Everything works just fine, even the box is drawn (I put there to test), however the result variable is always zero (0), suggesting that the link is not added. And fair enough, after everything is done, I open the Pdf file and attachments are embedded, the box is drawn but the link is not created. 

Is there something that I am doing wrong? I even tried to save the document right after embedding but that did not make a difference.

Also, the fileId is always 1. Does that mean it is returning a success code instead of the EmbeddedFileID? If so, how can I get the embedded File ID frmthat function?

Any help would be appreciated.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store