Free Support Forum - aspose.com

PDF export blank

We’re evaluating the .net diagram product.

When saving a vsdx object as PDF we get a blank diagram.

I’ve noticed this was reported previously and it doesn’t seem to be resolved. I’m using a flowchart LayoutOptions to get around the awful pagination in vxsdx.

It’s not actually fully blank - the text on the connectors is there but not the connectors or shapes. There is a Process shape with some text in it that contains the text but is not visible. The original vsdx saves fine as a PDF in Visio.

@stevebrettyw

Could you kindly share your sample Diagram with us so that we can test the scenario in our environment and address it accordingly.

@stevebrettyw

As requested earlier, please share source Diagram (.vsdx/.vsd) in .zip format with us so that we can test it in our environment and address the issue accordingly.

aspose test.zip (36.3 KB)

Ok attached.

@stevebrettyw

Would you kindly make sure that you are using a valid or 30-days free temporary license during evaluation of the API? We tested the scenario in our environment using Aspose.Diagram for .NET 20.8 and were unable to notice any issue. For your kind reference, an output PDF is also attached. Please let us know in case you notice any issue in the attached file.

Test.pdf (78.7 KB)

I am using a valid 30 days license.

One difference might be that I am creating the Visio document and then creating a stream to download ? I’m not saving the file then opening and converting.

using (var stream = new MemoryStream())
            {
                if(saveFormat == SaveFileFormat.VSDX)
                {
                    Aspose.Diagram.Saving.DiagramSaveOptions saveOptions = new Aspose.Diagram.Saving.DiagramSaveOptions()
                    {
                        SaveFormat = SaveFileFormat.VSDX,
                        AutoFitPageToDrawingContent = true
                    };
                    diagram.Save(stream, saveOptions);
                }
                if(saveFormat == SaveFileFormat.PDF)
                {
                    Aspose.Diagram.Saving.PdfSaveOptions saveOptions = new Aspose.Diagram.Saving.PdfSaveOptions()
                    {
                        SaveFormat = SaveFileFormat.PDF,
                        JpegQuality = 100,
                        PageSize = new Aspose.Diagram.Saving.PageSize(Aspose.Diagram.Saving.PaperSizeFormat.A4),
                        DefaultFont = "Arial",
                        EnlargePage = true,
                        SplitMultiPages = true,
                        Shapes = diagram.Pages[0].Shapes
                };
                    diagram.Save(stream, saveFormat);
                }
                
                var content = stream.ToArray();
                return File(content, contentType, String.Format("{0}.{1}", trace.Name, saveFormat.ToString()));
            }

Content type for PDF would be

“application/pdf”

@stevebrettyw

You may please try saving the generated diagram into memory stream and reloading it into Diagram object to convert into PDF. Furthermore, we request you to please share complete sample code snippet which includes steps to generate the diagram that you are generating. Also, please share sample stencil file for our reference so that the scenario can be tested and addressed accordingly.

So you want me to create the document, write it to a stream, then reload from a stream as a pdf, then write it to a stream again so I can download it ?

I’ve attached the class that generates the Visio and the stencil as requested - instead of reading the data just loop and create 40 empty shapes. visio stuff.zip (32.2 KB)

@stevebrettyw

We do realize that it will increase time and memory cost. We only suggested it as a workaround. Nevertheless, we are now testing the scenario with your provided code and sample stencil file and will get back to in a while.

Saving the vsdx to a stream, then loading that stream into a new document and then saving stream using PDF options didn’t work.

I’ve also noticed that some of the colours in the vxdx are not showing, in my example code you’ll see some code that switched the colour to red if the duration is greater than the threshold - this no longer works at all - to be honest it was patchy before but we have bigger issues with the PDF failing.

@stevebrettyw

We have logged an issue as DIAGRAMNET-51935 in our issue tracking system for the sake of further investigation against this scenario. We will further look into its details and let you know as soon as the ticket is resolved. Please be patient and spare us some time.

We apologize for the inconvenience caused.