Page Index Toggle Pages: [1] 2  Send TopicPrint
Very Hot Topic (More than 25 Replies) PDF exporter problems (Read 11404 times)
Aaron
YaBB Newbies
*
Offline


Looking for support

Posts: 44
Joined: Nov 9th, 2007
PDF exporter problems
Jan 18th, 2008 at 1:05pm
Print Post  
Hello, I'm using 4.0.3.

And of that I'm using the PDF exporter to export my charts to a pdf file. Converting to an image work perfectly fine.

But the PDF exporter seems to have a lot of problems with column spanning cells. I've got the source code license, so I was able to catch an index out of bounds exception caused by just that. Before that, tables with - say - 6 columns and a cell with a columnspan that spans all the rows gave an index out of bound. Subtracting 1 from the columnspan made it work, but offcourse with an additional empty last cell in the row.

But I fixed that one. Another problem I can't seem to fix (and I'm not sure if it's my code or the pdf exporter) is that bold fonts and even bold lines are simply changed to regular ones (the bold is set with the pen or brush, one of those two). Bold text is marked bold all the way to the PDFGraphics.DrawText() method call in MindFusion.Pdf, but I can't debug further (the source code for that component is not included right?).

Also, I can see a lot of traces saying "Unsupported Brush"... what causes this?

