[
https://issues.apache.org/jira/browse/PDFBOX-4601?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
biswajit updated PDFBOX-4601:
-----------------------------
Description:
in AWS lambda pdf merge giving error as
{{Error in pdf consolidation: Expected scratch file size of 196608 but found
192512.}}
*Code:*
{{PDFMergerUtility pdfMerger = new PDFMergerUtility();}}
{{pdfMerger.addSources(sources);}}
{{pdfMerger.setDestinationStream(mergedPDFOutputStream);}}
{{ pdfMerger.mergeDocuments(MemoryUsageSetting.setupTempFileOnly());}}
both InputStream and OutputStream are ByteArrayInputStream and
ByteArrayOutputStream. AWS Lambda environment has 512MB space available only
for /tmp partition. This could be an issue or not I am not sure. And AWS lambda
do not permit other directory than /tmp partition to create files.
And while reading into the code I found below piece of code which I think
always be true. Because if you add some constant amount to an integer that will
always be constant amount greater than its original value
in ScratchFile.java => enlarge() method:
{{if (pageCount + ENLARGE_PAGE_COUNT > pageCount)}}
{{ {}}
{{ fileLen += ENLARGE_PAGE_COUNT * PAGE_SIZE;}}
{{ raf.setLength(fileLen);}}
{{ freePages.set(pageCount, pageCount + ENLARGE_PAGE_COUNT);}}
{{ }}}
was:
in AWS lambda pdf merge giving error as
{{Error in pdf consolidation: Expected scratch file size of 196608 but found
192512.}}
*Code:*
{{PDFMergerUtility pdfMerger = new PDFMergerUtility();}}
{{ pdfMerger.addSources(sources);}}
{{ pdfMerger.setDestinationStream(mergedPDFOutputStream);}}
{{pdfMerger.mergeDocuments(MemoryUsageSetting.setupTempFileOnly());}}
both InputStream and OutputStream are ByteArrayInputStream and
ByteArrayOutputStream. AWS Lambda environment has 512MB space available only
for /tmp partition. This could be an issue or not I am not sure. And AWS lambda
do not permit other directory than /tmp partition to create files.
And while reading into the code I found below piece of code which I think
always be true. Because if you add some constant amount to an integer that will
always be constant amount greater than its original value
in ScratchFile.java => enlarge() method:
{{if (pageCount + ENLARGE_PAGE_COUNT > pageCount)}}
{{ {}}
{{ fileLen += ENLARGE_PAGE_COUNT * PAGE_SIZE;}}
{{ raf.setLength(fileLen);}}
{{ freePages.set(pageCount, pageCount + ENLARGE_PAGE_COUNT);}}
{{ }}}
> in AWS lambda pdf merge giving error as Error in pdf consolidation: Expected
> scratch file size of 196608 but found 192512
> -------------------------------------------------------------------------------------------------------------------------
>
> Key: PDFBOX-4601
> URL: https://issues.apache.org/jira/browse/PDFBOX-4601
> Project: PDFBox
> Issue Type: Bug
> Environment: AWS Lambda
> Reporter: biswajit
> Priority: Major
>
> in AWS lambda pdf merge giving error as
> {{Error in pdf consolidation: Expected scratch file size of 196608 but found
> 192512.}}
>
> *Code:*
> {{PDFMergerUtility pdfMerger = new PDFMergerUtility();}}
> {{pdfMerger.addSources(sources);}}
> {{pdfMerger.setDestinationStream(mergedPDFOutputStream);}}
> {{ pdfMerger.mergeDocuments(MemoryUsageSetting.setupTempFileOnly());}}
>
>
> both InputStream and OutputStream are ByteArrayInputStream and
> ByteArrayOutputStream. AWS Lambda environment has 512MB space available only
> for /tmp partition. This could be an issue or not I am not sure. And AWS
> lambda do not permit other directory than /tmp partition to create files.
>
> And while reading into the code I found below piece of code which I think
> always be true. Because if you add some constant amount to an integer that
> will always be constant amount greater than its original value
> in ScratchFile.java => enlarge() method:
>
> {{if (pageCount + ENLARGE_PAGE_COUNT > pageCount)}}
> {{ {}}
> {{ fileLen += ENLARGE_PAGE_COUNT * PAGE_SIZE;}}
> {{ raf.setLength(fileLen);}}
> {{ freePages.set(pageCount, pageCount + ENLARGE_PAGE_COUNT);}}
> {{ }}}
>
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]