I have some pdf's that are not that complex and even after optimizing them they convert extremely slowly with Pdfkit. Attached is two versions of the same document. This single-paged pdf takes approx 40 seconds to convert and it consumes all it can get from my CPU. Just tested setting the resolution to 300 and it resulted in taking several minutes.
Win7 x64 - 8Gb RAM (.Net 4).
Dim myStartTime As DateTime = Now()
Dim myConverter As New Aspose.Pdf.Kit.PdfConverter()
I have noticed the slow performance at my end too and logged this issue as PDFKITNET-22256 in our issue tracking system. Our team will investigate it in detail and you’ll be updated with the results and the resolution accordingly.
I’m sorry to share with you that this issue is not yet resolved. Our team is looking into this issue and I have asked the team to share the ETA. You’ll be updated with the status the earliest possible.
Our team has investigated this issue in detail and I would like to inform you that the fix for this issue will be available at the end of February or early March 2011.
We’re sorry for the inconvenience. If you have any further questions, please do let us know. Regards,
I really hope you can speed up this as we've already purchased Asp.Total and are using it in a production-environment. Even though we're using async calls so the application isn't totally dead the whole server is performing noticably slower while it is finishing rendering the pdf to jpg.
I have a couple of other outstanding posts as well (will ask for an ETA for those now).
Our team tries the best to resolve any issues as soon as possible. However, I’m afraid, due to certain technical difficulties some issues might take a little longer. We’ll try to provide you the fix the earliest possible.
Would you please try using latest version of the API i.e. 20.7 and in case you still notice any performance issue, please share your sample input file along with code snippet. We will test the scenario in our environment and address it accordingly.
Hi Asad, we tried with the last version still and performance issue persists … Just one process takes most of the resource of IBMi/iSeries CPU, it can take 60%
The code snippet below
public static void tiffToPdf(String src, String dest) {
if (checkLic()) {
Document pdf = new Document();
// Create a section in the Pdf object
Page sec = pdf.getPages().add();
// Create an image object in the section
Image img = new Image();
// Add image object into the Paragraphs collection of the section
sec.getParagraphs().add(img);
// Set the path of image file
img.setFile(src);
img.setInNewPage(true);
// Save the Pdf
pdf.save(dest);
pdf.close();
}
}
public static void compressingPDFWithImages(String src, String dest) {
if (checkLic()) {
Document doc = new Document(src);
OptimizationOptions opt = new OptimizationOptions();
opt.setRemoveUnusedObjects(false);
opt.setLinkDuplcateStreams(false);
opt.setRemoveUnusedStreams(false);
// Enable image compression
// Set the quality of images in PDF file
opt.getImageCompressionOptions().setCompressImages(true);
opt.getImageCompressionOptions().setImageQuality(10);
doc.optimizeResources(opt);
// Save the updated file
doc.save(dest);
doc.close();
}
}
public static void tiffToPdf(String src, String dest) {
if (checkLic()) {
Document pdf = new Document();
// Create a section in the Pdf object
Page sec = pdf.getPages().add();
// Create an image object in the section
Image img = new Image();
// Add image object into the Paragraphs collection of the section
sec.getParagraphs().add(img);
// Set the path of image file
img.setFile(src);
img.setInNewPage(true);
// Save the Pdf
pdf.save(dest);
pdf.close();
}
}
public static boolean checkLic() {
boolean validLic = false;
try {
License license = new License();
license.setLicense("Aspose.Pdf.lic");
if (com.aspose.pdf.Document.isLicensed()) {
validLic = true;
System.out.println("License is Set!");
}
} catch (Exception ex) {
System.err.println("Failed to set licence for Aspose.Pdf !!!");
validLic = false;
ex.printStackTrace();
}
return validLic;
}<a class="attachment" href="/uploads/default/42233">~WRD0002.jpg</a> (357 Bytes)
We tested the scenario in our environment using Aspose.PDF for Java 20.8 and noticed an issue where resultant PDF was empty/blank. It did not have any image. Please check attached output generated at our end using the same code snippet which you shared.
Can you please share the output PDF generated at your end along with complete environment details where you are facing performance issue e.g. OS Name and Version, Application type, JDK Version, etc. Also, please share some screenshots of high CPU usage for our reference so that we can further proceed to assist you accordingly.