Are these all known issues (couldn't really find anything about them using the search)? And most importantly, are they fixed in later versions? Or is it my own fault?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PDF exporter problems
Reply #1 - Jan 18th, 2008 at 2:11pm
Print Post  
Hi,

I remember we fixed some PdfExporter bugs in one of the version 4 updates, but am not sure which version exactly. Email us to support@mindfusion.eu and we'll send you our latest code of the FC.NET4 PdfExporter, which might fix the problems you are experiencing.

Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PDF exporter problems
Reply #2 - Jan 18th, 2008 at 3:02pm
Print Post  
Hi,

I've sent you the code as an attachment. Did you receive it?

Stoyan
  
Back to top
 
IP Logged
 
Aaron
YaBB Newbies
*
Offline


Looking for support

Posts: 44
Joined: Nov 9th, 2007
Re: PDF exporter problems
Reply #3 - Jan 21st, 2008 at 7:07am
Print Post  
Thanks, I did receive it (couldn't check my e-mail from home).

But the problems presist. I can see three main problems:

- An index out of range exception causes tables to not be drawn (when a cell spans ALL the columns)

- The font is slightly different, it's never bold and it gets a bit bigger (some that just fitted into the cells are now wrapped to a new line)

- Some white space appears at the right side in the generated PDF document (but that might have something to do with margins?)

By the way, none of these issues occur when I create an image of the chart (but since I need some printing quality, I really need the PDF).

I'd be really surprised if I'm to first to experience these kind of problems.

Thanks already
  
Back to top
 
IP Logged
 
Aaron
YaBB Newbies
*
Offline


Looking for support

Posts: 44
Joined: Nov 9th, 2007
Re: PDF exporter problems
Reply #4 - Jan 21st, 2008 at 7:20am
Print Post  
Never mind about the third problem. I was thinking the PDF size was exactly made to fit the chart, but now I know the chart is made to fit the pageSize (which apparently also causes the line breaks, though I'm not sure).
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PDF exporter problems
Reply #5 - Jan 21st, 2008 at 7:40am
Print Post  
Ok, could you email us a diagram file showing those problems?

Thank you,
Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PDF exporter problems
Reply #6 - Jan 21st, 2008 at 7:48am
Print Post  
By the way is there any reason not to move to at least version 4.3.1 of the control (the last from the V4 series)? I can see we sent all upgrades up to 5.0.2 to your company, and it's not that easy for us to support a three years old version.

Stoyan
  
Back to top
 
IP Logged
 
Aaron
YaBB Newbies
*
Offline


Looking for support

Posts: 44
Joined: Nov 9th, 2007
Re: PDF exporter problems
Reply #7 - Jan 21st, 2008 at 7:57am
Print Post  
After checking, seems we're using 4.3.1... I've got no idea where I got 4.0.3 from (once again, it wás friday). Very sorry about that.

We'll be updating to 5.0.2 probably in the next version of our application, but I don't think we can risk the move now (timing), so first we'll get it rolling with 4.3.1

I'll be e-mailing you both the diagram file and the generated PDF.

For now, I'm using a higher resolution Bitmap image, it's not as good but will do for now.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PDF exporter problems
Reply #8 - Jan 21st, 2008 at 10:58am
Print Post  
It seems the problem happens because you have a cell whose ColumnSpan == 7 while the table.ColumnCount == 6. Setting the ColumnSpan to 6 should fix that.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PDF exporter problems
Reply #9 - Jan 21st, 2008 at 11:06am
Print Post  
Indeed, adding this

Code
Select All
foreach (Table table in fc.Tables)
{
	if (table[0, 0].ColumnSpan > table.ColumnCount)
		table[0, 0].ColumnSpan = table.ColumnCount;
}
 



after the LoadFromString call fixes the index-out-of-range problem.

Regarding the "Unsupported brush" trace message, it is displayed when there are some null brushes, but it should be safe to ignore that.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Aaron
YaBB Newbies
*
Offline


Looking for support

Posts: 44
Joined: Nov 9th, 2007
Re: PDF exporter problems
Reply #10 - Jan 21st, 2008 at 12:52pm
Print Post  
Man, that was pretty dumb of me. Must've been the Friday thing (that's one hell of an excuse) but I could swear I put some code in there setting the ColumnSpan to 6 and seeing it not work. Then setting it to 5 and seeing it work but with an extra column. Sad

Anyway, doesn't matter, thanks! You really go through a lot of effort (even when it's not even your problem Wink ).

Any ideas on the bold text that's dissapearing. I followed it all the way down to the MindFusion.Pdf calls and "bold" is true... but no bold is printed. Might be my fault too. Maybe it's taking the table font instead of the cell font somehow.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PDF exporter problems
Reply #11 - Jan 21st, 2008 at 12:56pm
Print Post  
Yeah, I know what Fridays can do to a man Wink

The fonts look ok here - what version of Adobe Reader are you using? I believe the PdfExporter is compliant to the PDF V6 specification, which is supported by Adobe Reader versions 7 & 8. Older versions should still be able to open the flowchart PDF files, but probably with some graphic attributes missing / not rendered correctly.

Stoyan
« Last Edit: Jan 21st, 2008 at 1:58pm by Stoyo »  
Back to top
 
IP Logged
 
Aaron
YaBB Newbies
*
Offline


Looking for support

Posts: 44
Joined: Nov 9th, 2007
Re: PDF exporter problems
Reply #12 - Jan 21st, 2008 at 2:04pm
Print Post  
O yeah, I'm using 6.0 here. So that's probably it. I'm downloading a new version to check it out.

As long as I know about this compatibility limitation it's OK.

That clears up that, thanks Stoyo!
  
Back to top
 
IP Logged
 
Aaron
YaBB Newbies
*
Offline


Looking for support

Posts: 44
Joined: Nov 9th, 2007
Re: PDF exporter problems
Reply #13 - Jan 21st, 2008 at 2:21pm
Print Post  
Ok, the bold text is indeed correct!

Allthough they still seem to be wrapping to a new line (when this is not done in the FC.NET).

Do you think it's acrobat reader doing this? It's just a matter of making each cell just a bit bigger, but still I'm wondering. It's as if the PDF adds some additional padding/margin around the texts. Maybe this is configurable somewhere?

Thanks once again (can't thank you enough Wink)
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PDF exporter problems
Reply #14 - Jan 22nd, 2008 at 6:29am
Print Post  
It is hard to get the on-screen and PDF text match exactly. In the first case FlowChart.NET calls the Graphics.DrawString to render the text, and DrawString does its own character layout. PDF does not support multiline text, and we try to emulate the DrawString character layout by measuring the text using the PDF font size and adding multiple PDF text tags if a single line won't fit, however that does not guarantee producing the same output since we don't know all intricacies of how DrawString works.

You should get better output when using EnableStyledText - in that case FlowChart.NET uses the same text formatting and layout algorithm both when rendering to the screen and in PDF, but there still might be some differences, since each word is still measured and drawn using different APIs in the different cases.

We have made some improvements to PDF text rendering in FlowChart.NET 5. You might check it and back-port the new layout code if you find it works better.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint