metanorma / mn-native-pdf

Development repository for mn2pdf with Metanorma document samples
3 stars 2 forks source link

PDF ISO: java.lang.OutOfMemoryError #730

Closed Intelligent2013 closed 3 months ago

Intelligent2013 commented 3 months ago

Source issue: https://github.com/metanorma/metanorma-standoc/issues/900#issuecomment-2291013304

Source Presentation XML file size is 144Mb (contains attachments).

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
Intelligent2013 commented 3 months ago

Currently, if the file from @name is exists on the disk:

<attachment name="_document_attachments/READY-20230316-no-toc-iso-10303-49.pdf">data:application/pdf;base64,JVBERi0xLjYNJeLjz9MNCjExNDU0IDAg                                          b2JqDTw8L0xpbmVhcml6ZWQgMS9MIDE1NTExOTQvTyAxMTQ1Ni9FIDEyNDQz

then attachment/text() is cleaning in the XSLT to free the memory resources.

If file doesn't exist, then attachment/text() is using as the attachment source.

Currently, the are two issues:

Intelligent2013 commented 3 months ago

java.net.URISyntaxException: Illegal character in opaque part at index 60: data:application/pdf;base64,JVBERi0xLjYNJeLjz9MNCjExNDU0IDAg b2JqDTw8L0xpbmVhcml6ZWQgMS9MIDE1NTExOTQvTyAxMTQ1Ni9FIDEyNDQz

Line breaks don't allowed in URI in XSL-FO. Fixed.

Intelligent2013 commented 3 months ago

Fixed.