Welcome Guest Search | Active Topics | Sign In | Register

Inserting a PdfLink on a existing PDF Options
Ibiuna
Posted: Tuesday, April 3, 2012 4:24:22 PM
Rank: Advanced Member
Groups: Member

Joined: 8/31/2011
Posts: 34
Hi,

I'm trying to create a custom table of contents on a pdf that is generated throught multiple calls of the HtmlToPdf.ConvertUrl method.
I read that I can create insert content in the first page by doing the following:

Code: C#
//Get the first page
PdfPage page = doc.Pages[0];

//Render contents on the page
HtmlToPdf.ConvertHtml("Overlay text", page);


and create a pdf link by:

Code: C#
AcmLink link = new AcmLink(new AcmText("Link Sample"));


But how do I use then together since:

Code: C#
doc.Pages[0].Contents.Insert(0, content);


only accepts PDFContent ?

Thanks for the any help.

Fabio
eo_support
Posted: Tuesday, April 3, 2012 5:11:02 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You merge the output of the HTML to PDF converter and Acm objects by outputing them to the same PdfPage object. To output Html to PDF converter to a PdfPage object, use one of the overloaded ConvertHtml/ConvertUrl that takes a PdfPage object. To output Acm object to a PdfPage object, use one of the overloaded AcmRender constructors that takes a PdfPage object.

Thanks!
Ibiuna
Posted: Tuesday, April 3, 2012 6:08:14 PM
Rank: Advanced Member
Groups: Member

Joined: 8/31/2011
Posts: 34
Hi,

Thank you for the reply. That helped.
But I still have a problem. AcmLink only accepts an acmContent, a URI or a file as a destination, and I wanted to use the PDFDestination (or the PDFDestination.Page) that I have from my bookmarks to set the destination.
Can I do that ? How can I cast between these objects ?

Thanks !
eo_support
Posted: Wednesday, April 4, 2012 8:58:50 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You will need to get the PdfLocation object from HtmlElement object, then call PdfLocation.CreateDestination to get the PdfDestination object.

Thanks!
Ibiuna
Posted: Wednesday, April 4, 2012 9:50:49 AM
Rank: Advanced Member
Groups: Member

Joined: 8/31/2011
Posts: 34
Hi,

Let me explain what I'm trying to achieve, cause there might be a better way to do it.
As I've said, I generate a report throught multiple calls of the HtmlToPdf.ConvertUrl method. At the same time, I create a bookmark from the HtmlElement I capture from the HtmlToPdfResult.
But the bookmark on a pdf is dependent on the PDF Viewer, so I wanted to create a table of contents on the first page, with links to the respective content, which I have the destination on the PDFBookmark object.

So I thought about creating the report with a blank first page and inserting the table of contents manually, using a Acm object and AcmLink and rendering on the first page.

Is there a better way to do it ?

Thanks !
eo_support
Posted: Wednesday, April 4, 2012 9:55:34 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

We don't decide which way is better for you. You decide that yourself. :) If you have any other questions related to a specific feature/objects like your previous questions we will be happy to help you further.

Thanks
Ibiuna
Posted: Wednesday, April 4, 2012 10:34:28 AM
Rank: Advanced Member
Groups: Member

Joined: 8/31/2011
Posts: 34
So,

Is there a way to input a PDFLocation as a destination on a ACMLink Object ?

Thanks.
eo_support
Posted: Wednesday, April 4, 2012 10:46:56 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
I do not belive so. You will want to take a look of the reference section of the documentations as well as the sample project. The reference clearly laid out what's available and what's not available to you and that would be what your code is based on, where as the sample project may already contain something similar to what you wanted to do. If you just try to grab two objects that you thought might work and try to make them work without checking the reference first, then it would almost certainly waste you a lot of time.

Thanks
Ibiuna
Posted: Wednesday, April 4, 2012 11:02:30 AM
Rank: Advanced Member
Groups: Member

Joined: 8/31/2011
Posts: 34
I know.

If you read my second post i clearly state what the ACMLink accepts. What i wanted to know is if there was a way to parse a PDFLocation object into the target location of a ACMLink object, since both are objects from your framework and both point to a specific location on the PDF.

I checked the documentation and i read the project. Please be mindful of how you respond.
A simple no would be suficient.

Thanks
eo_support
Posted: Wednesday, April 4, 2012 11:12:26 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Ibiuna wrote:
What i wanted to know is if there was a way to parse a PDFLocation object into the target location of a ACMLink object, since both are objects from your framework and both point to a specific location on the PDF.

This is why I asked you to read the reference. For example, if you see a property on AcmLink object that would accept a PdfLocation object, then you have your answer. Or if you see a version of AcmLink's constructor that takes a PdfLocation object, then that also means it would work for you. If you don't see anything there, then it won't work. We we are asking is, since the reference are already there, you need to read it instead of come to us everytime when you have a question about what's there or what's not there. We don't mind to point you to the right link at the begining when you just started to use our product, but in the long run you have to learn to rely on the reference for such questions. We will not be your shortcut to skip the documentation.

Ibiuna wrote:
A simple no would be suficient.

We have already replied "I do not believe so" to your original question. That is a simple no to the best of our knowledge.
Ibiuna
Posted: Wednesday, April 4, 2012 11:43:42 AM
Rank: Advanced Member
Groups: Member

Joined: 8/31/2011
Posts: 34
Sorry, i misunderstood you. I'm sorry for the harsh reply.

I'm not trying to shortcut the documentation, only to understand the framework better.
I'll try another solution then.

Thanks
eo_support
Posted: Wednesday, April 4, 2012 12:44:50 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
No problem and thanks for understanding!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.