vandeseer / easytable

Small table drawing library built upon Apache PDFBox
MIT License
246 stars 94 forks source link

Document in ParagraphCellDrawer.java #112

Closed zhangwx2020 closed 3 years ago

zhangwx2020 commented 3 years ago

Should it return drawingContext.getPdDocument() instead of null in getPdDocument() of AnnotationDrawListener? This is located at ParagraphCellDrawer.java. Thanks for your help. -Bill

private AnnotationDrawListener createAndGetAnnotationDrawListenerWith(DrawingContext drawingContext) {
    return new AnnotationDrawListener(new DrawContext() {
            @Override
            public PDDocument getPdDocument() {
                return null;
            }

            @Override
            public PDPage getCurrentPage() {
                return drawingContext.getPage();
            }

            @Override
            public PDPageContentStream getCurrentPageContentStream() {
                return drawingContext.getContentStream();
            }
        });
}
vandeseer commented 3 years ago

Hi Bill,

is there any issue or problem you are facing which you think may stem from this particular line of code?

In theory, I think, one could adapt the null and return the PDDocument, but this would require some work (there is no drawingContext.getPdDocument() as of now) and I don't see any benefit. This code you mentioned is mostly glue code. It's needed for the wrapping of pdfbox-layout.

Best, Stefan

zhangwx2020 commented 3 years ago

Yeah, the code is in pdf-box-layout. I wanted to refer PDDocument to support page number link while creating TOC. Thanks, Stefan!