PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Tue Mar 19, 2024 10:12 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Tue Feb 21, 2017 11:50 am 
Offline

Joined: Tue Feb 21, 2017 10:46 am
Posts: 4
I create a Migradoc document that repesent one of the output of my application. If I render to RTF, it works fine, when I render the same to PDF it doesn't, Migradoc enters in an endless loop (I debugged a few the source code - If can be useful, it loops on object IDX 23 on the second page, that is an image - and it loops trying to create every time new page). Apparently that is nothing strange in the document and the same image, used in another document works fine causing the page break if needed.
I exported the documenti in mdddl format and, using the sample DocumentViewer, do the same during document rendering.
I tried to change the Image dimension and, if I set it to very small (less than 12 cm of height, but the space on the page should be enough... it just has to break to new page...) it works, otherwise goes in loop.

I attach a file containing the mdddl and related files used.

Thank you in advance.
Dario


Attachments:
TEST.zip [145.79 KiB]
Downloaded 633 times
Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 21, 2017 2:20 pm 
Offline
PDFsharp Guru
User avatar

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

Thanks for the feedback.
I can replicate the endless loop, but don't know (yet) how to fix it.

The image that causes the problem:
Code:
    \paragraph
    {
      \image(".\\files\\r6440_81.png")
      [
        Height = "16.1cm"
        Width = "11.73cm"
        LockAspectRatio = true
      ]
      \linebreak
    }

If I remove that "\linebreak" then everything will work just fine.

It is a bug and it should work with all those "\linebreak" in paragraphs.
But maybe it is a quick workaround for you not to use those "\linebreak" statements?

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 22, 2017 2:07 pm 
Offline

Joined: Tue Feb 21, 2017 10:46 am
Posts: 4
First of all, thank you for fast reply.
Yes I could try not using linebreak; If I understood correctly the use of migradoc, I can substitute the \linebreak (I use paragraph.addlinebreak) by adding a new empty paragraph. Is it correct or there is another way to insert an empty line not using linebreak ? (something like paragraph break)


thank you.
Dario


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 22, 2017 3:01 pm 
Offline

Joined: Tue Feb 21, 2017 10:46 am
Posts: 4
I substitute each line break by adding formatting on the following paragrapf (spacebefore ...) and it works.

Thank you and let me know about what asked in previous reply and when this bug correction will be solved and released.

Regards.
dario


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 23, 2017 11:59 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3092
Location: Cologne, Germany
Instead of adding a linebreak at the end of a paragraph, you can do one of the following to get some space:
  • Add an empty paragraph (with SpaceBefore and SpaceAfter set to 0)
  • Set SpaceAfter for the paragraph that previously had the linebreak
  • Set SpaceBefore for the following paragraph

I think having a linebreak at the end of a paragraph can lead to a page with an empty first line. Not desirable.
I think having an empty paragraph can lead to a page with an empty first line. Not desirable either.

Setting SpaceAfter for the paragraph with the image would be my preferred choice.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 23, 2017 4:27 pm 
Offline

Joined: Tue Feb 21, 2017 10:46 am
Posts: 4
Thank you Thomas,

as I told in my previous post, I solved using "spacebefore" in the succeeding paragraph, that's the same you suggested.

Thank you again and congratulations for the great work you have done with migradoc and PDFsharp.

Dario


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 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