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

Free Support Forum - aspose.com

Problem opening a pdf document with PDFViewer

Hi,

We've just started using Aspose product in order to replace another "PDF utility2" library. Our requirement is to replace some text in an existing PDF file and then print it.

The replaceText() works quite well (except for some cases, but that will be part of another post). The mian problem is that we are not able to open the document with PDFViewer for printing. In fact we are able to open any of our generated PDF document.

This is probably due to our PDF format. I have attached a sample PDF file. Trying to open it with the following code will hang in the openFile() method:

import com.aspose.pdf.kit.PdfViewer;
...

public class TestPrint {

/**
* @param args
* @throws Exception
* @throws PdfViewerException
*/
public static void main(String[] args) throws PdfViewerException, Exception {

String filename = "h:\\My Documents\\reporting\\test.pdf";
PdfViewer pdfviewer = new PdfViewer();


//The file is never open
pdfviewer.openPdfFile(filename);
...

}

Thanks,

oschir

Hi Oschir,

I have tested this file at my end, but I couldn’t notice any problem. Can you please try to use the latest version of Aspose.Pdf.Kit for Java at your end? Also, please make sure that you have specified the proper file name and path; as I can see, the full name of the file is test.pdf.pdf, however you have missed to specify the extension in the code.

If you still find any issues, please do let us know. We’re sorry for the inconvenience.
Regards,