2015 Dec 11 3:47 AM
Hi
My Requirement is to Count PDF Pages while uploading document , How to approach to achieve this requirement.
I have tried a lot but didn't get it , Help would be appreciated.
Thanks
Hi
My Requirement is to Count PDF Pages while uploading document , How to approach to achieve this requirement.
I have tried a lot but didn't get it , Help would be appreciated.
Thanks
2015 Dec 11 4:02 AM
Hi Jhon,
Are you working with Smartforms and OTF? If so, check this thread: Page counter over multiple Smartforms | SCN
Regards,
2015 Dec 11 6:49 AM
Hi David,
I'm not working on Smartforms , My requirement is to upload file from Presentation server (From Desktop) and count the No.of pages in PDF Document.
With PDF Pages count , I have to calculate some fee.
Thanks
2015 Dec 11 7:11 AM
Hi,
How about using external java command
See http://pdfbox.apache.org/index.html
Found here http://stackoverflow.com/questions/4134949/determine-the-number-of-pages-in-a-pdf-file
PDDocument doc = PDDocument.load(new File("file.pdf"));
int count = doc.getNumberOfPages();
Regards .
2015 Dec 11 7:25 AM
Hi Eitan
Can you please elaborate more , I wants to do it in SAP ABAP Environment.
Thanks
2015 Dec 11 10:49 AM
2015 Dec 11 11:14 AM
Some java code:
import java.io.File;
import java.io.IOException;
import org.apache.pdfbox.pdmodel.PDDocument;
public class Main {
public static void main(String[] args) {
{
// For test...
if (args.length == 0) {
args = new String[] { "H:/Temp/An Easy Reference for ALV Grid Control.pdf" };
}
}
try {
final File file = new File(args[0]);
final PDDocument document = PDDocument.load(file);
final int numberOfPages = document.getNumberOfPages();
System.out.println(String.format("%d %s", numberOfPages, file.getName()));
} catch (final IOException exception) {
exception.printStackTrace();
}
}
}
Seems to be working.....
Regards.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |