Helo to allI,
I am trying to convert text/HTML file into Pdf file.
I am using AppEngine Conversion-API (for java).
I am getting proper output on browser(Jsp page). But the created pdf
page, from the HTML is not good.
It looks like without proper alignment. Attached is the HTML file
and the PDF created.
Please send me the solution for obtaining a proper PDF.
1) Using Below code, I am trying to converting text/html file into PDF
file.
List<Asset> listAssets = new ArrayList<Asset>();
Asset asset = new Asset("text/html", wrapper.getOutput().getBytes(),
"testfile.html");
listAssets.add(asset);
Document document = new Document(listAssets);
Conversion conversion = new Conversion(document, "application/pdf");
ConversionService service =
ConversionServiceFactory.getConversionService();
ConversionResult result = service.convert(conversion);
if (result.success()) {
res.setStatus(HttpServletResponse.SC_OK);
res.setHeader("Content-Disposition", "inline;");
res.setContentType("application/pdf");
for (Asset resAsset : result.getOutputDoc().getAssets()) {
res.getOutputStream().write(resAsset.getData());
}
} else {
ConversionErrorCode errorcode = result.getErrorCode();
log.severe(errorcode.name());
log.severe(errorcode.toString());
System.out.println(errorcode);
System.out.println(errorcode.toString());
res.getWriter().write("Error creating pdf");
}
2) The Required Page is clean on Browser, But in pdf ,its very bad .
Please send me the solution for this conversion failures.
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-appengine/-/Xa5hlNlzDOAJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.
template1.pdf
Description: Adobe PDF document
