Wrong page scale when convert Visio to PDF

                Input File:        "WinUI.vsd"
                    Outout File:     "converted_vsd_to_pdf.pdf"
                           try {
				InputStream stream = new FileInputStream(visioFile.getAbsolutePath());
		<a class="attachment" href="/uploads/default/9024">visio_issues.zip</a> (617.1 KB)
	// load diagram
				Diagram diagram = new Diagram(stream);

				File converted = PathUtils.createTempFilePdf();
				// Save as PDF file format
				diagram.save(converted.getAbsolutePath(), SaveFileFormat.PDF);
				stream.close();
				return converted;
			}catch (Exception e) {
				throw new Exception(e);
			}
		}

When open “converted_vsd_to_pdf.pdf”, will see the first page has different scale (172%) while other pages has 101%visio_issues.zip (617.1 KB)

@ruhongcai,

We have tested your scenario with the latest version 17.11 of Aspose.Diagram for .NET API, and it mimics the behavior of the Microsoft Visio application. These are the output PDFs: OutputPDFs.zip (515.0 KB). However, you can manage zoom level by setting the drawing scale property before saving the resultant PDF as follows:

[Java]

newDiagram.getPages().getPage("newpage").getPageSheet().getPageProps().getDrawingScale().setValue(1.23);
newDiagram.save("E:\Practice\asposeprac\asposeDiagram\ShapeOutput.pdf", SaveFileFormat.PDF);

Hi,

Thanks for your reply and solution, however

(1)From your output OutputPDFs.zip, open the zip, open the two files, you could see the first page scale is always larger than other 3 pages

(2)Add the following working code to force the 4 pages to generate same scale PDF, but the result are same, it does not help.

        diagram.getPages().get(0).getPageSheet().getPageProps().getDrawingScale().setValue(1.23);
        diagram.getPages().get(1).getPageSheet().getPageProps().getDrawingScale().setValue(1.23);
        diagram.getPages().get(2).getPageSheet().getPageProps().getDrawingScale().setValue(1.23);
        diagram.getPages().get(3 ).getPageSheet().getPageProps().getDrawingScale().setValue(1.23);

Many thanks for the further help!

Ruhong

@ruhongcai,

We have logged an investigation under the ticket ID DIAGRAMNET-51418 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates.

@ruhongcai,

In reference to the linked ticket ID DIAGRAMNET-51418, Microsoft Visio application saves the first page smaller than other pages. In order to enlarge the first page, please try the following code:

[Java]

String dataDir = "C:\\Diagram\\test2302\\"; 
InputStream stream = new FileInputStream(dataDir + "WinUI.vsd"); 
Diagram diagram = new Diagram(stream); 
diagram.getPages().get(0).getPageSheet().getPageProps().getPageScale().setValue(2);
diagram.save(dataDir + "Output.pdf", SaveFileFormat.PDF);

Hi,

Thanks for the email, however this will not help since we will not know the first page has this issue in runtime, so hard code it only works for this document and it is not solution.

Thanks!

Ruhong

@ruhongcai,

As we narrated in our previous reply, Microsoft Visio application also saves the first page smaller than other pages. Aspose.Diagram API mimics the behavior of the Microsoft Visio application.

OK, many thanks for the help!

Ruhong