Mercurial > hg > digilib
changeset 1445:49ba776b9004 new_scaling
fixed PDFServlet after changes.
author | robcast |
---|---|
date | Tue, 10 Nov 2015 18:50:43 +0100 |
parents | 02df383e0a85 |
children | 25d5ab192395 |
files | common/src/main/java/digilib/image/ImageJobDescription.java pdf/src/main/java/digilib/conf/PDFRequest.java pdf/src/main/java/digilib/pdf/PDFStreamWorker.java pdf/src/main/java/digilib/pdf/PDFTitlePage.java |
diffstat | 4 files changed, 33 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/common/src/main/java/digilib/image/ImageJobDescription.java Tue Nov 10 18:36:46 2015 +0100 +++ b/common/src/main/java/digilib/image/ImageJobDescription.java Tue Nov 10 18:50:43 2015 +0100 @@ -187,12 +187,15 @@ * @param pm * @param dlcfg * @return + * @throws ImageOpException + * @throws IOException */ - public static ImageJobDescription getInstance(ParameterMap pm, DigilibConfiguration dlcfg) { + public static ImageJobDescription getInstance(ParameterMap pm, DigilibConfiguration dlcfg) throws IOException, ImageOpException { ImageJobDescription newMap = new ImageJobDescription(dlcfg); // add all params to this map newMap.params.putAll(pm.getParams()); newMap.initOptions(); + newMap.prepareScaleParams(); return newMap; }
--- a/pdf/src/main/java/digilib/conf/PDFRequest.java Tue Nov 10 18:36:46 2015 +0100 +++ b/pdf/src/main/java/digilib/conf/PDFRequest.java Tue Nov 10 18:50:43 2015 +0100 @@ -1,5 +1,7 @@ package digilib.conf; +import java.io.IOException; + /* * #%L * A container class for storing a set of instruction parameters @@ -33,6 +35,7 @@ import org.apache.log4j.Logger; import digilib.image.ImageJobDescription; +import digilib.image.ImageOpException; import digilib.io.DocuDirectory; import digilib.io.FileOpException; import digilib.util.NumRange; @@ -72,9 +75,10 @@ * * @param dlcfg The DigilibConfiguration. * @param request - * @throws FileOpException + * @throws ImageOpException + * @throws IOException */ - public PDFRequest(HttpServletRequest request, DigilibConfiguration dlcfg) throws FileOpException { + public PDFRequest(HttpServletRequest request, DigilibConfiguration dlcfg) throws IOException, ImageOpException { super(30); dlConfig = dlcfg; initParams(); @@ -105,9 +109,10 @@ * Read the request object. * * @param request - * @throws FileOpException + * @throws ImageOpException + * @throws IOException */ - public void setWithRequest(HttpServletRequest request) throws FileOpException { + public void setWithRequest(HttpServletRequest request) throws IOException, ImageOpException { // read matching request parameters for the parameters in this map for (String k : params.keySet()) { if (request.getParameterMap().containsKey(k)) { @@ -145,7 +150,7 @@ } - public ImageJobDescription getImageJobInformation(){ + public ImageJobDescription getImageJobInformation() throws IOException, ImageOpException{ return ImageJobDescription.getInstance(this, dlConfig); }
--- a/pdf/src/main/java/digilib/pdf/PDFStreamWorker.java Tue Nov 10 18:36:46 2015 +0100 +++ b/pdf/src/main/java/digilib/pdf/PDFStreamWorker.java Tue Nov 10 18:50:43 2015 +0100 @@ -40,6 +40,7 @@ import digilib.image.DocuImage; import digilib.image.ImageJobDescription; +import digilib.image.ImageOpException; import digilib.image.ImageWorker; import digilib.conf.DigilibConfiguration; import digilib.conf.PDFRequest; @@ -85,9 +86,10 @@ * @throws InterruptedException * @throws ExecutionException * @throws IOException + * @throws ImageOpException */ protected OutputStream renderPDF() throws DocumentException, InterruptedException, - ExecutionException, IOException { + ExecutionException, IOException, ImageOpException { // create document object doc = new Document(PageSize.A4, 0, 0, 0, 0); PdfWriter docwriter = null; @@ -147,7 +149,13 @@ */ public Document addTitlePage(Document doc) throws DocumentException { PDFTitlePage titlepage = new PDFTitlePage(job_info); - doc.add(titlepage.getPageContents()); + try { + doc.add(titlepage.getPageContents()); + } catch (IOException e) { + throw new DocumentException(e); + } catch (ImageOpException e) { + throw new DocumentException(e); + } doc.newPage(); return doc; }
--- a/pdf/src/main/java/digilib/pdf/PDFTitlePage.java Tue Nov 10 18:36:46 2015 +0100 +++ b/pdf/src/main/java/digilib/pdf/PDFTitlePage.java Tue Nov 10 18:50:43 2015 +0100 @@ -40,6 +40,7 @@ import com.itextpdf.text.Paragraph; import digilib.conf.PDFRequest; +import digilib.image.ImageOpException; import digilib.io.FileOpException; import digilib.servlet.PDFCache; @@ -78,6 +79,10 @@ return new DigilibInfoReader(infoFn.getAbsolutePath()); } catch (FileOpException e) { logger.warn("info.xml not found"); + } catch (IOException e) { + logger.warn("image directory for info.xml not found"); + } catch (ImageOpException e) { + logger.warn("problem with parameters for info.xml"); } return null; } @@ -86,8 +91,10 @@ * generate iText-PDF-Contents for the title page * * @return + * @throws ImageOpException + * @throws IOException */ - public Element getPageContents(){ + public Element getPageContents() throws IOException, ImageOpException{ Paragraph content = new Paragraph(); content.setAlignment(Element.ALIGN_CENTER); @@ -165,7 +172,7 @@ return null; } - private String getTitle(){ + private String getTitle() throws IOException, ImageOpException { if(info_reader.hasInfo()) return info_reader.getAsString("title"); else