Issue 433 in xdocreport: PDF conversion with headers

470 views
Skip to first unread message

xdocr...@googlecode.com

unread,
Aug 15, 2014, 10:19:19 AM8/15/14
to xdocr...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 433 by julie.no...@gmail.com: PDF conversion with headers
http://code.google.com/p/xdocreport/issues/detail?id=433

Hello,

What steps will reproduce the problem?
1. Create a docx file with headers : the header size of the first page
should be different from the size of the headers of the following page
(smaller in my example)
2. Convert the docx in a PDF file using XDocReport converter

What is the expected output? What do you see instead?
The resulting PDF displays correctly all the headers, but with the same
size on each page : if the size is smaller on the first page, then the text
will be overlayed on the following pages (it is easier to understand by
looking at the examples)

What version of the product are you using? On what operating system?
1.0.4

I attached the docx file and the generated output. I guess it also appears
with footers, but I didn't try.

I found that the margins are extended in ExtendedHeaderFooter.setMasterPage
according to the first header size. I could no continue the analysis,
because I am not sure how apache.poi handle the margins of a document with
several pages.

A fix would be perfect, otherwise an hint on how to fix that ?

Thanks,

Julie

Attachments:
toConvert_9.docx 177 KB
toConvert.pdf 161 KB

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

xdocr...@googlecode.com

unread,
Aug 18, 2014, 9:25:09 AM8/18/14
to xdocr...@googlegroups.com
Updates:
Status: Accepted
Owner: angelo.z...@gmail.com

Comment #1 on issue 433 by angelo.z...@gmail.com: PDF conversion with
headers
http://code.google.com/p/xdocreport/issues/detail?id=433

Hi Julie,

At first I have added your docx in our
JUnithttps://code.google.com/p/xdocreport/source/browse/thirdparties-extension/org.apache.poi.xwpf.converter.pdf/src/test/java/org/apache/poi/xwpf/converter/core/AbstractXWPFPOIConverterTest.java
(see Issue433 JUnit test method).

But I have no time to fix it. I suspect that problem is about the image
used in your header. I think if you remove your image and you set a text it
should work.

Problem comes from with
https://code.google.com/p/xdocreport/source/browse/thirdparties-extension/org.apache.poi.xwpf.converter.pdf/src/main/java/org/apache/poi/xwpf/converter/pdf/internal/elements/StylableDocument.java#396
which returns the height of the header.

If I remember with your docx, the iText header contains a PdfTable which
contains a PdfRow which contains a PdfCell which contains text and image.
It's the problem I suppose but no time to find a fix today.

Any contribution are welcome!

Edoardo

unread,
Mar 31, 2016, 10:25:39 AM3/31/16
to xdocreport, codesite...@google.com, xdocr...@googlecode.com
Hello,
to fix this problem I suggest to modify the public constructors of
org.apache.poi.xwpf.converter.pdf.internal.elements.StylableParagraph
as follows:

    public StylableParagraph( StylableDocument ownerDocument, IITextContainer parent )
    {
        super();
        this.ownerDocument = ownerDocument;
        this.parent = parent;
        this.setITextContainer(parent);
        this.originMultipliedLeading = null;
    }

    public StylableParagraph( StylableDocument ownerDocument, Paragraph title, IITextContainer parent )
    {
        super( title );
        this.ownerDocument = ownerDocument;
        this.parent = parent;
        this.setITextContainer(parent);
    }

I hope that helps,
Edoardo
Reply all
Reply to author
Forward
0 new messages