Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Wed Apr 27, 2022 11:48 am

Hi,
I have used your sample code Embed a Grid into a Grid Cell in PDF at the https://www.e-iceblue.com/Knowledgebase/Spire.PDF/Spire.PDF-Program-Guide/Table/Embed-a-Grid-into-a-Grid-Cell-in-PDF-in-C.html and it worked fine when writing direclty to the pdf page. However when I added PdfPageTemplateElement, I got exception below. Same code works fine when I use grid.draw(page, 0,50); rather than grid.draw(topSpace.getGraphics());. I have also attached the code for your reference and validation.


java.lang.NullPointerException: Cannot invoke "com.spire.pdf.PdfPageLayer.getPage()" because "this.spr‼" is null
at com.spire.pdf.graphics.PdfCanvas.spr╻℡(Unknown Source)
at com.spire.pdf.grid.PdfGridCell.spr◐–—(Unknown Source)
at com.spire.pdf.grid.PdfGridCell.spr┆⅟(Unknown Source)
at com.spire.pdf.grid.PdfGridCell.spr┐–—(Unknown Source)
at com.spire.office.packages.sprgnw.spr⅚℠(Unknown Source)
at com.spire.office.packages.sprgnw.spr▅℠(Unknown Source)
at com.spire.office.packages.sprgnw.spr∬——(Unknown Source)
at com.spire.office.packages.sprgnw.spr§⅟(Unknown Source)
at com.spire.office.packages.sprgnw.spr㈬⃝℡(Unknown Source)
at com.spire.office.packages.sprgnw.spr⌬℠(Unknown Source)
at com.spire.pdf.grid.PdfGrid.spr┻⅞(Unknown Source)
at com.spire.pdf.graphics.PdfGraphicsWidget.draw(Unknown Source)
at com.spire.pdf.graphics.PdfGraphicsWidget.spr≃⅞(Unknown Source)
at com.spire.pdf.graphics.PdfGraphicsWidget.draw(Unknown Source)
at com.alfatech.lab.PDFDiagnosticReport.main(PDFDiagnosticReport.java:105)

mgalal123
 
Posts: 29
Joined: Thu Apr 21, 2022 12:48 pm

Thu Apr 28, 2022 9:52 am

Hi,

Thanks for your inquiry.
Kindly note the PdfPageTemplateElement is just an element that belongs to the page, and the grid needs to be added to the page structure. Hence, adding the PdfGrid in PdfPageTemplateElement is against the PDF structure specification. You have to use the grid. draw(page, 0,50) to draw grid on page. If there is other question, please feel free to write back.

Sincerely,
Kylie
E-iceblue support team
User avatar

kylie.tian
 
Posts: 412
Joined: Mon Mar 07, 2022 2:30 am

Thu Apr 28, 2022 12:09 pm

Hi,
Actually the same code works fine and the grid is added if we removed the embed grid.

mgalal123
 
Posts: 29
Joined: Thu Apr 21, 2022 12:48 pm

Fri Apr 29, 2022 9:19 am

Hi,

Thanks for your reply.
I reproduced your problem on my side and posted the problem to our bug tracking system with the problem number SPIREPDF-5161. I will let you know as soon as the problem is resolved or there is any update. Sorry for the inconvenience.

Sincerely,
Kylie
E-iceblue support team
User avatar

kylie.tian
 
Posts: 412
Joined: Mon Mar 07, 2022 2:30 am

Fri Apr 29, 2022 11:13 am

Thanks a lot, waiting for further updates.

mgalal123
 
Posts: 29
Joined: Thu Apr 21, 2022 12:48 pm

Mon May 30, 2022 6:16 am

Hi,

Thanks for your patient waiting.
Glad to inform you that the reported bug SPIREPDF-5161 has been resolved, please download the new version from the following link.
Website download link: https://www.e-iceblue.com/Download/office-for-java.html
If you install from maven repository, please change the pom setting as below.
Code: Select all
<repositories>
        <repository>
            <id>com.e-iceblue</id>
            <name>e-iceblue</name>
            <url>https://repo.e-iceblue.com/nexus/content/groups/public/</url>
        </repository>
</repositories>
<dependencies>
    <dependency>
       <groupId> e-iceblue </groupId>
        <artifactId>spire.office</artifactId>
        <version>7.5.4</version>
    </dependency>
</dependencies>

Sincerely,
Nina
E-iceblue.com
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Mon May 30, 2022 7:58 am

Great news,
Thanks a lot for your continuous support.

mgalal123
 
Posts: 29
Joined: Thu Apr 21, 2022 12:48 pm

Return to Spire.PDF