PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Oct 19, 2024 8:02 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Thu Dec 03, 2009 12:00 pm 
Offline

Joined: Mon Nov 23, 2009 5:23 pm
Posts: 16
I have created a document with MigraDocs with several links. When i save the document to rtf i have all links, i have created in this document.
After saving this file with following code to pdf, some links are gone:

Code:
PdfDocumentRenderer bsnRenderer = new PdfDocumentRenderer(true, PdfSharp.Pdf.PdfFontEmbedding.Always);
            bsnRenderer.Document = document;
            bsnRenderer.RenderDocument();
            bsnRenderer.PdfDocument.Save(strFilename);

(document is my MigraDoc.DocumentObjectModel.Document)

I have two different locations of links:
- In my header i have inserted four links to URLs. Three of them are working fine, the fourth is the last one in the line and there is only the text, but not the link.
- I have 2 tables, which are printed in the document, which have a 1:n relation. To add some usability i gave the user a link from the parent record to navigate in the other printed table using a link. And all child record have also a link to the parent record. In the parent table all links are gone. In the child table only the first record has only the text and not the link, the following child records of one parent record have the link.

How i said, using rtf format all links working correct, but i need this document as pdf.

Are there some setting or anything else to affect links while rendering a pdf document?


Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 03, 2009 1:53 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3111
Location: Cologne, Germany
Hi!

You can create an MDDDL file from your document and check if all hyperlinks are there.

If they are, then there likely is a problem during rendering. The MDDDL file would help us locate the problem.

If they are not, then there probably is a problem while creating the document.

See also here:
http://www.pdfsharp.net/wiki/MigraDocDDL.ashx

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 03, 2009 2:46 pm 
Offline

Joined: Mon Nov 23, 2009 5:23 pm
Posts: 16
There are the Links. I have uploaded the 3 files, see above the links. It is the last link "zürich" which doesnt work!

http://thcid-smokey.net/Test.pdf
http://thcid-smokey.net/Test.rtf
MDDL http://thcid-smokey.net/Test

As you can see, i have the link correct in rtf and mddl, but not in pdf.


Last edited by MH_2106 on Thu Dec 03, 2009 3:40 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 03, 2009 3:28 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3111
Location: Cologne, Germany
I didn't get the MDDDL file.
Please check the link.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 03, 2009 3:40 pm 
Offline

Joined: Mon Nov 23, 2009 5:23 pm
Posts: 16
Sorry - now it works!


Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 03, 2009 4:02 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3111
Location: Cologne, Germany
I have the file, I can replicate the bug.

I will look after it on Monday.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Dec 09, 2009 5:37 pm 
Offline

Joined: Mon Nov 23, 2009 5:23 pm
Posts: 16
Have you already done anything regarding this problem? Just saw there is a new release.


Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 10, 2009 9:57 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3111
Location: Cologne, Germany
Hi!

It's a bug and it's not yet fixed.

The MDDDL contains
Code:
\hyperlink[Name = "www.google.de" Type = Web]{Zürich}\space(1)


It works if there is text following the hyperlink.
It also works if the hyperlink is at the end of line.

I just dropped the "\space(1)" from the file and the link was there.

Would you give me a code-snippet that creates the paragraph with this link?

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 10, 2009 10:17 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3111
Location: Cologne, Germany
Hi!

This is not my area of expertise, but I guess the routine
Code:
void RenderSpace(Character character)

in ParagraphRenderer.cs must call RealizeHyperlink().

Here is my changed version:
Code:
void RenderSpace(Character character)
{
  XUnit width = GetSpaceWidth(character);
  this.RenderUnderline(width, false);
  this.RealizeHyperlink(width);
  this.currentXPosition += width;
}

Provided as is without any warranties ...

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Fri Dec 11, 2009 5:28 pm 
Offline

Joined: Mon Nov 23, 2009 5:23 pm
Posts: 16
Great it works! Thank you very much!

Still have the problem in my tables, but it is a bit hard to give you a file with it, because i am working with customer data...I try to fix it myself!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group