Evalution Question



We are currently evaluating Aspose.PDF.Kit. We are using it primarily
to print generated PDF files. About 50% of the time the printouts are
fine and the other 50% they are gibberish. Could someone tell me if
this has something to do with the software being an evaluation version?

Thank you.



Thank you for considering Aspose.

Can you please provide the files that can reproduce the error to us?



Thanks for your response.

This is the code we are using to evaluate the tool. I think was taken
right out your documentation. Just by way of background - for this test
we are printing the exact same file each time.

Thanks for your help.

protected void printPdfFile()

throws PrinterException


//Shouldn’t need this since all Print Jobs are sitting in a queue?

//if (printingLocks != 0) { return; }

//adds a print lock to ensure only a pdf file to print.


boolean canceled = false;

//sets the default print scale - false.


//gets a printjob object.

PrinterJob printJob = PrinterJob.getPrinterJob();

//creates a new PageFormat instance and sets it

//to a default size and orientation.

PageFormat pf = printJob.defaultPage();

//sets PageOrientation to best use page layout.

int orientation =
pdfviewer.getPdfWidth() < pdfviewer.getPdfHeight() ?
PageFormat.PORTRAIT : PageFormat.LANDSCAPE;


Paper paper = new Paper();

//A4 bordless

//paper.setSize(595, 842);

//paper.setImageableArea(0, 0, 595, 842);



//paper.setSize(297, 421);



paper.setSize(595, 842);

paper.setImageableArea(43, 43, 509, 756);

//sets the Paper object for this PageFormat.


//sets the start page for printing,

//and you can change it according to

//your request but make sure

//1 =< startPage <= endPage <= pdfviewer.getPdfFilePageCount().

int startPage = 1;

//sets the end page for printing,

//and you can change it according to

//your request but make sure

//1 =< startPage <= endPage <= pdfviewer.getPdfFilePageCount().

int endPage = pdfviewer.getPdfFilePageCount();

//sets the page range according to the user’s decision.


//sets the page format for each page between startPage and endPage.

for(int page = startPage; page > endPage + 1; page++)


//queries document for the number
of pages and the PageFormat and Printable for each page held in the
Pageable instance, document.


//prints a set of pages.


//if problems, reports any errors.

if (!canceled && !pdfviewer.isPrintSuccess())

throw new PrinterException(

    "Problems encountered printing.\n

" +





OK. We will check this problem. Can you please also provide the pdf document that can reproduce the error?


Here is a copy of the type of PDF that is causing trouble. We have
determined that the files with trouble are files that were converted
from HTML. However, the same files do print fine from within the Adobe



Thank you for considering Aspose.

The problem is irrelevant to the evaluation version. We have the example of samplePdfViewer in Aspose.PDF.Kit. If you can view the pdf file in that example correctly, you also can print the pdf file exactly. If you can not view the pdf file or not correct, it is a bug. After all the pdf specification is very large, we cannot complete the whole function. In the latest released version we support the 85% function of pdf specification version 1.6. If you can send the test pdf file, we will imporve the Aspose.PDF.Kit in the next version very soon.