Free Support Forum - aspose.com

Opening ppt files on mac os x

We are using the Aspose.powerpoint component (Java) to dynamically generate presentations from images in an image library on the web. This subsequent ppt file is then downloaded to the user’s machine for them to use. The people who download the presentation on a Mac machine and work with it using MS PowerPoint (v.X, for the most part) sooner or later have the program crash on them. I had several users complain about Powerpoint freezing up on them and having to ‘Force Quit’ it. Other users had Powerpoint abruptly crashing. Has anybody else had this problem?

The error log starts as below:

Date/Time:
2006-08-09 10:16:37 -0400

OS Version: 10.3.9 (Build 7W98)

Report Version: 2

Command: Microsoft PowerPoint

Path: /Applications/Microsoft Office X/Microsoft PowerPoint

Version: ??? (???)

PID: 1681

Thread: 0

Exception: EXC_BAD_ACCESS (0x0001)

Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x00000000

Thread 0 Crashed:

0 Microsoft_Drawing_2001Z 0x0243a720 0x229cc40 + 0x19dae0


I forgot to include the JAVA code that we use for generating the presentation

import com.aspose.powerpoint.;
import java.io.
;
import java.util.;
import java.net.
;
import javax.media.jai.JAI;
import javax.media.jai.RenderedOp;
import java.sql.*;

public class createMacPPT{


public createMacPPT() throws Exception{
//constructor
}

public Connection connectToDatabase() throws Exception{
// code for connecting to database
return connection;
}

public static java.sql.ResultSet runQuery(String queryString, Connection connection) throws Exception{
// code for processing SQL
return rs;
}

public void doOneCollection(String IDForSQL, String destinationFile) throws Exception{
License lic = new License();
try {
lic.setLicense(new FileInputStream(new File(“C:\path\to\licenseFile\Aspose.PowerPoint.lic”)));
}
catch (Exception e) {}
Presentation pres = null;
FileInputStream source = null;
FileOutputStream destination = null;
// empty presentation to use
String pptPath = “C:\path\to\PPTFile\Presentation.ppt”;
String destPath = destinationFile;
source = new FileInputStream(pptPath);
destination = new FileOutputStream(destPath);
pres = new Presentation(source);
Slides slides = pres.getSlides();
Placeholders pholders;
TextHolder th;
Slide slide;

int rowNum = 0;

String imageOnServer = “”;

// Get connection
Connection conn = connectToDatabase();

queryString = “SELECT * FROM Database”;
java.sql.ResultSet rsC = runQuery(queryString, conn);

rsC.first();


//First slide has title of presentation

slide = pres.getSlideByPosition(1);
Rectangle titleText = slide.getShapes().addRectangle(100,100,5550,200);
titleText.getLineFormat().setShowLines(false);
titleText.addTextFrame(CollectionTitle);



while (rsC.next()){
ItemDir = rsC.getString(“ItemDir”);
ItemID = rsC.getObject(“ItemID”).toString();
PhysicalFileName = rsC.getString(“PhysicalFileName”);
FileExtension = rsC.getString(“FileExtension”);
ItemTitle = rsC.getString(“ItemTitle”);
FileTypeName = rsC.getString(“FileTypeName”);


if(FileTypeName.equals(“Image”)){
slide = pres.addEmptySlide();
imageOnServer = “http://imageServer/"+PhysicalFileName+"."+FileExtension+”;
URL url = new URL(imageOnServer);
InputStream in = url.openStream();
BufferedInputStream bufIn = new BufferedInputStream(in);
Picture pic1 = new com.aspose.powerpoint.Picture(pres, bufIn);
int picid1 = pres.getPictures().add(pic1);
RenderedOp img = JAI.create(“url”, url);
int pictureWidth = img.getWidth() * 8;
int pictureHeight = img.getHeight() * 8;
int slideWidth = slide.getBackground().getWidth();
int slideHeight = slide.getBackground().getHeight();
int pictureFrameWidth = (slideWidth/2 - pictureWidth/2);
int pictureFrameHeight = (slideHeight/2 - pictureHeight/2);

PictureFrame pf = slide.getShapes().addPictureFrame(picid1, pictureFrameWidth, pictureFrameHeight, pictureWidth, pictureHeight);
Rectangle rect = slide.getShapes().addRectangle(100,100,5550,200);
rect.getLineFormat().setShowLines(false);
rect.addTextFrame(ItemTitle);
TextFrame tFrame = rect.getTextFrame();

tFrame.getLinks().clear();
tFrame.getParagraphs().get(0).getPortions().get(0).setFontColor(java.awt.Color.black);
tFrame.getParagraphs().get(0).setAlignment(1);
//set the link for coming to view the actual image
rect = slide.getShapes().addRectangle(100,4000,5550,200);
rect.getLineFormat().setShowLines(false);
rect.addTextFrame(“Link to this item”);
tFrame = rect.getTextFrame();
tFrame.getLinks().clear();
Link titleLink = tFrame.getLinks().addLink();
titleLink.setBegin(0);
titleLink.setEnd(tFrame.getText().length());
titleLink.setExternalHyperlink(“http://serverName”+"/linkForViewing");
tFrame.getParagraphs().get(0).getPortions().get(0).setFontColor(java.awt.Color.black);
tFrame.getParagraphs().get(0).setAlignment(1);
}
}
pres.write(destination);
source.close();
destination.close();
rsC.close();
}
}

Hello Sunbomb.
According to a component’s name (aspose.powerpoint instead of aspose.slides), you are using outdated version. Please check current version of Aspose.Slides for java, there was a lot of bugfixes since component’s renaming.

Hi Nikolay,
We purchased our license last December (for Aspose.Powerpoint), so it should still be valid for Aspose.Slides, right? I have an issue where I cannot test the Java code that I am using with a main() method (this is described here: http://www.aspose.com/Community/forums/post/44906.aspx), so I cannot be sure. I renamed the Apose.Powerpoint.lic file to Aspose.Slides.lic and the one time I tried to apply the license file (through a web application call), I got an error that basically indicated that this did not work.

Thanks

I upgraded the jar file to aspose.slides.jar. Then I changed the name of the Aspose.Powerpoint.lic file to Aspose.Slides.lic. Also I specified the license declaration in the code as com.aspose.slides.License and this worked. So thanks.