Converting single pages

335 views
Skip to first unread message

El Yobo

unread,
Feb 19, 2010, 9:09:12 PM2/19/10
to JODConverter
Hi,

I would like to use JODConverter as a service to generate PDF from
various documents, which will then be used to generate a thumbnail to
represent the image.

Many of the documents that I'm dealing with are large, sometimes more
than 700 pages; it seems to me that conversion time would be much less
if only the first page was converted (as that's all I'm going to be
using to generate the thumbnail anyway).

Is there any way to do this with JODConverter?

Mirko Nasato

unread,
Feb 20, 2010, 9:28:15 AM2/20/10
to JODConverter
You can set the "PageRange" PDF export option (although it will still
load the entire document before converting only the first page).

Kind regards

Mirko

El Yobo

unread,
Feb 20, 2010, 5:50:12 PM2/20/10
to JODConverter
Thanks for the suggestion. I realise that the whole document still
needs to be loaded, but I assume (and will test) that there are still
some performance gains when only exporting the first page.

I'm having some difficulty setting the option, however. I assume that
the change is in document-formats.js, something along the lines of the
following under the PDF section -

"DRAWING": {"FilterName": "draw_pdf_Export", "PageRange": "1-1"},

I have tried values of 1 and 1-1, but the full PDF is generated in
both cases.

Thanks,
Liam

El Yobo

unread,
Feb 20, 2010, 6:11:23 PM2/20/10
to JODConverter
Further to my previous comment, I have tried specifying the format
file on the command line with -r and I have tried hard coding the
options into the DefaultDocumentFormatRegistry, but with no success.
I have tried PageRange and Pages, with "1" and "1-1", and no
combination of the above seems to make any difference.

Any thoughts?

On Feb 21, 1:28 am, Mirko Nasato <mirko.nas...@gmail.com> wrote:

Mirko Nasato

unread,
Feb 21, 2010, 11:18:53 AM2/21/10
to JODConverter
The PDF filter expects options to be passed in a "FilterData"
property, so you need to customise document-formats.js like so:

"name": "Portable Document Format",
"extension": "pdf",
"mediaType": "application/pdf",
"storePropertiesByFamily": {
"DRAWING": {
"FilterName": "draw_pdf_Export",
"FilterData": {
"PageRange": "1"
}
}
// repeat for other families if needed...

Kind regards

Mirko

El Yobo

unread,
Feb 22, 2010, 6:19:24 PM2/22/10
to JODConverter
That works perfectly, much appreciated.

El Yobo

unread,
Feb 22, 2010, 6:25:36 PM2/22/10
to JODConverter
FYI, in a very unthorough test, processing only the first page does
seem to give significant speed boosts. I processed the same document
(PPT, 27 pages) 10 times only exporting the first page, and 10 times
exporting the whole document).

The average time for exporting all pages was 7.7218, while the average
time for exporting only the first page was 4.7386. Given that the
overhead of starting a new openoffice process each time is the same
for both, the actual performance gain (when used against the web app,
for example) will be greater.

El Yobo

unread,
Feb 22, 2010, 6:33:50 PM2/22/10
to JODConverter
Now, of course, I find myself unsure how I pass these parameters on to
the web application. Is there any easy way to do this, or does it
require a code change of some sort?

El Yobo

unread,
Feb 22, 2010, 8:56:16 PM2/22/10
to JODConverter
Never mind, I've modified the sample web app to take in a
configuration parameter specifying the parameter to load and it's
working fine :)

Thanks again for your help - this project is going to save my bacon.

Reply all
Reply to author
Forward
0 new messages