We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

PPTX to PDF: Specifying First Slide Number Breaks Links

Hello,

When the setFirstSlideNumber API is used on a Presentation prior to converting it to PDF, the hyperlinks in the slides are broken in the resulting PDF.

This behavior can be seen in the latest Aspose Slides for Java version 20.3, the attached "HyperlinksTest.pptx” file and the following Java code:

final String pptxFile = [PATH] + "HyperlinksTest.pptx";

for (boolean setFirstPg : new boolean[] {true, false}) {
  Presentation ppt = new Presentation(pptxFile);

  String pdfFile = null;
  if (setFirstPg) {
      // When the first slide number is set, the links are lost in the PDF
      ppt.setFirstSlideNumber(3);
      pdfFile = pptxFile.replace(".pptx", "_NoLinks.pdf");

    } else {
      // When setFirstSlideNumber is not set, the links work on the PDF
      pdfFile = pptxFile.replace(".pptx", "_LinksWork.pdf");
  }

  Files.deleteIfExists(Paths.get(pdfFile));
  ppt.save(pdfFile, SaveFormat.Pdf);

  System.out.println("Saved PDF File: " + pdfFile);
}

If you examine the two generated PDF files:

  1. HyperlinksTest_LinksWork.pdf: The links in Slides 3 and 4 work in since it was generated without invoking ‘setFirstSlideNumber’.
  2. HyperlinksTest_NoLinks.pdf: The links in the do not work in Slides 3 and 4.

Environment Details:

  • Aspose Slides for Java 20.3
  • Java version 1.8.0_211
  • Windows 10 OS (but also reproducible under Linux).

File description in the HyperlinksTest.zip (87.8 KB) attachment:

  • HyperlinksTest.pptx: Presentation to be converted to PDF.
  • HyperlinksTest_NoLinks.pdf: PDF file generated from the code above on our environment
  • HyperlinksTest_LinksWork.pdf: Second PDF file generated from the code above on our environment.

Thank you!

@oraspose,

I have observed the issue shared by you and have been able to observe that. A ticket with ID SLIDESJAVA-38076 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

The issues you have found earlier (filed as SLIDESJAVA-38076) have been fixed in this update.