dbarra / xdocreport

Automatically exported from code.google.com/p/xdocreport
1 stars 0 forks source link

Wrong number of pages (page 2 of 1) #261

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
My docx template has only one page, but it gets several pages after the report 
phase.
1. generate a docx with several pages
2. convert to pdf
3. open

What is the expected output? What do you see instead?
I expected
-> on first page : page 1 of 2
-> on sedond page : page 2 of 2
But I got
-> on first page : page 1 of 1
-> on sedond page : page 2 of 1

What version of the product are you using? On what operating system ?
1.0.2, windows

Please provide any additional information below.
I attached the docx source file and the generated pdf.

Snippet used for convertion :
Options options = Options.getTo(ConverterTypeTo.PDF).via(ConverterTypeVia.XWPF);
report.convert(context, options, out);

Thanks

Original issue reported on code.google.com by sebastie...@ext.adeoservices.com on 21 May 2013 at 4:34

Attachments:

GoogleCodeExporter commented 8 years ago
Hi Sebastien,

I know this problem. Our ODT->PDF converter manages that 
(seehttps://code.google.com/p/xdocreport/issues/detail?id=194), so we must do 
the same thing for docx.

Regards Angelo

Original comment by angelo.z...@gmail.com on 21 May 2013 at 8:04

GoogleCodeExporter commented 8 years ago
Hello,

This patch did the job for me (similar to the tips described in 
https://code.google.com/p/xdocreport/issues/detail?id=194)

Hope it can be reviewed and integrated in a next release.

Thanks,

Julie

Original comment by julie.no...@gmail.com on 9 Sep 2014 at 3:48

Attachments:

GoogleCodeExporter commented 8 years ago
Hi Julie,

Many thank's for your patch. We will see it.

One thing I would like to do (like ODT) is to use an options like 
"processPageNumber" to  manage page number or not.In case when docx has not 
page number, I think it's shame to use ByteArrayInputStream (Im' afraid with 
OutOfMemory).

Regard's Angelo

Original comment by angelo.z...@gmail.com on 9 Sep 2014 at 5:39

GoogleCodeExporter commented 8 years ago
Hi,

Julie thanks for you contribution. It works and It will be integrated to our 
next release.

I had to change a little bit 
org.apache.poi.xwpf.converter.core.utils.XWPFRunHelper.isInstrTextNumpages(Strin
g)

to make It works with pagination.docx because in this file 
instr ="NUMPAGES  \* Arabic  \* MERGEFORMAT"; and not "NUMPAGES"

Thanks again

Original comment by pascal.leclercq on 11 Sep 2014 at 9:28

GoogleCodeExporter commented 8 years ago
Thank's Julie, Pascal for your work.

I have few comments : 

1) "processPageNumber" option.

With your code, you use everyting ByteArrayOutputStream (when docx have page 
number or not). I think it's shame to use ByteArrayOutputStream in the case 
when docx has no page number. So I think we should add an option 
"processPageNumber" to disable this use of ByteArrayOutputStream
2) FastPdfConverter : it shoud be cool if you can do the same thing for 
https://code.google.com/p/xdocreport/source/browse/thirdparties-extension/org.ap
ache.poi.xwpf.converter.pdf/src/main/java/org/apache/poi/xwpf/converter/pdf/Fast
PdfConverter.java ?
3) Add JUnit Issue261 : it should be cool if you could create Issue261 test 
case inside 
https://code.google.com/p/xdocreport/source/browse/thirdparties-extension/org.ap
ache.poi.xwpf.converter.pdf/src/test/java/org/apache/poi/xwpf/converter/core/Abs
tractXWPFPOIConverterTest.java which use pagination.docx (rename it to 
Issue261.docx)

Thank's!

Original comment by angelo.z...@gmail.com on 12 Sep 2014 at 7:15