Wangun PDF minangka jinis dokumen PDF khusus sing ngemot kolom interaktif ing ngendi informasi teks bisa dilebokake utawa kothak centhang bisa dipilih. Format dokumen iki akeh digunakake kanggo ngumpulake data liwat internet. Sawise nglumpukake data, salah sawijining pilihan sing bisa digunakake kanggo ngreksa data yaiku ngowahi PDF dadi format FDF. File FDF (Format Data Formulir) minangka dokumen teks sing digawe kanthi ngekspor data saka kolom formulir file PDF. Iku mung kalebu data kolom teks sing diekstrak saka kolom formulir sing kasedhiya ing file PDF. Salajengipun, file FDF sing ngemot data formulir kanggo formulir PDF luwih cilik tinimbang file sing ngemot formulir PDF dhewe, saengga arsip file FDF mbutuhake ruang panyimpenan luwih sithik tinimbang ngarsipake formulir PDF. Saiki ing artikel iki, kita bakal ngrembug rincian kanggo ngowahi PDF menyang file FDF tanpa Adobe Acrobat.
API Konversi PDF
Salah sawijining solusi sing bisa dipercaya sing nawakake kemampuan kanggo nggawe, ngowahi lan ngapusi dokumen PDF yaiku Aspose.PDF Cloud. Sampeyan uga ngidini sampeyan mbukak file PDF lan ngowahi menyang macem-macem format sing didhukung. Kajaba iku, bisa uga ngemot formulir PDF lan ngidini kita ngekstrak data formulir menyang format FDF. Saiki kita bakal nambah referensi Aspose.PDF Cloud SDK for Java ing aplikasi Java kanthi nyakup rincian ing pom.xml (proyek jinis mbangun maven).
<repositories>
<repository>
<id>aspose-cloud</id>
<name>artifact.aspose-cloud-releases</name>
<url>https://artifact.aspose.cloud/repo</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-cloud-pdf</artifactId>
<version>21.11.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
Langkah penting sabanjure yaiku entuk kredensial klien saka Cloud Dashboard. Yen sampeyan durung ndhaptar, mangga ndhaftar nganggo alamat email sing bener lan njupuk kredensial pribadi sampeyan.
PDF menyang FDF ing Jawa
Saiki kita bakal sinau langkah-langkah carane mbukak dokumen PDF saka panyimpenan maya lan ngowahi file FDF.
- Gawe obyek saka PdfApi nalika menehi kredensial pribadi minangka argumen
- Kapindho, waca isi dokumen PDF nggunakake conto File lan unggah menyang panyimpenan awan nggunakake metode uploadFile(…) saka PDfAPi
- Saiki mung nelpon metode putExportFieldsFromPdfToFdfInStorage(…) kanggo ngowahi PDF dadi file FDF. File asil disimpen ing panyimpenan maya
// kanggo conto liyane, bukak https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-java/tree/master/Examples/src/main/java/com/aspose/asposecloudpdf/examples
try
{
// Entuk ClientID lan ClientSecret saka https://dashboard.aspose.cloud/
String clientId = "bbf94a2c-6d7e-4020-b4d2-b9809741374e";
String clientSecret = "1c9379bb7d701c26cc87e741a29987bb";
// nggawe conto PdfApi
PdfApi pdfApi = new PdfApi(clientSecret,clientId);
// jeneng input dokumen PDF
String name = "PdfWithAcroForm.pdf";
// maca isi file PDF input
File file = new File("/Users/Downloads/"+name);
// upload PDF menyang panyimpenan maya
pdfApi.uploadFile("input.pdf", file, null);
// jeneng folder kanggo nyimpen file output
String folder = null;
// nelpon API kanggo ngowahi PDF menyang format FDF
AsposeResponse response =pdfApi.putExportFieldsFromPdfToFdfInStorage("input.pdf", "myExported.fdf", null,folder);
// pesen sukses print
System.out.println("PDF sucessfully converted to DOC format !");
}catch(Exception ex)
{
System.out.println(ex);
}
Sampeyan bisa uga nimbang ngundhuh formulir PDF input saka PdfWithAcroForm.pdf.
Ekspor PDF menyang Adobe FDF nggunakake Perintah cURL
Pilihan liyane kanggo ngakses API REST yaiku liwat perintah cURL. Dadi, kita bakal ngekspor data Formulir PDF menyang file FDF nggunakake perintah cURL. Saiki prasyarat kanggo ngasilake token akses JWT (adhedhasar kredensial klien) nggunakake printah ing ngisor iki.
curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=bb959721-5780-4be6-be35-ff5c3a6aa4a2&client_secret=4d84d5f6584160cbd91dba1fe145db14" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"
Sawise JWT digawe, kita kudu nglakokake printah ing ngisor iki kanggo mbukak input PDF saka panyimpenan Cloud lan ekspor menyang format FDF. Salajengipun, tinimbang nyimpen output Adobe FDF menyang panyimpenan maya, kita bakal nyimpen ing drive lokal.
curl -v -X GET "https://api.aspose.cloud/v3.0/pdf/input.pdf/export/fdf" \
-H "accept: multipart/form-data" \
-H "authorization: Bearer <JWT Token>" \
-o "Exported.fdf"
Kesimpulan
Ing pandhuan iki, kita wis nuduhake langkah-langkah nggunakake Java REST API kanggo ngowahi formulir PDF dadi FDF (Format Data Formulir). Proses lengkap wis prasaja lan langsung, lan bisa gampang digabungake menyang aplikasi Java sing wis ana. Apa sampeyan kudu ngowahi formulir PDF siji utawa proses kumpulan pirang-pirang formulir, pandhuan kita nggampangake ngowahi PDF dadi FDF lan ngekspor data formulir PDF menyang format FDF.
Disaranake uga njelajah Dokumentasi Produk sing minangka sumber informasi sing apik tenan kanggo sinau babagan fitur-fitur liyane sing nyenengake. Yen sampeyan kudu ngundhuh lan ngowahi kode sumber Cloud SDK, kasedhiya ing GitHub (diterbitake ing lisensi MIT). Pungkasan, yen sampeyan nemoni masalah nalika nggunakake API, sampeyan bisa nimbang nyedhaki kita kanggo resolusi cepet liwat [forum dhukungan produk] gratis 9.
Artikel sing gegandhengan
Mangga bukak link ing ngisor iki kanggo mangerteni sing luwih lengkap babagan: