PDFsharp & MigraDoc Foundation

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

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 70 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Wed Oct 29, 2014 9:30 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3092
Location: Cologne, Germany
So yellowmosquito may have a bug outside the shown code snippet.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 29, 2014 2:15 pm 
Offline

Joined: Tue Oct 28, 2014 2:52 am
Posts: 7
I'm sorry that I wasn't able to reproduce the issue for you. I have created a test case to remedy that. It is just a simple WinForms application - click the button to see each approach and generate the PDF.

Download the solution here. (Sorry, it was too large to attach to this form due to the assemblies.)
http://www.filedropper.com/migradocbug001


I hope this isn't just something I was doing wrong from the beginning. However, this approach did work just fine with the regular MigraDoc 1.32 libraries, so I can't see how it can be true 1:1 functionality.


Attachments:
File comment: Application Sample
Application.png
Application.png [ 12.34 KiB | Viewed 222877 times ]
File comment: Screenshot-Works
Works.png
Works.png [ 3.2 KiB | Viewed 222877 times ]
File comment: Screenshot-DoesNotWork
DoesNotWork.png
DoesNotWork.png [ 1.04 KiB | Viewed 222877 times ]
Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 30, 2014 9:23 am 
Offline

Joined: Thu Oct 30, 2014 9:19 am
Posts: 10
Hello,
First of all, thanks for the PDFSharp Creator for creating this PDF generator library. Btw, i had the slowness problem when generating tables with lots of rows as well.
I was trying to patch with pakeha's patch but looks like the website is down?
Does anybody have a copy of it? Appreciate it if someone could send me the patch for the table rendering.

Thanks!


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 30, 2014 12:00 pm 
Offline

Joined: Tue Oct 28, 2014 2:52 am
Posts: 7
centravanti wrote:
Hello,
First of all, thanks for the PDFSharp Creator for creating this PDF generator library. Btw, i had the slowness problem when generating tables with lots of rows as well.
I was trying to patch with pakeha's patch but looks like the website is down?
Does anybody have a copy of it? Appreciate it if someone could send me the patch for the table rendering.

Thanks!


Centravanti,

Try again. The site is back up now. You probably just hit the maintenance window.


Top
 Profile  
Reply with quote  
PostPosted: Fri Oct 31, 2014 9:19 am 
Offline

Joined: Thu Oct 30, 2014 9:19 am
Posts: 10
yellowmosquito wrote:
Centravanti,

Try again. The site is back up now. You probably just hit the maintenance window.


You are right, I could get it now. Thanks!


Top
 Profile  
Reply with quote  
PostPosted: Fri Oct 31, 2014 10:54 am 
Offline

Joined: Fri Oct 31, 2014 10:50 am
Posts: 1
Wow, I have a large table 200+ pages and was taking over 15 minutes.

Applied this patch and now its around 30 seconds!!

Excellent patch. Is this ever going to make it into a real release I wonder.

:D


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 13, 2014 7:38 pm 
Offline

Joined: Wed Jan 19, 2011 5:34 am
Posts: 19
Hi all

Issue with styles is fixed.

Web page http://www.pakeha_by.my-webs.org/MigraDocFastTableRender.html updated with most recent patch (must be applied to original source code) and compiled assemblies. All fixed mentioned in this thread are included.

Cheers


Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 18, 2014 9:38 am 
Offline

Joined: Thu Oct 30, 2014 9:19 am
Posts: 10
pakeha_by wrote:
Hi all

Issue with styles is fixed.

Web page http://www.pakeha_by.my-webs.org/MigraDocFastTableRender.html updated with most recent patch (must be applied to original source code) and compiled assemblies. All fixed mentioned in this thread are included.

Cheers


Hi Pakeha,
I tried to patch it, but i got these error message instead.

C:\Migra\bin>patch.exe -p0 < MigraDoc-1.32-TablePatch-r8.patch
patching file MigraDoc/code/MigraDoc.DocumentObjectModel/MigraDoc.DocumentObject
Model/Styles.cs
Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 354


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 18, 2015 3:31 pm 
Offline

Joined: Wed Mar 18, 2015 3:25 pm
Posts: 2
hi,

Please help. I have installed the PDFSharp/MigraDoc package version 1.32 by using NuGet. How exactly do i go about updating / patching the NuGet package with your version of the libraries?

Whenever I simply replace the DLLs with your versions, my application stops running and I get multiple errors, which I am sure are not related to your DLLs but rather because I am trying to manually copy and replace the DLLs myself in the NuGet folder instead of updating/patching them?

If that's the case, can you please detail how I can update the NuGet DLLs myself or if there is a way of doing this through NuGet so that it doesn't freak out?

Thanks!


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 19, 2015 6:49 pm 
Offline

Joined: Wed Mar 18, 2015 3:25 pm
Posts: 2
WOW! What a difference! From 2 minutes to 3 seconds!!! Thank you so much!! :D

For those of you wondering how to do this if you got the Nuget package that included both PDFSharp and MigraDoc, here's what you do:
(in Visual Studio)
1- Uninstall the Nuget Package that you have installed
2- Grab the Release Assemblies from the provided link in this thread
3- Include the new assemblies (the ones you need) in your project
4- Reference them in your project
5- Note that the DLL files you include should be set to Content, Copy if Newer
6- Install the PDFSharp Nuget package ONLY, not the PDFSharp+MigraDoc

That's it... works really well for me like i said above. I had a table with 2700 rows, that used to take 2 minutes to render, and it now takes about 3 seconds!


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 19, 2015 8:40 pm 
Offline

Joined: Wed Jan 19, 2011 5:34 am
Posts: 19
MaxOvrdrv wrote:
For those of you wondering how to do this if you got the Nuget package that included both PDFSharp and MigraDoc...


Thanks for sharing your experience, I didn't use MigraDoc NuGet package so could not answer your question.


Top
 Profile  
Reply with quote  
PostPosted: Thu Apr 30, 2015 9:42 pm 
Offline

Joined: Thu Apr 30, 2015 9:33 pm
Posts: 1
In my project it did not work.

I downloaded the patched dll's and replaced the ones that were in my debug and release folder with the patched ones.
The time it takes to render a pdf file with a large table (this tables can be several pages long) is still 45 seconds tough.. the same as before.

What am i doing wrong?

1. I downloaded the Compiled assemblies v. 1.32 (Debug) and Compiled assemblies v. 1.32 (Release)
2. extracted the zip
3. Took MigraDoc.Rendering-WPF.dll, MigraDoc.DocumentObjectModel-WPF.dll and MigraDoc.RtfRendering-WPF.dl from the debug compiled assemblies and replaced the ones already present in the debug file
4. the same with the release file
5. clean solution/rebuilt solution
6. Run and same result


Top
 Profile  
Reply with quote  
PostPosted: Wed Sep 02, 2015 11:00 am 
Offline

Joined: Wed Sep 02, 2015 10:56 am
Posts: 2
Thank you pakeha!

From 5 minutes, to less than 5 seconds!¨

I removed nuget package as stated before, imported references (make sure yo do not import regular and WPF files together, you will get an assembly reference error) and it works. The PDF files have exactly the same file size and I cannot spot a difference between the two. Thanks again pakeha!


Top
 Profile  
Reply with quote  
PostPosted: Tue Sep 22, 2015 7:18 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 905
Location: CCAA
With PDFsharp 1.50 beta 2 (available on NuGet as a prerelease package), table rendering got much faster.

PDFsharp + MigraDoc WPF 1.32.2608:
Average: 24.443 seconds
MigraDoc-1.32-patched-release (WPF) from Pakeha:
Average: 9.114 seconds
PDFsharp + MigraDoc (WPF) 1.50.3638-beta:
Average: 16.114 seconds
PDFsharp + MigraDoc (WPF) 1.50.3915-beta2:
Average: 1.559 seconds

So maybe it is worth giving the new NuGet packages a try.
More details in this post:
viewtopic.php?p=9379#p9379

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


Top
 Profile  
Reply with quote  
PostPosted: Tue Sep 22, 2015 1:19 pm 
Offline

Joined: Tue Oct 28, 2014 2:52 am
Posts: 7
Thank you for addressing this issue. The speed gains look very promising, and I would love to take advantage of them.

I've tried to bring the new files into my application today, but found several references missing (or perhaps just moved). Is there a good resource for finding where features within the code have been moved to?

(Specifically, I am having problems with code that was previously relying on PdfSharp.Forms.)

Thanks again for your work!


Top
 Profile  
Reply with quote  
PostPosted: Tue Sep 22, 2015 1:48 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 905
Location: CCAA
yellowmosquito wrote:
Specifically, I am having problems with code that was previously relying on PdfSharp.Forms.
You need a version with the GDI+ suffix.
See also:
http://pdfsharp.net/NuGetPackages.ashx

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


Top
 Profile  
Reply with quote  
PostPosted: Tue Sep 22, 2015 2:29 pm 
Offline

Joined: Tue Oct 28, 2014 2:52 am
Posts: 7
Thanks very much! (I didn't even realize I was using GDI+ specific functionality.) That solved all but one of my issues.

My only remaining problem occurs on this line:
Code:
MigraDoc.DocumentObjectModel.TextMeasurement tm = new TextMeasurement(pStyle.Font);

Results in the error:
Quote:
The type or namespace name 'TextMeasurement' could not be found (are you missing a using directive or an assembly reference?)

I'm sorry to ask here (since it is somewhat unrelated to the topic), but I think it may be relevant to the libraries I am using. (I cannot find TextMeasurement anywhere in the GDI+ files.) Did something happen to it? Am I using depreciated functionality?

I'm looking forward to testing this once my compiler tells me I can. ;)


Top
 Profile  
Reply with quote  
PostPosted: Tue Sep 22, 2015 3:04 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 905
Location: CCAA
The class TextMeasurement was removed, that's all I can say today.
I don't know why it was removed, but the implementation was somewhat inaccurate and it was platform-specific and MigraDoc should be platform-independent.

I'll think about possible solutions.

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


Top
 Profile  
Reply with quote  
PostPosted: Tue Sep 22, 2015 4:49 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 905
Location: CCAA
yellowmosquito wrote:
I cannot find TextMeasurement anywhere in the GDI+ files.)
I have a replacement you can add to your project:
viewtopic.php?p=9390#p9390
There could be small differences with respect to the measured values.

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


Top
 Profile  
Reply with quote  
PostPosted: Tue Sep 22, 2015 6:59 pm 
Offline

Joined: Tue Oct 28, 2014 2:52 am
Posts: 7
Thanks Thomas,

I appreciate the help. I'll try to get to it soon, and follow up with feedback about that feature in the thread you provided.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 70 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

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