PDDocument.save file (file) is very slow

Using PDFBox-Android , I am currently loading my PDF in PDDocumentthis way:

PDDocument pdDoc = PDDocument.load(file);
PDDocumentCatalog pdCatalog = pdDoc.getDocumentCatalog();
PDAcroForm acroForm = pdCatalog.getAcroForm();

Then I select the function save()as follows:

long substart = System.currentTimeMillis();
pdDoc.save(file);
Log.d("formData", "save took " + (System.currentTimeMillis() - substart) / 1000);

The save method takes up to 10 seconds on the Nextbook NXA8QC116R (4-6 seconds on my HTC One M8) to save a 93 KB PDF file. I also tried to use BufferedOutputStreamto save the file, but that didn't seem to help.

Is this a flaw in the library, or is there something I can do to speed up the method of saving small files?

+4
source share

Source: https://habr.com/ru/post/1611963/


All Articles