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

Free Support Forum - aspose.com

Apose new PDF 4.0 for Java - Exceptions thrown while getting image

Hi,

We're getting an exception thrown while trying to save a PDF page to an image file.

class com.aspose.ms.System.d: null key<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Parameter name: key

com.aspose.ms.System.a.f.get_Item(Unknown Source)

com.aspose.pdf.engine.commondata.text.encoding.ConsolidatedCache.getFromCache(Unknown Source)

com.aspose.pdf.engine.c.a.a(Unknown Source)

com.aspose.pdf.Y.a(Unknown Source)

com.aspose.pdf.ImageDevice.a(Unknown Source)

com.aspose.pdf.PngDevice.processInternal(Unknown Source)

com.aspose.pdf.PngDevice.process(Unknown Source)

com.aspose.pdf.facades.PdfConverter.getNextImage(Unknown Source)

com.aspose.pdf.facades.PdfConverter.getNextImage(Unknown Source)

com.aspose.pdf.facades.PdfConverter.getNextImage(Unknown Source)

com.avaya.aac.dcs.PDFToPNGConverter.convert(PDFToPNGConverter.java:72)

com.avaya.aac.dcs.AsposeConverter.main(AsposeConverter.java:27)

at com.aspose.ms.System.a.f.get_Item(Unknown Source)

at com.aspose.pdf.engine.commondata.text.encoding.ConsolidatedCache.getFromCache(Unknown Source)

at com.aspose.pdf.engine.c.a.a(Unknown Source)

at com.aspose.pdf.Y.a(Unknown Source)

at com.aspose.pdf.ImageDevice.a(Unknown Source)

at com.aspose.pdf.PngDevice.processInternal(Unknown Source)

at com.aspose.pdf.PngDevice.process(Unknown Source)

at com.aspose.pdf.facades.PdfConverter.getNextImage(Unknown Source)

at com.aspose.pdf.facades.PdfConverter.getNextImage(Unknown Source)

at com.aspose.pdf.facades.PdfConverter.getNextImage(Unknown Source)

Hi there,


Thanks for your inquiry. Can you please share your sample code and source PDF document here? So we will test the scenario at our end and will guide you accordingly.

Sorry for the inconvenience faced.

Best Regards,

The conversion method below:

public boolean convert() {
String pdfFile = formatUploadedFile(inputFileName);
try {
PdfConverter converter = new PdfConverter();
converter.bindPdf(pdfFile);

int startPgNo = converter.getStartPage();
int endPgNo = converter.getEndPage();
int totalPages = endPgNo - startPgNo;

converter.setStartPage(1);
converter.setEndPage(4);
converter.setResolution(new Resolution(120));

try {
converter.doConvert();
} catch (Exception e1) {
e1.printStackTrace();
}

//convert pages to images
int imageCount = 1;
DecimalFormat ZERO_FORMATTER = new DecimalFormat("0000");
while (converter.hasNextImage()) {
try {
StringBuffer strBuffer = new StringBuffer("/tmp/result");
strBuffer.append(ZERO_FORMATTER.format(imageCount)).append(".png");

String pngFileName = strBuffer.toString();
converter.getNextImage(pngFileName, ImageFormat.getPng());
} catch (Exception e) {
e.printStackTrace();
}
imageCount++;
}

} catch (Exception e) {
e.printStackTrace();
}
return true;
}

Any PDF will do. Attached is a sample PDF doc.

Hi Yew,


Thanks for sharing the resource file.

I have tested the scenario using Aspose.Pdf for Java 4.0.0 in Eclipse application running over Windows 7(X64) where I have jdk1.7.0_09 (X64) and I am unable to notice any issue during conversion process. All the pages are properly converted to Image format.

For your reference, I have also attached the resultant images which are generated over my end.

[Java]

com.aspose.pdf.facades.PdfConverter converter = new com.aspose.pdf.facades.PdfConverter();<o:p></o:p>

