PageHeight is: 33482.0 PageWidth is: 2490.0. The minimum allowed page size is 3 by 3 units (approximately 0.04 by 0.04 inch); the maximum is 14-400 by 14-400 units (200 by 200 inches)

I have a print lib which prints images to DOC files and PDF files!!!

For several reasons I passed from “Aspse Words 10.x.x” to “Aspose Words 15.5.0” and from “Aspose Pdf 3.0.1” to “Aspose Pdf. 9.1.0”

In the old versions I was able to create very very very big PDF files from BIG images! But on the new libs I get this error

16:03:52,745 ERROR [STDERR] java.lang.IllegalStateException: PageHeight is: 33482.0 PageWidth is: 2490.0. The minimum allowed page size is 3 by 3 units (approximately 0.04 by 0.04 inch); the maximum is 14,400 by 14,400 units (200 by 200 inches).
16:03:52,745 ERROR [STDERR] at aspose.pdf.internal.kx.a(Unknown Source)
16:03:52,746 ERROR [STDERR] at aspose.pdf.internal.ky.a(Unknown Source)
16:03:52,746 ERROR [STDERR] at aspose.pdf.xml.DocumentBase.a(Unknown Source)
16:03:52,746 ERROR [STDERR] at aspose.pdf.internal.jy.a(Unknown Source)
16:03:52,746 ERROR [STDERR] at aspose.pdf.Pdf.a(Unknown Source)
16:03:52,746 ERROR [STDERR] at aspose.pdf.Pdf.save(Unknown Source)
16:03:52,746 ERROR [STDERR] at it.siag.imageManipulation.ImageManipulationImp.printOriginalImage(ImageManipulationImp.java:2015)
16:03:52,746 ERROR [STDERR] at it.siag.imageManipulation.ImageManipulationImp.printOriginalImage(ImageManipulationImp.java:1945)
16:03:52,746 ERROR [STDERR] at it.siag.imageManipulation.servlet.GetImage.executePrintOperation(GetImage.java:666)
16:03:52,746 ERROR [STDERR] at it.siag.imageManipulation.servlet.GetImage.doGet(GetImage.java:472)
16:03:52,746 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
16:03:52,746 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
16:03:52,746 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
16:03:52,746 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
16:03:52,746 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
16:03:52,746 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
16:03:52,747 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
16:03:52,747 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
16:03:52,747 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
16:03:52,747 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
16:03:52,747 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
16:03:52,747 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
16:03:52,747 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
16:03:52,747 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
16:03:52,747 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
16:03:52,747 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
16:03:52,747 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
16:03:52,747 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
16:03:52,747 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
16:03:52,747 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
16:03:52,747 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
16:03:52,747 ERROR [STDERR] at java.lang.Thread.run(Thread.java:662)

this the code involving the problem:

Pdf doc = null;
ByteArrayOutputStream byteArrayOutputStream = null;
try {

doc = new Pdf();
doc.setConformance(PdfFormat.PDF_A_1B);
//doc.setConformance(PdfConformance.PdfA1B);
aspose.pdf.PageSetup ps = new aspose.pdf.PageSetup();
Section section = null;
SiagRenderedOp image;
for (int i = 0; i < images.length; i++) {

image = images[i];

// pagesize
/* ps.setPageWidth((float) ConvertUtil.pixelToPoint(image
.getHeader().getWidth(), image.getHeader()
.getDensityX()));
ps.setPageHeight((float) ConvertUtil.pixelToPoint(image
.getHeader().getHeight(), image.getHeader()
.getDensityY()));
*/
logger.debug("image.getHeader().getHeight() -> " + image.getHeader().getHeight());
logger.debug("image.getHeader().getWidth() -> " + image.getHeader().getWidth());
ps.setPageHeight(image.getHeader().getHeight());
ps.setPageWidth(image.getHeader().getWidth());
doc.setPageSetup(ps);
// image
section = doc.getSections().add();
Image pdfImage = new Image(section);

// File file = new File(“C://temp/test.jpg”);
// ImageIO.write(image.getImage().getAsBufferedImage(), “jpg”,file);
BufferedImage bImage = image.getImage().getAsBufferedImage();
pdfImage.getImageInfo().setSystemImage(bImage);
pdfImage.getImageInfo().setImageFileType(getAsposeImageType(image.getHeader()));
/pdfImage.getImageInfo().setFixWidth(
(float) ConvertUtil.pixelToPoint(image.getHeader()
.getWidth(), image.getHeader().getDensityX()));
pdfImage.getImageInfo().setFixHeight(
(float) ConvertUtil.pixelToPoint(image.getHeader()
.getHeight(), image.getHeader().getDensityY()));
/
pdfImage.getImageInfo().setFixHeight(image.getHeader().getHeight());
pdfImage.getImageInfo().setFixWidth(image.getHeader().getWidth());
section.getParagraphs().add(pdfImage);
}

// System.out.println(“Start save document !”);
// long start = System.currentTimeMillis();
byteArrayOutputStream = new ByteArrayOutputStream();
doc.save(byteArrayOutputStream);
// doc.save(“C:\temp\test.pdf”);
// long elapsed = System.currentTimeMillis() - start;
// System.out.println("End save document time elapsed: " + elapsed + “ms”);
//header
if (template != null)
byteArrayOutputStream = setTemplate(template, images[0], byteArrayOutputStream,images.length);
return byteArrayOutputStream.toByteArray();

} catch (Exception e) {
e.printStackTrace();
logger.fatal(e.getMessage());
}

can you help me?

thx
Michael

Hi Michael,


Thanks for using our API’s.

Can you please share some sample Images causing this problem, so that we can test the scenario at our end. We are really sorry for this inconvenience.

Hi Michael,


Thanks for your inquiry. We have logged an investigation ticket as PDFNEWJAVA-34319 in our issue tracking system for further investigation and resolution. We will notify you as soon as it is resolved.

Please feel free to contact us for any further assistance.

Best Regards,

Some news?

Hi Michael,


Thanks for your inquiry. I am afraid your issue is still not resolved and it is pending for investigation due to other priority tasks. Please be patient, we will update you as soon as we made some significant progress towards issue resolution.

Thanks for your patience and cooperation.

Best Regards,

Hi Michael,


Thanks for your patience.

The development team has further investigated the issue reported earlier and in order to generate correct output, please try using following code snippet based on new Document Object Model (DOM).

[Java]

Document doc = new
Document();<o:p></o:p>

Page page = doc.getPages().add();

page.getPageInfo().setHeight(33482);

page.getPageInfo().setHeight(2490);

// or even:

// page.getPageInfo().setHeight(100000);

// page.getPageInfo().setWidth(100000);

com.aspose.pdf.Image img1 = new com.aspose.pdf.Image();

img1.setFixWidth(20);

img1.setFixHeight(20);

page.getParagraphs().add(img1);

img1.setFile(testdata + "PDFNEWJAVA_33212.png");

// convert to PDF_A_1B

doc.convert(testout + "converlog.txt", PdfFormat.PDF_A_1B, ConvertErrorAction.Delete);

// save to file

doc.save(testout + "PDFNEWJAVA_34319.pdf");

// or save to Stream:

// ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();

//
doc.save(byteArrayOutputStream);

The issues you have found earlier (filed as PDFNEWJAVA-34319) have been fixed in Aspose.Pdf for Java 9.5.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.