PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Mon May 27, 2024 2:55 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Fri May 26, 2023 10:23 am 
Offline

Joined: Tue May 23, 2023 6:51 am
Posts: 2
Hi-
I am totally new to PDFsharp & MigraDoc. (used itextsharp in the past)
I've been tasked with upgrading one of our tools to .NET 6.0.
Looks like preview-2 is in process of moving to .NET6 as well, so I upgraded our application to use PDFsharp-MigraDoc-GDI (6.0.0-preview-2)

However, when I run a test, I am getting the following exception:

System.InvalidOperationException: 'ParagraphIterator' must not be null here.
at PdfSharp.Diagnostics.NRT.ThrowOnNull[TResult](String message)
at MigraDoc.Rendering.ParagraphRenderer.InitFormat(Area area, FormatInfo previousFormatInfo)
at MigraDoc.Rendering.ParagraphRenderer.Format(Area area, FormatInfo previousFormatInfo)
at MigraDoc.Rendering.TopDownFormatter.FormatOnAreas(XGraphics gfx, Boolean topLevel)
at MigraDoc.Rendering.FormattedDocument.Format(XGraphics gfx)
at MigraDoc.Rendering.DocumentRenderer.PrepareDocument()
at MigraDoc.Rendering.PdfDocumentRenderer.PrepareDocumentRenderer(Boolean prepareCompletely)
at MigraDoc.Rendering.PdfDocumentRenderer.PrepareRenderPages()
at MigraDoc.Rendering.PdfDocumentRenderer.RenderDocument()
...


I checked the known issues for 6.0.0-preview-2, but didn't see anything.
Has anyone else experienced this?
This is probably due to incorrect setup in our application of course. But as I have virtually no experience with our own tool, and we have no support, I thought I would ask here first if there is some obvious issue that could be easily fixed before I dive into it.

Many thanks!
duckworth


Top
 Profile  
Reply with quote  
PostPosted: Fri May 26, 2023 12:44 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 928
Location: CCAA
Thanks for the feedback.

We would check what's going on if we could replicate the issue.
See also:
https://docs.pdfsharp.net/General/IssueReporting.html

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Fri May 26, 2023 9:59 pm 
Offline

Joined: Tue May 23, 2023 6:51 am
Posts: 2
Thanks.
I'll get something together to replicate the issue this weekend and following the IssueReporting link.
(I was hoping there would be an "oh, it's obvious, you forgot to do this..." answer :-) )
The samples that are available for the prior to .NET6 version all should work on this 6.0.0-preview-2 version, correct?

duckworth


Top
 Profile  
Reply with quote  
PostPosted: Tue May 30, 2023 7:42 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 928
Location: CCAA
duckworth wrote:
The samples that are available for the prior to .NET6 version all should work on this 6.0.0-preview-2 version, correct?
I think so. But few require code changes to make them compile.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 01, 2023 9:19 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3098
Location: Cologne, Germany
duckworth wrote:
(I was hoping there would be an "oh, it's obvious, you forgot to do this..." answer :-) )
I checked the source code and it seems there is a new check that is too strict.
However, the check gets never triggered with our test code.

I think we'll remove that check with preview-3 anyway, but if we get sample code from you that triggers the check and allows us to verify that everything works fine when the check is removed, this would be great. Thanks in advance.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 08, 2023 4:36 am 
Offline

Joined: Thu Jun 08, 2023 4:32 am
Posts: 2
I am also running into this error. What's strange is my test work fine and do not return this error, but when I use it in a web api, it is generating the error.

When is preview 3 being released?


Top
 Profile  
Reply with quote  
PostPosted: Thu Jun 08, 2023 5:03 am 
Offline

Joined: Thu Jun 08, 2023 4:32 am
Posts: 2
I believe I can reproduce this error now. When I create a paragraph and add text to it that has a return on it, I am getting the error:
Code:
var paragraph = section.AddParagraph();
paragraph.AddText("\n");

Now, if I add a space after the return like so:
Code:
paragraph.AddText("\n ");

Seems to work fine.


Top
 Profile  
Reply with quote  
PostPosted: Mon Jun 12, 2023 7:27 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3098
Location: Cologne, Germany
haggis777 wrote:
I believe I can reproduce this error now. When I create a paragraph and add text to it that has a return on it, I am getting the error:
Code:
var paragraph = section.AddParagraph();
paragraph.AddText("\n");
Sorry, but I don't get an error with that code.

_________________
Regards
Thomas Hoevel
PDFsharp Team


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 72 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