converter.bindPdf("c:/pdftest/Ajax-Ref.pdf");

int startPgNo = converter.getStartPage();

int endPgNo = converter.getEndPage();

int totalPages = endPgNo - startPgNo;

converter.setResolution(new com.aspose.pdf.Resolution(120));

converter.doConvert();

//convert pages to images

int imageCount = 1;

//DecimalFormat ZERO_FORMATTER = new DecimalFormat("0000");

while (converter.hasNextImage())

{

StringBuffer strBuffer = new StringBuffer("/tmp/result");

// strBuffer.append(ZERO_FORMATTER.format(imageCount)).append(".png");

String pngFileName = strBuffer.toString();

converter.getNextImage("c:/pdftest/ImageConverted_" + imageCount + ".png");

imageCount++;

}

Yes. It works for Windows but NOT Linux. Both platforms are using JDK 1.6.x.

Hi Yew,


Thanks for providing additional information. We have logged the issue as PDFNEWJAVA-33505 for further investigation and resolution. We will notify you via this forum thread as soon as issue is resolved.

Sorry for the inconvenience faced.

Best Regards,

Is this issue fixed? I am also getting a smilar error.


class com.aspose.ms.System.d: null key

Parameter name: key

com.aspose.ms.System.a.f.get_Item(Unknown Source)

com.aspose.pdf.engine.commondata.text.encoding.ConsolidatedCache.getFromCache(Unknown Source)

com.aspose.pdf.engine.c.a.a(Unknown Source)

com.aspose.pdf.Y.a(Unknown Source)

com.aspose.pdf.ImageDevice.a(Unknown Source)

com.aspose.pdf.PngDevice.processInternal(Unknown Source)

com.aspose.pdf.PngDevice.process(Unknown Source)

com.aspose.pdf.facades.PdfConverter.getNextImage(Unknown Source)

com.aspose.pdf.facades.PdfConverter.getNextImage(Unknown Source)

com.test.convert.common.imageconverter.PDFDocumentConverter.pdfConverter(PDFDocumentConverter.java:59)


Works only in Windows. Not in Mac or Linux. Any suggestions?

Hi there,


Thanks for your inquiry. I’m afraid the issue is still not resolved as we’ve recently noticed the issue and its pending with other priority tasks. As soon as our development team completes the analysed then we will share the initial findings/ETA for the issue.

Thanks for your patience and cooperation.

Best Regards,

I set the license in my unit tests and all the errors disappeared in all environment. It would be nice if Aspose works without setting the license.(Of course with “Trail Edition watermark”)


For those who doesn’t have actual license, you can a temporary license from Aspose for 30 days I believe.

I’ve tried with the 30 days temporarily license but still gettting the same exceptions.

When could we've a new version that would work in Linux? The timeline for the fix will affect our decision in whether to use Apose PDF for Java or other PDF library. Thanks!

OK. We got it working. Looks like the problem is due to missing fonts from the standard fonts directory. Questions are:

1) Does Aspose auto convert to the closes fonts family?

2) How do we provide font hints for Aspose?

3) Will there be a “standard” fonts setting for different products: PDF, Slides, Word, Excel, etc.

Hi there,


Thanks for your patience. We have a good news for you. The above reported issue has been resolved and fix will be available in upcoming release of Aspose.Pdf for Java 4.1.0. Currently its testing is underway and will be published soon. We will notify you via this forum thread as soon as its available for download.

Moreover in reference to your questions, while the referenced font is not available on system then it replaces it with system default font. You can refer documentation link for fonts handling and I’m afraid we don’t have some standard font settings for all components.

Font handling while creating a new document
Embedding font in an existing document
Replacing font in an existing document

Please feel free to contact us for any further assistance.

Best Regards,

The issues you have found earlier (filed as PDFNEWJAVA-33505) have been fixed in Aspose.Pdf for Java 4.1.0update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
(2)