JAVA에서 PDF 양식 테이블 채우기 (Filling PDF form tables in JAVA)


문제 설명

JAVA에서 PDF 양식 테이블 채우기 (Filling PDF form tables in JAVA)

내가 원하는 양식 유형이 있습니다. 목록을 작성하십시오. 모든 Acro 필드를 가져오려고 시도했지만 셀과 관련이 없으며 목록을 반복하여 관련 값을 채우기 위해 해당 셀을 식별해야 합니다. 예를 들어 첫 번째 표에는 세그먼트 A에 대한 목록이 있습니다. Itext를 사용하여 미리 생성된 양식을 채우는 방법을 알려주십시오.


참조 솔루션

방법 1:

Allow me to split up this very broad question into two different questions.

1. You have an interactive form. How can you retrieve the field names / types?

This is explained in different places.

It's explained in Chapter 6 of "iText in Action ‑ Second Edition". See p181‑183 under the title "Inspecting the form and its fields" where you'll find a reference to the FormInformation example.

It's explained in the online documentation tagged with the words Inspect fields, for instance in the answer to the question How to get specific types from AcroFields? Like PushButtonField, RadioCheckField, etc, which was actually an answer to a question on StackOverflow: iTextSharp. How to get specific types from AcroFields? Like PushButtonField, RadioCheckField, etc (I removed that answer because the person who asked the question was extremely rude in his comments.)

If you want to know which fields are defined in a form without writing code, you can use iText RUPS. In the screen shot below, I have opened your PDF in RUPS:

enter image description here

I see fields such as "Klantnaam" (name of the customer), "Aantal1" (amount 1), "Segment1" (segment 1), "Leaseprijs1" (lease price 1),... (Hé, ben jij ook Nederlandstalig?)

2. How do you fill out a form, once you have the names of the fields?

That's also explained in Chapter 6 of "iText in Action ‑ Second Edition". See p183‑186 under the title "Filling out the form" where you'll find a reference to the FillDataSheet example.

You can find other examples online under the Q&A section about interactive forms, the example section about forms, or under the content tagged "Fill form". See for instance the answer to the question How to fill out a pdf file programmatically? (AcroForm technology).

Request for feedback:

We take great pride in the fact that we provide high‑quality documentation. Most of the Q&As on the site are answers provided by us on questions previously posted on StackOverflow, but we rearranged, edited and categorized them for your convenience. See for instance:

We regret that the information provided by us wasn't sufficient for you, and we hope that you will give us feedback so that we can further improve our documentation.

(by Jain‑user3000947Bruno Lowagie)

참조 문서

  1. Filling PDF form tables in JAVA (CC BY‑SA 2.5/3.0/4.0)

#itext #forms #pdf #java






관련 질문

iText로 가변 페이지 PDF를 생성하려고 할 때 예외 (Exception when attempting to generate variable-page PDF with iText)

Icepdf 특수 문자 렌더링 문제 (Icepdf special character rendering issue)

JAVA에서 PDF 양식 테이블 채우기 (Filling PDF form tables in JAVA)

itext를 사용하여 poi에서 차트 내보내기 (Exporting charts from poi using itext)

표 셀에 사각형을 그리는 방법은 무엇입니까? (How to draw rectangles in a Table cell?)

동적 컨트롤로 PDF 양식 템플릿 수정 (Modify PDF Form Template with dynamic controls)

itext와 같은 라이브러리로 Java 응용 프로그램을 배포하는 방법은 무엇입니까? (how to distribute a java-application with libraries such as itext?)

종이 Itext7에서 첫 번째 줄과 마지막 줄 속성을 제거합니다. (Remove the first and last lines properties in the paper Itext7)

Java에서 iText 5를 사용하여 여러 셀을 만들고 각 셀에 각 문자를 설정하는 방법 (How to create multiple cells and set each character into each cell using iText 5 in Java)

iTextSharp(또는 iText 5)를 사용하여 다른 PdfImportedPage의 배경으로 전체 PdfImportedPage를 추가하는 방법 (How to add a full PdfImportedPage as background for another PdfImportedPage with iTextSharp (or iText 5))

그래픽 텍스트 효과가 있는 텍스트 요소 (Text element with graphical text effects)

iText7을 사용하여 PDFButtonFormField에 이미지를 추가할 때 종횡비를 유지하는 방법 (How to Maintain Aspect Ratio when Adding an Image to a PDFButtonFormField using iText7)







코멘트