web stats
count number of pages in pdf - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 12-17-2015, 03:36 AM
vibinChander vibinChander is offline
OBX.2 Kenobi
 
Join Date: Jul 2015
Location: Chennai
Posts: 74
vibinChander is on a distinguished road
Send a message via Skype™ to vibinChander
Question count number of pages in pdf

Hi Guys,

I'm trying to encode and decode the pdf file to identify the differences in the output files. While doing so, i like to count the number of pages available in the pdf, which would be of great help from user perspective.

I can encode and decode the pdf file but i couldn't identify a way to count number of pages in the pdf. can u guys help me on this? mirth3.3.1
Reply With Quote
  #2  
Old 12-17-2015, 04:40 AM
rauchj rauchj is offline
OBX.1 Kenobi
 
Join Date: Feb 2014
Location: Freiburg, Germany
Posts: 43
rauchj is on a distinguished road
Default

Maybe this will help you:

http://stackoverflow.com/questions/4...-in-a-pdf-file
Reply With Quote
  #3  
Old 12-17-2015, 06:19 AM
vibinChander vibinChander is offline
OBX.2 Kenobi
 
Join Date: Jul 2015
Location: Chennai
Posts: 74
vibinChander is on a distinguished road
Send a message via Skype™ to vibinChander
Thumbs down couldn't find any changes

Hi rauchj,

I tried the link and got into http://pdfbox.apache.org/download.html to use pdfbox apache and got apache pdfbox jar file and placed them in custom-lib folder of mirth but couldn't find those code working, neither i noticed the inclusion of additional in-built functions inside mirth.
Is this a rightway? Am I doing it correctly? .or am I going wron somewhere?
Reply With Quote
  #4  
Old 12-17-2015, 07:11 AM
rauchj rauchj is offline
OBX.1 Kenobi
 
Join Date: Feb 2014
Location: Freiburg, Germany
Posts: 43
rauchj is on a distinguished road
Default

what mirth version do you use?

have a look here: http://www.mirthcorp.com/community/w...+Mirth+Connect
Reply With Quote
  #5  
Old 02-09-2017, 12:54 AM
amble amble is offline
OBX.2 Kenobi
 
Join Date: Nov 2015
Posts: 93
amble is on a distinguished road
Default

Was recently looking how to do this and couldn't find much on the forums so here's a snippet that worked using a File Reader

Code:
var srcFile = sourceMap.get('originalFilename');
var srcDir = sourceMap.get('fileDirectory');

var fileConts = FileUtil.readBytes(srcDir +'/' +srcFile);
var file = new Packages.com.itextpdf.text.pdf.PdfReader(fileConts);
var pageNum = file.getNumberOfPages();
pageNum = pageNum.toString().substring(0,1);
file.close();
Reply With Quote
Reply

Tags
ccda, mirth3.3.1, pdf

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 04:37 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation