Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Export as PDF (Read 8553 times)
Jasef
YaBB Newbies
*
Offline



Posts: 26
Joined: Jul 17th, 2011
Export as PDF
Mar 31st, 2014 at 4:02am
Print Post  
Hi.

Just enquiring on if there is any way to speed up exporting a large diagram to PDF.

In terms of large, we have a diagram with 1594 nodes and 1840 links with an anneal layout applied.
We can export the diagram as a single page PDF which takes approximately 1 hour and 30 minutes. But we also want and tried exporting to A4 portrait for over 5 hours with no completion.


Cheers.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Export as PDF
Reply #1 - Mar 31st, 2014 at 6:44am
Print Post  
Hi,

We haven't tried the exporter with that large diagrams. Our developer will run it through a profiler to see if we can speed up anything.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Export as PDF
Reply #2 - Apr 1st, 2014 at 4:33pm
Print Post  
What kind of objects do you have in your diagrams? This code completes for about two minutes in our test:

Code
Select All
Factory f = diagram.getFactory();
f.createShapeNode(0, 0, 20, 20);
for (int i = 1; i < 1500; i++)
{
	ShapeNode n = f.createShapeNode(
		(i / 30) * 30, (i % 30) * 30, 20, 20);
	n.setText("test test test " + i);
	f.createDiagramLink(diagram.getNodes().get(i-1), n);
}
diagram.resizeToFitItems(5);

PdfExporter pdf = new PdfExporter();
pdf.export(diagram, "test.pdf");
 



That's much faster than 1 hour and 30 minutes, but our developer will still try to optimize it.

Stoyan
  
Back to top
 
IP Logged
 
Jasef
YaBB Newbies
*
Offline



Posts: 26
Joined: Jul 17th, 2011
Re: Export as PDF
Reply #3 - Apr 2nd, 2014 at 10:17pm
Print Post  
We use customized TableNodes with gradient headers, rounded tables, have images (icons) in the header of the table and certain cells of the table, a scroller manipulator. Typically the size of a TableNode is 273x149.

Relationships are in cascade with arrow heads. Not sure if you need to know this, but they can connect to tables via table anchors or row anchors depending on the mode we have the diagram set in, but can have both at the same time.

Comparing to your sample code, your diagram size (space-wise) in relation to ours is very small. When the pdf exporting successfully as a single page diagram, we get an 114MB pdf. I'm assuming the speed is factored by number of objects vs (space) size of diagram.

Hope that helps. Let me know if you need any more information.

Note: I use Google Chrome to open up these large PDF's and also not a high priority issue.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Export as PDF
Reply #4 - Apr 3rd, 2014 at 8:54am
Print Post  
Quote:
have images (icons) in the header of the table and certain cells of the table


PdfExporter encodes the bytes of each Image instance into a separate PDF image stream, so images could slow down the export a lot if they are separate objects. Export should get much faster if you use a shared Image instance. E.g. if you display the same image file but load it through ImageIO for each cell, you will end up with thousands of image streams in the PDF file. If you assign the same Image instance to all cells, you should get a single image stream (per PDF page).

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



Posts: 26
Joined: Jul 17th, 2011
Re: Export as PDF
Reply #5 - Apr 3rd, 2014 at 7:59pm
Print Post  
Double checked how we load these images and they use the same referenced object, only loading the image once for the whole duration of the program to be re-used everywhere. In the test, we had at most 4 images in use and they're standard icon size, 16x16 px.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Export as PDF
Reply #6 - Apr 4th, 2014 at 10:11am
Print Post  
If your diagram shows the alignment grid, try setting exporter.setEnableGrid(false) before exporting. The grid adds a PDF object for each point, and there might be millions of them if it covers a large area.

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



Posts: 26
Joined: Jul 17th, 2011
Re: Export as PDF
Reply #7 - Apr 10th, 2014 at 8:47pm
Print Post  
Sorry for the late response.

We do not show the alignment grid on the diagram.
The diagram is just a plain color (white usually for exporting) with only the objects showing (table nodes and links)

To get a rough idea of how much space our diagram consumes we exported it as png (edited the diagram.saveImage to splice) to have a total size of 20,109 x 20,121 px.  The diagram's measure unit is Point.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Export as PDF
Reply #8 - Apr 11th, 2014 at 6:20am
Print Post  
Could you attach here (or send to our support email address) either the saved diagram file or a test project showing the kind of objects you are using?
  
Back to top
 
IP Logged
 
Jasef
YaBB Newbies
*
Offline



Posts: 26
Joined: Jul 17th, 2011
Re: Export as PDF
Reply #9 - Apr 14th, 2014 at 4:12am
Print Post  
I've attached some test code that's independent of our stuff that produces the same results as I get where exporting the pdf takes a very long time and doesn't produce a pdf. Edit the save location of pdf to your liking. I hope that shows what's going on.
  

SaveToPdf.zip (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Export as PDF
Reply #10 - Apr 15th, 2014 at 7:35am
Print Post  
You can find updated version with optimized PdfExporter on the PM page linked from top of the forum page. In addition, you can reduce the number of PDF objects (thus file size and export time) by about 2/3 by setting ShadowsStyle to None and tables' CellFrameStyle to None. With that, exporting the 1500 tables + 1500 links takes about 45 seconds with PageSize = DiagramSize on our test system, creating 125 MB file. Exporting to multiple pages repeats some of the objects on several pages only with changed clip regions (e.g. longer links), so it's slower and creates bigger files. We'll try to optimize this further for next release.

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



Posts: 26
Joined: Jul 17th, 2011
Re: Export as PDF
Reply #11 - Apr 16th, 2014 at 2:31am
Print Post  
I've also noticed that the icons we put on our tables do not appear correctly when split to multiple pages. The table image appears only on the first page and none after that, whereas the cell images do not appear on any pages at all.

Any ideas on what is happening here?

Still trying out your fix. I should have noted that we're still on 4.0.3. Are your changes only do with the the pdfexporter package? Did notice it worked for the test sample code I attached here.

Cheers.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Export as PDF
Reply #12 - Apr 17th, 2014 at 5:35pm
Print Post  
The changes are only in the pdf package, you can find the code on PM page if you want to rebuild it with 4.0.3. Now it should also fix the missing cell images.

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



Posts: 26
Joined: Jul 17th, 2011
Re: Export as PDF
Reply #13 - Apr 24th, 2014 at 12:55am
Print Post  
Tested your changes:
Cell images are now showing.
A full diagram sized pdf is incredibly quick compared to before.
Can't wait to see your optimizations for split pdf's. Currently takes a long time and then hits memory limits with and without your changes.

Cheers.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint