user1517136
user1517136

Reputation: 11

GAE 1.7 Conversion API Java html -> pdf ConversionResult always returning test.pdf

I am trying to use Conversion API to convert from html to PDF. Here is my code

public byte[] toPDF(String html){
    Asset asset = new Asset("text/html", html.getBytes(), "in.html");
    Document document = new Document(asset);
    Conversion conversion = new Conversion(document, "application/pdf");
    ConversionService service = ConversionServiceFactory.getConversionService();
    ConversionResult result = service.convert(conversion);
    if (result.success()) {
       for (Asset assetResult : result.getOutputDoc().getAssets()) {
           return assetResult.getData();
        }
    return null;
    } else {
        // Do stuff with result.getErrorCode());
        return null;
    }
}

ConversionResult object always returns test.pdf (from Conversion API) bytes, but not the (pdf) bytes from my html newly converted in PDF. Does anyone know what the problem is? Is it because I am using Conversion API on localhost? If yes is there a workaround?

Thanks in advance.

Alban

Upvotes: 1

Views: 300

Answers (1)

Peter McKenzie
Peter McKenzie

Reputation: 741

Conversion API is not fully supported on the development appserver. It's only a very basic stub implementation that always returns a fixed file.

Upvotes: 1

Related Questions